Pagination
List endpoints return one page at a time, with a cursor that points at the next.
Cursors
Pages are keyset cursors, not offsets. Every list response carries a meta.page block. To get the next page, send its next_cursor back as the cursor query parameter and change nothing else.
| Field | Meaning |
|---|---|
| limit | Rows requested. Default 50, maximum 500. Set it with the limit query parameter. |
| count | Rows in this page. |
| next_cursor | Pass as ?cursor= to fetch the next page. null means the result set is exhausted. |
| total | Total matching rows. Present only when counting is cheap; never assume it is there. |
Example
Three X accounts with at least a million followers, from List a platform's catalog. The array is shortened to one row here; meta is exactly as returned.
GET /directory/x?min_followers=1000000&limit=3
{
"data": [
{
"user_id": "44196397",
"username": "elonmusk",
"name": "Elon Musk",
"description": "https://t.co/ZdBx5WABYx",
"followers_count": 239804602,
"following_count": 1429,
"statuses_count": 112882,
"media_count": 4788,
"favourites_count": 260169,
"url": "https://x.com/elonmusk",
"is_verified": false,
"is_blue_verified": true,
"verified_type": null,
"is_automated": false,
"location": null,
"photo_url": "https://pbs.twimg.com/profile_images/2122506092437504001/NSS4RHyZ_400x400.jpg",
"banner_url": "https://pbs.twimg.com/profile_banners/44196397/1774145451",
"account_created_at": "2009-06-02 20:12:29+00",
"language": "en",
"country": null,
"category": null,
"citation_score": 97790,
"tier": "S",
"status": "active",
"is_nsfw": false,
"last_seen": "2026-11-26 13:53:24.643921+00",
"weekly_growth": -705137
}
],
"meta": {
"page": {
"limit": 3,
"next_cursor": "eyJzIjoiZm9sbG93ZXJzIiwibyI6ImRlc2MiLCJrIjoiMTU1NjU5MjEzIiwidiI6MTE0MzQzNTk3fQ.pTEIlV94SqlKwbI_KgGrqA",
"count": 3
},
"source": "catalog",
"request_id": "req_c3f291d93d0008b6",
"generated_at": "2026-11-26T13:54:54.256Z",
"took_ms": 29
}
}Walking a list
Loop until next_cursor is null, and stop on any error instead of retrying blindly.
let cursor = null;
const accounts = [];
do {
const qs = new URLSearchParams({ min_followers: "1000000", limit: "100" });
if (cursor) qs.set("cursor", cursor);
const res = await fetch(`https://api.handlesapi.com/v1/directory/x?${qs}`, {
headers: { Authorization: `Bearer ${process.env.HANDLES_API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error.code);
const { data, meta } = await res.json();
accounts.push(...data);
cursor = meta.page.next_cursor; // null when there is nothing left
} while (cursor);import os
import requests
cursor = None
accounts = []
while True:
params = {"min_followers": 1000000, "limit": 100}
if cursor:
params["cursor"] = cursor
res = requests.get(
"https://api.handlesapi.com/v1/directory/x",
params=params,
headers={"Authorization": f"Bearer {os.environ['HANDLES_API_KEY']}"},
)
res.raise_for_status()
body = res.json()
accounts.extend(body["data"])
cursor = body["meta"]["page"]["next_cursor"] # None when there is nothing left
if cursor is None:
breakRules
A short page is not the end
A page can come back with fewer rows thanlimit and still have more behind it. The only reliable stop condition is next_cursor being null.Treat the cursor as opaque
Pass it back verbatim. Do not parse it, build one, or store it for long: it describes a position in the result set as it was when the page was served. Keep the same filters and sort on every request in a walk.Each page is a separate call and costs the same as any other call to that endpoint. See Credits and limits.