Pagination
Cursor and page modes for every list.
Every list takes limit (default 50, maximum 200; countries allow up to 300) and at most one of:
afterorbefore: cursor mode, the default.page: page mode, 1-based, from 1 to 10000.
Query parameters are camelCase. The response meta always carries limit, after and before. In page
mode it also carries page and totalCount.
Cursor mode
curl "https://api.sandbox.bemyplan.com/data/v1/airports?limit=2" \
-H "Authorization: Bearer bmp_test_…"{
"data": [ { "id": "arp_…", "name": "…" }, { "id": "arp_…", "name": "…" } ],
"meta": { "requestId": "…", "limit": 2, "after": "…", "before": null }
}- Pass
meta.afterback asafterto get the next page. On the last pagemeta.afterisnull. meta.beforegoes back the same way. When you walk backwards withbefore,meta.afteris always set andmeta.beforeisnullonce you reach the start of the list.- Cursors are opaque: send them unchanged and never construct or edit one. A malformed cursor answers
400invalid_cursor. Use a cursor only with the list and the filters that produced it: a cursor is not tied to one list, so a cursor from another list is not recognised as foreign and returns a page keyed on a meaningless position. - The order is stable, by name and then by id, and identical in every environment.
Page mode
curl "https://api.sandbox.bemyplan.com/data/v1/airports?page=2&limit=50" \
-H "Authorization: Bearer bmp_test_…"{
"data": [ { "id": "arp_…", "name": "…" } ],
"meta": { "requestId": "…", "limit": 50, "after": null, "before": null, "page": 2, "totalCount": 1234 }
}Page mode costs one extra count per request. To walk a whole list, prefer cursors.
Rules
- Sending more than one of
after,beforeandpageanswers400invalid_request, with each of them you sent infields. A cursor that this list did not issue answers400invalid_cursor, keyed byafterorbefore. - Each list request is one request for rate limits and for pricing,
whatever its
limit. - Place suggestions are not paginated: they take a
limitof up to 50 (20 when omitted), echoed inmeta.limit.