Pagination & filtering
Some endpoints return a list — all your users, all your numbers, all your webhooks. Pagination means fetching a long list in smaller chunks ("pages") instead of all at once; filtering means narrowing a list down to just the items that match a condition. This page covers how the list endpoints behave right now (full lists, with filtering on only one of them) and how to write your code so it keeps working once pagination is added.
No list endpoint pages its results yet — each one returns the entire set
in a single response (there is no "page 1, page 2"). On a large account,
GET /users can be a big response.
Current behaviour
| Endpoint | Returns | Filters |
|---|---|---|
GET /users | Every user the credential may see | None |
GET /sms/lines | Every SMS-capable number the credential may see | None |
GET /webhooks | Every subscription | type, enabled=true |
GET /calls/{id}/recordings | Every recorded leg of one call | None — one call has only a few legs, so the list is always small |
A call leg is one connected segment of a call — a transferred call has more than one, and each can be recorded separately.
Only one endpoint guarantees an order: GET /users is sorted by last name,
then first name, then id. That makes it meaningful to compare two responses and see
what changed. The others return results in whatever order they are stored, which
you should not rely on.
Filtering, where it exists
GET /webhooks accepts two optional filters you add to the URL (query
parameters):
curl "…/webhooks?type=AccountSMS" -H "Authorization: Bearer $TB_KEY"
curl "…/webhooks?enabled=true" -H "Authorization: Bearer $TB_KEY"
Leaving a parameter off really does mean "no filter" (not "match nothing"). And an
unknown type returns a 400, not an empty list — so you find out you made a typo
instead of wrongly concluding there are no subscriptions.
enabled=false is not supportedIt returns 400 with "type": "unsupported". You can only filter for what is
on (enabled=true), not for what is off. To list the disabled subscriptions,
leave enabled off and filter the results yourself.
Write your code so future paging won't break it
Paging will be added later, and the responses are already shaped so it can be added without breaking your code:
{ "data": [ … ] }
data will stay the array. Any paging information will arrive as a new field
next to data — never inside data, and data will never change from an array
into an object. For example, a paged response might look like this (the exact field
name will be documented here when it ships):
{
"data": [ … ],
"nextCursor": "…"
}
So:
- Treat
dataas the list of results — but do not assume it always holds every result. Later it may contain only the first page. - Ignore fields you do not recognize rather than failing on them. New ones (like a paging marker) will appear over time, and your code should keep working when they do.
- Do not hard-wire "one request = the whole list" into code you cannot easily change. Write the fetch as a loop that could grab another page later — even though, for now, there is only ever one.
When it ships, the parameter names will be documented here, and the current "everything in one response" behaviour will stay the default for existing clients.