Pagination

List endpoints return a page of results and an opaque cursor for the next page.

Every list endpoint returns a page envelope:

1{
2 "data": [ /* … up to `limit` items … */ ],
3 "next_cursor": "eyJvIjoyNX0"
4}
  • data — the items in this page.
  • next_cursor — pass this back as ?cursor= to fetch the next page. When it is null, you’ve reached the end.

Paging through results

Request the first page, then keep passing next_cursor back as cursor until it’s null:

$# First page
$curl "https://api.usglobalmail.com/v1/mails?limit=50" \
> -H "Authorization: Bearer $USGM_API_KEY"
$
$# Next page
$curl "https://api.usglobalmail.com/v1/mails?limit=50&cursor=eyJvIjoyNX0" \
> -H "Authorization: Bearer $USGM_API_KEY"

The SDKs handle this for you — list methods return an iterator that fetches pages transparently:

1for await (const mail of usgm.mails.list({ limit: 50 })) {
2 console.log(mail.id);
3}

Limit

ParameterDefaultMax
limit25100

Notes

Cursors are opaque and short-lived — don’t parse, store, or construct them. Always page using the most recent next_cursor you received. A cursor encodes the position and the filters of the original request, so keep other query parameters the same while paging.