Skip to Content
StarsellDocs
Developers

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.

ListStyleParameterspagination
GET /orders, /products, /collections, /customers, /checkoutsPagespage, limit{ page, limit, total, has_more }
GET /eventsCursor, oldest firstafter, limit{ limit, next_after, has_more }
GET /webhooks/{webhookId}/deliveriesCursor, newest firstbefore, limit{ limit, next_before, has_more }
GET /webhooksNot paged (a store has at most 20)-none

Pages

ParameterDefaultRange
limit251 to 100
page11 to 100000

A value outside the range is refused with 422, not clamped.

{
  "data": [],
  "pagination": { "page": 2, "limit": 100, "total": 163, "has_more": false }
}
FieldDescription
pageThe page you asked for.
limitThe page size used.
totalHow many rows match your filters, across all pages.
has_moretrue when rows come after this page. Stop when it is false.

Read every page:

all-open-orders.ts
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

ListDefault ordersort
OrdersNewest first (created_desc)created_desc, created_asc, updated_desc, updated_asc
ProductsOldest first (created_asc)created_asc, updated_desc
CollectionsOldest first-
CustomersLatest order first-
CheckoutsLatest 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
Ordersupdated_after (with sort=updated_asc), created_after, created_before
Productsupdated_after
Checkoutsupdated_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:

HeaderValue
X-RateLimit-Limit240
X-RateLimit-RemainingCalls left this minute, after this one.
X-RateLimit-ResetSeconds 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: 23

What counts

  • Every call made with a valid key counts, whatever the answer: a 404, a 409, a write refused because the key is read-only, a replayed Idempotency-Key answer, and a 429 itself.
  • Calls refused before the key is checked don't count and carry no rate headers: 401 (no key, a wrong or revoked key), 403 for another store's key, and 400 or 422 from 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.

fetch-with-limit.ts
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=100 for bulk reads. Reading 10,000 orders takes 100 calls, under half a minute's budget.
  • Watch X-RateLimit-Remaining in 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 /events gives 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.

On this page