Read a list page by page
-
Request the first page.
limitsets how many items a page holds: 1 to 100, 50 when you leave it out. -
Read the items in
data. The response also hasnext_cursor: -
If
next_cursorisn’tnull, request the next page with the same filters andcursorset to it: -
Repeat until
next_cursorisnull: that’s the last page.
Rules for cursors
- Pass a cursor back exactly as you received it. Don’t build or change one.
- Use a cursor only with the same filters as the request that returned it. With different filters, the API answers
400withinvalid_cursor: start again without a cursor. - You can change
limitfrom one page to the next. - Lists have no total count. To count items, page through the whole list.
Sort order
Each list has a fixed order, documented on its reference page, with a tie-breaker so items that sort the same still come in the same order every time. Calls, for example, are newest first bystarted_at, then by id.
Keep a list of calls in sync
To pick up new calls, poll the calls list:- Set
started_froma little before the time of your last sync, so calls that started just before it aren’t missed. - Page through the results.
- De-duplicate by
id. A call’s status, outcome and summary can still change after it first appears, so update calls you’ve already seen.
status is completed, ended, in_progress or in_warm_transfer. To include other statuses, pass status once for each one you want.
