Paginating API Lists
Most lists are page-numbered. A few large or fast-changing lists are cursor-paged. Each list operation in the API reference documents which parameters it takes.
Page-numbered lists
Working in your own language? These samples use plain HTTP. For a typed client in TypeScript, Python, Go, Java or PHP, generate one from the OpenAPI spec.
| Parameter | Meaning |
|---|---|
page | 1-based page number. Omitted or 0 means page 1. |
page_size | Records per page, 1 to 200. Omitted means 50; larger values return 200. |
The response repeats the paging state next to the rows, under data:
{
"data": {
"total_records": 137,
"page_number": 1,
"page_size": 50,
"docs": [ ]
}
}
total_records counts every row that matches your filters, across all pages. The row array's key depends on the module (docs, peoples, items, accounts, journals, and so on).
To read everything, request pages until you have total_records rows:
page=1
while :; do
body=$(curl -s "$BASE/v1/invoices?page=$page&page_size=200" -H "$AUTH" -H "$PARTNER")
echo "$body" | jq -c '.data.docs[]'
total=$(echo "$body" | jq '.data.total_records')
[ $((page * 200)) -ge "$total" ] && break
page=$((page + 1))
done
Keep the same filters on every page. If records are created while you page, a row can move to an earlier or later page; for an exact snapshot, filter on a closed date range.
Cursor-paged lists
Dimensions, dimension values, the dimension worklist and account lines, and the activity feed return a cursor instead of page numbers:
| Parameter | Meaning |
|---|---|
cursor | The next_cursor from the previous response. Omit it for the first page. |
limit | Records per page. Dimension lists accept 1 to 100 (default 25) and reject other values; the activity feed accepts 1 to 200 (default 50). |
Each response carries next_cursor and has_more. Pass next_cursor back as cursor with exactly the same filters until has_more is false. A cursor from one filter set is rejected with another.
The activity feed also still accepts page and page_size. Use one mode per request: combining page/page_size with cursor, limit, from, to, event or the source filters is rejected with ACTIVITY_PAGINATION_MODES_ARE_MUTUALLY_EXCLUSIVE.
Lists that name things differently
| List | Parameters |
|---|---|
| Custom FX rates and their history | page_number (1-based) and page_size (default 20, at most 100) |
| Webhook deliveries | page and per_page (1 to 100, default 50) |
Unknown parameters are ignored
A misspelled or unsupported query parameter is ignored, not rejected. If a filter seems to have no effect, check its name against the operation in the API reference.