Every list comes back in results. How you read past the first page
depends on the list: most page by number, the ones that grow while you read
them give a cursor as well, a few page by cursor alone, and short lists
come back whole. Each list’s pattern is listed below.
Page lists
A page list takes page (from 1) and perPage (from 1 to 200, 50
when left out), and answers:
{
"total": 132,
"page": 1,
"perPage": 50,
"results": []
}
total counts every record that matches, across all pages. A page or
perPage outside those bounds answers 422 naming it; it is never quietly
changed. A page past the end answers 200 with an empty results.
To read the whole list, ask for page 1, then 2, and so on, until a page
has fewer than perPage results. Records added while you read can move
between pages, so a walk by page number can repeat or skip one. The lists
where that matters give a cursor.
GET /account/booked-changesGET /account/credit-notesGET /account/invitesGET /account/invoice-disputesGET /account/invoicesGET /account/invoices/{invoiceId}/lines/{lineId}/detailGET /account/payment-chargesGET /account/pricing/call-ratesGET /account/usersGET /bundlesGET /caller-id-authorisationsGET /colocation/servicesGET /data/ordersGET /data/orders/delayedGET /data/orders/{orderId}/delegationsGET /data/provisioningGET /data/radiusGET /data/servicesGET /data/services/{ref}/diagnosticsGET /data/services/{ref}/healthGET /data/services/{ref}/sessionsGET /data/sq/batchesGET /data/tagsGET /data/usageGET /emergency-addressesGET /end-usersGET /end-users/credit-notesGET /end-users/disputesGET /end-users/hardshipGET /end-users/importsGET /end-users/invoice-approvalsGET /end-users/invoicesGET /end-users/{endUser}/notesGET /end-users/{endUser}/usageGET /end-users/{endUser}/webhooksGET /exportsGET /fax/plansGET /fax/plans/{planId}/sendersGET /integrations/xero/contactsXero’s own pages of 100, with nototal.GET /integrations/xero/queueGET /nbn/quotesGET /numbersGET /numbers/ordersGET /outagesGET /outages/subscriptionsGET /partnersGET /partners/commission-runsGET /partners/invitesGET /portsGET /ports/{reference}/delegationsGET /residential-linesGET /retail/plansGET /retail/plans/{planId}/destinationsGET /transit/services/{serviceNumber}/blackholesGET /trunksGET /trunks/{username}/ipsGET /vpn/groupsGET /vpn/usersGET /watchGET /webhooks
Lists with a cursor
The lists that grow while you read them also answer nextCursor. The first
page is a page list with nextCursor added; pass it back as cursor, with
the same filters, for the next page, until nextCursor is null. The last
page can be empty.
{
"perPage": 50,
"nextCursor": "eyJpZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
"results": []
}
A cursor walks the list newest first from where the last page ended, so a
record added meanwhile is neither repeated nor skipped, however long the
walk takes. A cursor page carries perPage, nextCursor and results
only: no total and no page. Treat a cursor as opaque: pass it back as
it came. One this list did not give you answers 422. A list sorted with sort has no cursor: nextCursor is null, and
sort with cursor answers 422.
For example, in Python:
import requests
def read_all(url, token, params=None):
params = dict(params or {}, perPage=200)
while True:
page = requests.get(url, params=params,
headers={"Authorization": f"Bearer {token}"}).json()
yield from page["results"]
if not page.get("nextCursor"):
return
params["cursor"] = page["nextCursor"]
GET /account/api-callsGET /account/audit-logGET /account/noticesGET /account/paymentsGET /eventsOldest first, fromafterorsince: see Catching up on missed events.GET /smsGET /sms/{number}GET /ticketsGET /voice/cdrsOver a window: see Call records.GET /webhooks/deliveriesGET /webhooks/{webhookId}/deliveries
Lists by cursor alone
These page by cursor from the first page: they take cursor and perPage,
and answer perPage, nextCursor and results, with no total. Follow
nextCursor as above.
GET /end-users/{endUser}/ledgerGET /fax/documentsGET /voice/calls/activeGET /voice/recordings
Call records
GET /voice/cdrs reads a window of time: the 31 days before to when you
send no from, and up to now when you send no to. Each answer says the
window it used in window, and a cursor keeps the first page’s window, so
a walk does not drift as new calls arrive.
Page numbers reach at most 10,000 records into the window (page × perPage);
a deeper page answers 422. total is exact up to 10,000, and reads 10,000
with totalIsBounded: true beyond it. To read more, follow nextCursor,
which has no depth limit.
Lists that come back whole
These are short, so they take no page, perPage or cursor: results
holds every record. Some add a total.
GET /account/invoice-groupsGET /account/invoice-servicesGET /account/invoices/{invoiceId}/disputesGET /account/payment-methodsGET /account/pricing/rangesGET /account/pricing/{range}GET /account/reportsGET /account/usage-alertsGET /account/usage/by-end-userGET /account/usage/daily-dataGET /addresses/searchGET /colocation/sitesGET /data/layer2/destinationsGET /data/poisGET /data/services/{ref}/diagnostics/typesGET /end-users/invoices/{invoiceId}/paymentsGET /end-users/{endUser}/chargesGET /end-users/{endUser}/hardshipGET /end-users/{endUser}/invoice-groupsGET /end-users/{endUser}/invoice-servicesGET /end-users/{endUser}/representativesGET /end-users/{endUser}/safety-recordsGET /end-users/{endUser}/servicesGET /nbn/orders/delayedGET /nbn/orders/product/{orderId}/historyGET /nbn/planning/fibre_uplift/locationsGET /nbn/productsGET /nbn/products/activeGET /nbn/products/in_progressGET /nbn/products/recently_disconnectedGET /nbn/provisioning/layer2/destinationsGET /nbn/salesGET /nbn/service_health/service/{serviceRef}GET /numbers/areasGET /numbers/availableGET /opticomm/provisioning/layer2/destinationsGET /partners/commission-clawbacksGET /retail/noticesGET /retail/payment-gatewaysGET /retail/plans/base-cardsGET /retail/price-book/unpricedGET /sms/sendersGET /watch/event-typesGET /webhooks/event-types
Downloads: CSV and NDJSON
The lists below also download, with format=csv or format=ndjson. A
download is the whole filtered list in one response, not a page, so
page, perPage and cursor are ignored:
csvistext/csv: a header row, then one row per record, with the same columns as aresultsitem.ndjsonisapplication/x-ndjson: one JSON object per line, each the same as aresultsitem.
A format the list does not offer answers 422. A download of call
records covers at most 93 days, so a longer window answers 422 on
from, and each one is recorded in the audit log with the key that made
it.
| List | Formats |
|---|---|
GET /account/credit-notes |
csv, ndjson |
GET /account/invoices |
csv, ndjson |
GET /account/payments |
csv, ndjson |
GET /account/pricing/call-rates |
csv |
GET /account/usage/by-end-user |
csv |
GET /account/usage/daily-data |
csv |
GET /end-users/invoices |
csv, ndjson |
GET /numbers |
csv, ndjson |
GET /ports |
csv, ndjson |
GET /sms |
csv, ndjson |
GET /sms/{number} |
csv, ndjson |
GET /trunks |
csv, ndjson |
GET /voice/cdrs |
csv, ndjson |
To have call records written for you every day or every month, turn on the
scheduled SFTP exports: CDR Delivery under Company Settings, then
Integrations, or PUT /voice/cdrs/exports/{cadence}. See
Call history.