Roll back an import

POSThttps://zwhwryofdsgmzgqbcghl.supabase.co/functions/v1/api/v1/imports/{id}/rollback

Requires the imports:rollback scope. See keys and scopes.

Deletes rows this import created, within 7 days. Rows that anything now references, or that have been edited since, are SKIPPED rather than deleted, and counted in `skipped`. Requires a key bound to an Administrator.

Try it

10 requests a minute

Kept in this tab only (sessionStorage), never saved to disk and never put in the code sample. It is sent to CuspFlow's own proxy on this domain, not to a third party.

Confirm the clinic id (optional)

Fill this in and the request is refused unless the key really belongs to that clinic. It guards against pasting the wrong key, not against an attacker: the clinic is already in the key and anyone holding it can read it from whoami.

Path parameters

Headers (1)
curl --request POST \
  --url 'https://zwhwryofdsgmzgqbcghl.supabase.co/functions/v1/api/v1/imports/{id}/rollback' \
  --header 'Authorization: Bearer '"$CUSPFLOW_API_KEY" \
  --header 'Accept: application/json'
Paste a key to run this.

Path parameters

id
string<uuid>
required
The import report id returned by POST /v1/imports.

Headers

Idempotency-Key
string
Replay protection. Resending the SAME key with the SAME body returns the first response instead of acting twice; the same key with a DIFFERENT body is rejected with 422. The window is 24 hours.

Responses

200Counts of what was deleted and what was skipped, under `data`.
{
  "data": {
    "deleted": 0,
    "skipped": 0
  }
}
401Missing, malformed, revoked or expired key.
403Key lacks `imports:rollback`, or the clinic is read-only.
404No such import report in this clinic.
409The 7-day rollback window has passed.
429Rate limited.

Every error is application/problem+json and carries a code you can branch on. The full catalogue is in error codes.