Numbered pages
These takepage (1-based) and per_page, and echo back the values they used.
So Search cards reaches at most 20 pages of 100 (2,000 results), Your listings and Get vault return up to 200 a page, List shipments up to 100, and the catalog export and purchase report up to 1,000 rows a page.
Cursor pages
List orders merges four kinds of order, newest first, so it pages by an opaque cursor instead of a page number:limitsets the page size: 1–100, default 50.- Each page returns
has_moreandnext_cursor. Sendnext_cursorback ascursor, unchanged, for the next page. On the last pagehas_moreisfalseandnext_cursorisnull. - The cursor carries the first page’s
since,untilandtype, so later pages ignore those parameters. Orders placed while you page can’t shift what you see, even with the defaultuntilof now. - A cursor that wasn’t passed back unchanged is a
400.
limit.
Out-of-range values
Paging values are clamped, not rejected, except on List shipments, where a value out of range is a400:
- A
pagebelow 1, or one that isn’t a number, is page 1. - A
per_pageorlimitabove the most per page is that maximum. Send a whole number from 1 up: anything else is replaced, by the default or by 1. - On Search cards, a
pageabove 20 is page 20.
page and per_page back from the response rather than assuming what you sent was used. Card activity’s limit and the days on Price history and Card activity aren’t paging values: out of range, they’re a 400.
Reaching the end
- Get vault, Card catalog export and Purchase report return
total, the number of rows across all pages. Keep incrementingpageuntil you’ve fetchedtotalrows. A page past the end is an empty list, and on Get vault and Card catalog export itstotalisnull, so keep the last number you read. Your listings returnstotalandhas_more. - Search cards returns
has_moreinstead. It istruewhen at least one more result follows the page, and alwaysfalseon page 20, the last page you can ask for: apageabove 20 returns page 20 again. To see further, narrow the price range: setmin_priceto the last result’s price (max_pricewithprice_desc) and start again from page 1, skipping the results at that price you already have. A search can also stop at its read ceiling, withtruncated: true: see How far a search reaches. - List orders returns
has_moreandnext_cursor: see Cursor pages.
Pages are snapshots
Inventory changes between your requests (why), so a card can move between pages, or drop out, while you page through Search cards, Your listings, Get vault or the catalog export. Ordering by id keeps a sync stable enough to diff against your copy, but don’t treat one pass as an exact snapshot. The Purchase report is different: purchases are only ever added, so a window that has already closed pages consistently. Pin bothsince and until in the past for a report. List orders keeps its place by cursor, so new orders can’t shift a page, though an order’s status can still change between pages.
