Pagination and limits
Paged lists and cursor lists, their parameters and pagination objects, sort orders, syncing without gaps, and the 240-calls-a-minute rate limit.
Lists come in two styles. The catalog and order lists are numbered pages with a total. The two feeds that only grow, events and webhook deliveries, use a cursor instead.
| List | Style | Parameters | pagination |
|---|---|---|---|
GET /orders, /products, /collections, /customers, /checkouts | Pages | page, limit | { page, limit, total, has_more } |
GET /events | Cursor, oldest first | after, limit | { limit, next_after, has_more } |
GET /webhooks/{webhookId}/deliveries | Cursor, newest first | before, limit | { limit, next_before, has_more } |
GET /webhooks | Not paged (a store has at most 20) | - | none |
Pages
| Parameter | Default | Range |
|---|---|---|
limit | 25 | 1 to 100 |
page | 1 | 1 to 100000 |
A value outside the range is refused with 422, not clamped.
{
"data": [],
"pagination": { "page": 2, "limit": 100, "total": 163, "has_more": false }
}| Field | Description |
|---|---|
page | The page you asked for. |
limit | The page size used. |
total | How many rows match your filters, across all pages. |
has_more | true when rows come after this page. Stop when it is false. |
Read every page:
const BASE = 'https://<admin host>/api/v1/stores/<storeId>'
const headers = { Authorization: `Bearer ${process.env.VITRINA_KEY}` }
const orders = []
for (let page = 1; ; page++) {
const res = await fetch(`${BASE}/orders?status=open&limit=100&page=${page}`, { headers })
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`)
const { data, pagination } = await res.json()
orders.push(...data)
if (!pagination.has_more) break
}Sort order
| List | Default order | sort |
|---|---|---|
| Orders | Newest first (created_desc) | created_desc, created_asc, updated_desc, updated_asc |
| Products | Oldest first (created_asc) | created_asc, updated_desc |
| Collections | Oldest first | - |
| Customers | Latest order first | - |
| Checkouts | Latest activity first | - |
Orders, products, collections and checkouts break ties by id, so the same query returns rows in the same order every time.
Paging while things change
A page is a slice counted from the top of the list at the moment of the call. If an order arrives while you page through newest-first orders, every row moves down one: the last row of page 1 shows up again as the first row of page 2. Rows can also be skipped when one drops out of your filter between calls.
For a one-off export that is fine with a dedupe on id. For a sync that runs again and again, ask for what changed, in the order it changed, so new changes land at the end:
# Orders changed since the last run, oldest change first
curl "$BASE/orders?updated_after=2026-11-27T09:00:00Z&sort=updated_asc&limit=100&page=1" \
-H "Authorization: Bearer $KEY"Keep the latest updated_at you processed and pass it as updated_after next time. updated_after includes that exact time, so the last row comes back once more: skip a row whose id and updated_at you already have.
| List | "Changed since" filter |
|---|---|
| Orders | updated_after (with sort=updated_asc), created_after, created_before |
| Products | updated_after |
| Checkouts | updated_after (last activity), created_after |
To follow everything as it happens instead, use webhooks or poll events.
Cursors
GET /events returns events oldest first after the id you pass as after, and pagination.next_after is the id to pass next (on an empty page, the after you sent, or "0"). Events younger than 2 seconds wait for the next poll, so moving the cursor forward never skips one. Default limit 50, up to 100. See Events.
Events are kept for 90 days and webhook deliveries for 30. See How long events are kept.
GET /webhooks/{webhookId}/deliveries returns deliveries newest first. Pass pagination.next_before as before for the next, older, page. Default limit 25, up to 100. See Webhooks.
{
"data": [],
"pagination": { "limit": 25, "next_before": 8812, "has_more": true }
}Rate limits
Each key can make 240 calls a minute to the store API. The count resets at the start of every clock minute (second :00, UTC). It is a fixed window, not a rolling one.
Every answer to a call that got past the key check carries the count, errors included:
| Header | Value |
|---|---|
X-RateLimit-Limit | 240 |
X-RateLimit-Remaining | Calls left this minute, after this one. |
X-RateLimit-Reset | Seconds until the count resets, 1 to 60. |
HTTP/1.1 200 OK
Content-Type: application/json
X-RateLimit-Limit: 240
X-RateLimit-Remaining: 187
X-RateLimit-Reset: 23What counts
- Every call made with a valid key counts, whatever the answer: a
404, a409, a write refused because the key is read-only, a replayedIdempotency-Keyanswer, and a429itself. - Calls refused before the key is checked don't count and carry no rate headers:
401(no key, a wrong or revoked key),403for another store's key, and400or422from the schema check. - The limit is per key. Two keys have two budgets of 240.
- MCP calls with the same key have their own budget of 240 a minute. See MCP.
Over the limit
The 241st call in a minute, and every call after it until the minute ends, gets 429:
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
X-RateLimit-Limit: 240
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 17
Retry-After: 17
{"error":{"code":"rate_limited","message":"This key made over 240 calls this minute. Wait 17 seconds."}}Wait Retry-After seconds, then carry on. Nothing about the key changes; the next minute has a full 240.
export async function starsell(url: string, init: RequestInit = {}): Promise<Response> {
for (;;) {
const res = await fetch(url, init)
if (res.status !== 429) return res
const wait = Number(res.headers.get('retry-after') ?? '5')
await new Promise(resolve => setTimeout(resolve, wait * 1000))
}
}Tips
- Use
limit=100for bulk reads. Reading 10,000 orders takes 100 calls, under half a minute's budget. - Watch
X-RateLimit-Remainingin long jobs and slow down before it reaches 0, so other integrations on the same key aren't starved. - Don't poll lists in a tight loop to notice changes. A webhook tells you within seconds, and
/eventsgives you everything since your last poll in one call. - Give each integration its own key: one busy job then can't use up another's budget.
Related: Errors, Events, API reference.
Errors
The error body, every error code and status, what causes each one in the store API, and which errors are safe to retry.
Webhooks
Get a signed POST when something happens in a store - setting one up, event types, payloads, verifying X-Starsell-Signature, retries, the delivery log, tests, redelivery and secrets.