Pagination
Endpoints that list objects, such as List deliveries, answer one page at a time:
{
"object": "list",
"data": [ { "id": "dlv_01M6P3R2…", "object": "delivery" } ],
"has_more": true,
"next_cursor": "eyJjIjoiMjAyNi0xMS0wNlQw…"
}
| Parameter | What it does |
|---|---|
limit | How many objects on a page. Default 25, at most 100. |
cursor | Where to continue: the next_ from the page before. Leave it out for the first page. |
Pages run newest first. While has_ is true, ask again with cursor set to next_:
curl "https://api.parasend.com/v1/deliveries?limit=100&cursor=eyJjIjoiMjAyNi0xMS0wNlQw…" \
-H "Authorization: Bearer $PARASEND_KEY"
let cursor;
do {
const url = new URL('https://api.parasend.com/v1/deliveries');
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.PARASEND_KEY}` } });
const page = await res.json();
for (const delivery of page.data) handle(delivery);
cursor = page.has_more ? page.next_cursor : undefined;
} while (cursor);
A cursor is opaque: pass it back as it is, and never build one yourself. One that has been changed answers 400 cursor_; a limit outside the range answers 400 limit_.
Filters, such as status on deliveries, stay the same from page to page: send them with every request.