Pagination
Pagination
All list endpoints support cursor-based pagination. Each response includes a meta.next_cursor field when more results are available. Pass this value as the cursor parameter in your next request to fetch the next page.
How It Works
The number of results per page is controlled by the count parameter, which accepts up to 1,000 on every plan (paginate with the cursor for more). When meta.next_cursor is null, you have reached the end.
Paginated Response Shape
JSON
{ "data": [ ... ], "meta": { "total": 100, "has_next_page": true, "next_cursor": "c_1772323200_abc123", "latency_ms": 312 } }
Pagination Loop: JavaScript
Fetch all followersJAVASCRIPT
const API = "https://xcrop.io/api/v2"; const headers = { Authorization: "Bearer xc_live_..." }; async function fetchAll(username) { let cursor = null; const all = []; do { const url = cursor ? API + "/users/" + username + "/followers?count=100&cursor=" + cursor : API + "/users/" + username + "/followers?count=100"; const res = await fetch(url, { headers }); const json = await res.json(); all.push(...json.data); cursor = json.meta.next_cursor; console.log("Fetched " + json.data.length + " (" + all.length + " total)"); } while (cursor); return all; }
Pagination Loop: Python
Fetch all followersPYTHON
import requests API = "https://xcrop.io/api/v2" headers = {"Authorization": "Bearer xc_live_..."} def fetch_all(username): cursor = None results = [] while True: params = {"count": 100} if cursor: params["cursor"] = cursor r = requests.get(f"{API}/users/{username}/followers", headers=headers, params=params) data = r.json() results.extend(data["data"]) cursor = data.get("meta", {}).get("next_cursor") print(f"Fetched {len(data['data'])} ({len(results)} total)") if not cursor: break return results
Endpoints Supporting Pagination
| Endpoint | Default count | Cursor field |
|---|---|---|
| /users/{username}/tweets | 20 | next_cursor |
| /users/{username}/followers | 20 | next_cursor |
| /users/{username}/following | 20 | next_cursor |
| /users/{username}/replies | 20 | next_cursor |
| /users/{username}/media | 20 | next_cursor |
| /users/{username}/mentions | 20 | next_cursor |
| /users/{username}/verified-followers | 20 | next_cursor |
| /tweets/{id}/conversation | 20 | next_cursor |
| /tweets/{id}/quotes | 20 | next_cursor |
| /lists/{id}/tweets | 20 | next_cursor |
| /lists/{id}/members | 20 | next_cursor |
| /lists/{id}/subscribers | 20 | next_cursor |
| /communities/{id}/tweets (coming soon) | 20 | next_cursor |
| /communities/{id}/members (coming soon) | 20 | next_cursor |
| /search (POST) | 20 | next_cursor |
| /search/users (POST) | 20 | next_cursor |
✦
For high-volume data collection, add a small delay (200-500ms) between pages to stay within per-minute rate limits. Use the
X-RateLimit-Remaining header to adjust dynamically.