Skip to main content

Pagination

Instructions on how to use pagination for OrderSync API endpoints that may return a long list of data items.

D
Written by Derek Kohn
Updated today

All endpoints in the OrderSync API that may return a large number of results support pagination. If the response's 'meta' object contains:

"has_more": true

then another page of results exists and another API request must be made to obtain the other pages. For example, if we have called the Order Status By Date Range endpoint with the following request:

curl "https://api.withordersync.com/api/v2/orders/by-date?start_date=2025-12-05&end_date=2025-12-06" \
-H "X-API-Key: pk_live_..."

and the response looks like:

json

{
"data": [ /* response data */ ],
"meta": {
"total": 120,
"page": 1,
"limit": 50, // Default and max limit of results per page
"has_more": true
}
}

we know that we have just received page 1 of the results and since "has_more" is true there are more pages.

To get the next page, we would know to call the same endpoint again, but include in the request the "page" parameter set to 2 (the response's "page" value + 1):

curl "https://api.withordersync.com/api/v2/orders/by-date?start_date=2025-12-05&end_date=2025-12-06page=2" \
-H "X-API-Key: pk_live_..."

and we might get a response like:

json

{
"data": [ /* response data */ ],
"meta": {
"total": 120,
"page": 2,
"limit": 50,
"has_more": true
}
}

in which case we would send another response with the "page" parameter set to 3:

curl "https://api.withordersync.com/api/v2/orders/by-date?start_date=2025-12-05&end_date=2025-12-06page=3" \
-H "X-API-Key: pk_live_..."

and so forth, until we get a response where "has_more" is false:

json

{
"data": [ /* response data */ ],
"meta": {
"total": 120,
"page": 3,
"limit": 50,
"has_more": false
}
}

Then, we have received all the data and can stop making new requests.

Did this answer your question?