Skip to main content
Version: Next (unreleased)

Pagination

GET list endpoints (/orders/, /inventory/, /locations/, /products/) are cursor-paginated. The default page size is 50; you can request up to 200.

Request

ParameterTypeDefaultNotes
limitinteger50Clamped to the range [1, 200]. Values outside are coerced.
cursorstringOpaque token from a previous response's pagination.next_cursor. Omit on the first call.
# First page
curl 'https://<your-tenant>.datamingle.ai/api/integrations/v1/orders/?limit=100' \
-H 'X-API-Key: sk_live_...'

# Next page
curl 'https://<your-tenant>.datamingle.ai/api/integrations/v1/orders/?limit=100&cursor=eyJjIjoi...' \
-H 'X-API-Key: sk_live_...'

Response shape

Every paginated response adds a pagination object next to data:

{
"success": true,
"data": [
{ "order_number": "ORD-003", "...": "..." },
{ "order_number": "ORD-002", "...": "..." }
],
"pagination": {
"limit": 50,
"next_cursor": "eyJjIjoiMjAyNi0wNC0xNlQxMDowMDowMCswMDowMCIsImkiOiIuLi4ifQ"
}
}

When there are no more records, next_cursor is null — that's your signal to stop.

Ordering

Results are sorted newest-first by (created_at, id). Under concurrent inserts the cursor is stable: a record created between your paginated calls won't cause a skip or duplicate.

Walking the full set

import requests

cursor = None
while True:
params = {"limit": 200}
if cursor:
params["cursor"] = cursor
r = requests.get(
"https://<your-tenant>.datamingle.ai/api/integrations/v1/orders/",
headers={"X-API-Key": "sk_live_..."},
params=params,
timeout=30,
)
body = r.json()
for order in body["data"]:
process(order)
cursor = body["pagination"]["next_cursor"]
if not cursor:
break

Bad cursors

A malformed or tampered cursor returns:

HTTP 400
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid cursor: '...'"
}
}

Treat a bad cursor as a programming bug — don't retry the same value. Start a new walk from the beginning.

Caveats

  • Cursors are opaque. Don't parse or generate them yourself; the format may change.
  • Cursors are bound to the current ordering. Don't mix cursors between endpoints or between filter sets.
  • No total count. The API doesn't return a total — walking the set is the only way to know.