Pagination
Every endpoint that returns a list is paginated with cursors. Responses return up to 15 items by default, and you can ask for up to 100 with the limit parameter.
Cursor pagination
A paginated response nests its items in a data attribute and includes a next attribute. next holds the cursor of the following page, or null on the last page. To fetch the next page, repeat the same request with cursor set to that value.
Items are sorted by ID, and IDs are ULIDs, so pages are stable: new items never make you see an item twice. Filters are applied before pagination, so you keep the same filters on every page.
- Name
limit- Type
- integer
- Description
Number of items to return, between 1 and 100. Defaults to 15.
- Name
cursor- Type
- string
- Description
The
nextvalue of the previous page. Omit it to get the first page.
An invalid limit or cursor returns a 422.
First page
Request the first page without a cursor. In this example, we get two POIs, and the next attribute tells us there are more.
First page
curl -G https://api.lanewise.app/v1/pois \
-H "X-API-KEY: {YOUR_API_KEY}" \
-d limit=2
Paginated response
{
"data": [
{
"id": "01J42GFDYE5Q8QD42ZS3ZEV751",
"name": "Mercat de la Boqueria",
// ...
},
{
"id": "01J42GFDYE5Q8QD42ZS3ZEV752",
"name": "Park Güell",
// ...
}
],
"next": "01J42GFDYE5Q8QD42ZS3ZEV753"
}
Next page
Pass the next value as cursor. The page starts at that POI.
Next page
curl -G https://api.lanewise.app/v1/pois \
-H "X-API-KEY: {YOUR_API_KEY}" \
-d cursor=01J42GFDYE5Q8QD42ZS3ZEV753 \
-d limit=2
Paginated response
{
"data": [
{
"id": "01J42GFDYE5Q8QD42ZS3ZEV753",
// ...
},
{
"id": "01J42GFDYE5Q8QD42ZS3ZEV754",
// ...
}
],
"next": "01J42GFDYE5Q8QD42ZS3ZEV755"
}
Last page
On the last page, next is null. Stop requesting pages when you see it.
Last page
curl -G https://api.lanewise.app/v1/pois \
-H "X-API-KEY: {YOUR_API_KEY}" \
-d cursor=01J42GFDYE5Q8QD42ZS3ZEV755 \
-d limit=2
Paginated response
{
"data": [
{
"id": "01J42GFDYE5Q8QD42ZS3ZEV755",
// ...
}
],
"next": null
}