List inventory batches

GEThttps://zwhwryofdsgmzgqbcghl.supabase.co/functions/v1/api/v1/inventory_batches

Requires the inventory:read scope. See keys and scopes.

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.

Query parameters (14)
curl --request GET \
  --url 'https://zwhwryofdsgmzgqbcghl.supabase.co/functions/v1/api/v1/inventory_batches' \
  --header 'Authorization: Bearer '"$CUSPFLOW_API_KEY" \
  --header 'Accept: application/json'
Paste a key to run this.

Query parameters

limit
integer
defaults to 50
Page size. Default 50, clamped to 200 rather than rejected.
cursor
string
Opaque keyset cursor from `meta.next_cursor`. Do not construct one by hand. There is no offset parameter: PostgREST caps a range at 1000 rows and truncates silently.
fields
string
Comma-separated subset of: id, clinic_id, branch_id, inventory_item_id, batch_number, supplier_name, expiry_date, quantity_received, quantity_remaining, cost_per_unit, received_at, write_off_quantity, write_off_reason, written_off_at, written_off_by, notes, created_at, updated_at.
sort
string
Sortable: expiry_date, received_at, created_at, updated_at. Prefix with `-` for descending. Default `expiry_date`. An `id` tiebreak is always appended so the order is total.
include_total
boolean
defaults to false
Run an exact count and return it as `meta.total`. Expensive; counts double against the rate limit.
include_deleted
boolean
defaults to false
Include soft-deleted rows. `deleted_at` itself is never returned.
id
string<uuid>
Filter on `id`. Also accepts `id[gte]`, `id[lte]`, `id[gt]`, `id[lt]`, `id[in]` (comma-separated).
branch_id
string<uuid>
Filter on `branch_id`. Also accepts `branch_id[gte]`, `branch_id[lte]`, `branch_id[gt]`, `branch_id[lt]`, `branch_id[in]` (comma-separated).
inventory_item_id
string<uuid>
Filter on `inventory_item_id`. Also accepts `inventory_item_id[gte]`, `inventory_item_id[lte]`, `inventory_item_id[gt]`, `inventory_item_id[lt]`, `inventory_item_id[in]` (comma-separated).
batch_number
string
Filter on `batch_number`. Also accepts `batch_number[gte]`, `batch_number[lte]`, `batch_number[gt]`, `batch_number[lt]`, `batch_number[in]` (comma-separated).
expiry_date
string<date>
Filter on `expiry_date`. Also accepts `expiry_date[gte]`, `expiry_date[lte]`, `expiry_date[gt]`, `expiry_date[lt]`, `expiry_date[in]` (comma-separated).
received_at
string<date-time>
Filter on `received_at`. Also accepts `received_at[gte]`, `received_at[lte]`, `received_at[gt]`, `received_at[lt]`, `received_at[in]` (comma-separated).
created_at
string<date-time>
Filter on `created_at`. Also accepts `created_at[gte]`, `created_at[lte]`, `created_at[gt]`, `created_at[lt]`, `created_at[in]` (comma-separated).
updated_at
string<date-time>
Filter on `updated_at`. Also accepts `updated_at[gte]`, `updated_at[lte]`, `updated_at[gt]`, `updated_at[lt]`, `updated_at[in]` (comma-separated).

Responses

200A page of rows.
{
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "clinic_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "branch_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "inventory_item_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "batch_number": "string",
      "supplier_name": "Example",
      "expiry_date": "2026-11-05",
      "quantity_received": 0,
      "...": "…"
    }
  ],
  "meta": {
    "next_cursor": "eyJrIjpbIjIwMjYtMTEtMDUiLCIzZmE4NWY2NCJdfQ"
  }
}
400Unknown field in fields/sort/filter, or a malformed cursor.
401Missing, malformed, revoked or expired key.
403Key lacks the `inventory:read` scope.
429Rate limited. See Retry-After.

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