Push a batch of rows

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

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

Up to 500 rows and 4 MiB per call, synchronous. Returns a PER-ROW result with a 200, not a 207. A chunk that fails is retried row by row, so one bad row fails only itself; the worst case is one round trip per row. `Idempotency-Key` is REQUIRED here: a retried batch without one would insert the same rows twice.

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}/batches' \
  --header 'Authorization: Bearer '"$CUSPFLOW_API_KEY" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{ "rows": [] }'
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
required
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.

Body

1 required field, 0 optional.

rows
object[]
required
—

Responses

200Per-row results under `data`, totals under `meta`.
{
  "data": [
    {
      "index": 0,
      "status": "inserted",
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "error": "string"
    }
  ],
  "meta": {
    "next_cursor": "eyJrIjpbIjIwMjYtMTEtMDUiLCIzZmE4NWY2NCJdfQ"
  }
}
400Body is not JSON, too large, or Idempotency-Key is missing.
401Missing, malformed, revoked or expired key.
403Key lacks `imports:write`, or the clinic is read-only.
404No such import report in this clinic.
409An identical Idempotency-Key is still in flight.
422rows is not an array, is empty, is over 500, or would exceed the 500,000-row ceiling.
429Rate limited.

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