Working with the API
Pagination and syncing
Lists are paged with cursors, and every list can return only what changed since your last sync.
Reading a list
Every list endpoint returns the same envelope:
{
"object": "list",
"data": [ { "id": "ord_…", "object": "order" } ],
"has_more": true,
"next_cursor": "eyJ0IjoiMjAyNi0xMC0xMVQwOTozMDowMFoiLCJpIjoi…"
}limitsets the page size, from 1 to 100. The default is 25.- When
has_moreistrue, call again withcursor=<next_cursor>and the same filters. When it'sfalse,next_cursorisnulland you have everything. - Lists are newest first by default.
curl "https://api.ordexs.com/v1/orders?status=confirmed&limit=100" \
-H "Authorization: Bearer $ORDEXS_API_KEY"
curl "https://api.ordexs.com/v1/orders?status=confirmed&limit=100&cursor=eyJ0Ijoi…" \
-H "Authorization: Bearer $ORDEXS_API_KEY"There are no page numbers and no total counts. Cursors stay correct while new orders keep arriving: you never see an order twice or skip one because the list moved under you.
Keeping a copy in sync
Every list accepts updated_since (and created_since). With updated_since, the list switches to oldest change first, which turns it into a change feed:
- On the first run, read the whole list and remember the largest
updated_atyou saw. - On every later run, ask for
updated_since=<that value>and page through withcursor. - Save the largest
updated_atagain.
let since = await loadCheckpoint() // e.g. "2026-10-11T09:30:00Z"
let cursor = null
do {
const url = new URL('https://api.ordexs.com/v1/orders')
url.searchParams.set('updated_since', since)
url.searchParams.set('limit', '100')
if (cursor) url.searchParams.set('cursor', cursor)
const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.ORDEXS_API_KEY}` } })
const page = await res.json()
for (const order of page.data) {
await upsert(order) // keyed by order.id
if (order.updated_at > since) since = order.updated_at
}
cursor = page.next_cursor
} while (cursor)
await saveCheckpoint(since)A product's updated_at also moves when the stock or price of one of its variants changes, so syncing products with updated_since catches stock changes.
For changes the moment they happen, use webhooks and keep a periodic updated_since sync as a safety net.
