ParasendDocs
Sign in Start free

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…"
}
ParameterWhat it does
limitHow many objects on a page. Default 25, at most 100.
cursorWhere to continue: the next_cursor from the page before. Leave it out for the first page.

Pages run newest first. While has_more is true, ask again with cursor set to next_cursor:

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_invalid; a limit outside the range answers 400 limit_invalid.

Filters, such as status on deliveries, stay the same from page to page: send them with every request.