Skip to main content

Pagination

List endpoints, such as GET /deliveries and GET /wallet/transactions, use cursor pagination. Lists are newest first.

Parameters​

ParameterDescription
limitHow many items to return. For example limit=50. The maximum is 100.
starting_afterAn object id. Returns the items after it. Pass the last id of the previous page.

The response carries has_more: true when there is another page.

There is no total count. This keeps lists fast as they grow.

Example​

curl "https://api.getreeds.co/shipping/v1/deliveries?limit=2&starting_after=dlv_9Kd3Qx7M" \
-H "Authorization: Bearer $REEDS_ACCESS_TOKEN"
Response 200
{
"status": "success",
"data": [
{ "id": "dlv_8Pq4Ns2L", "...": "a delivery object" },
{ "id": "dlv_7Hn2Lk1C", "...": "a delivery object" }
],
"has_more": true
}

For the next page, call again with starting_after=dlv_7Hn2Lk1C. Stop when has_more is false.

Fetch all pages​

# Requires jq
CURSOR=""
while true; do
URL="https://api.getreeds.co/shipping/v1/deliveries?limit=100"
[ -n "$CURSOR" ] && URL="$URL&starting_after=$CURSOR"

PAGE=$(curl -s "$URL" -H "Authorization: Bearer $REEDS_ACCESS_TOKEN")
echo "$PAGE" | jq -c '.data[]'

[ "$(echo "$PAGE" | jq -r '.has_more')" = "true" ] || break
CURSOR=$(echo "$PAGE" | jq -r '.data[-1].id')
done
tip

Newest first means new items appear at the start of the list while you page. Pages you have already read don't shift, so you won't see duplicates or skip items.

Next steps​