Skip to main content

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

EndpointDefault countCursor field
/users/{username}/tweets20next_cursor
/users/{username}/followers20next_cursor
/users/{username}/following20next_cursor
/users/{username}/replies20next_cursor
/users/{username}/media20next_cursor
/users/{username}/mentions20next_cursor
/users/{username}/verified-followers20next_cursor
/tweets/{id}/conversation20next_cursor
/tweets/{id}/quotes20next_cursor
/lists/{id}/tweets20next_cursor
/lists/{id}/members20next_cursor
/lists/{id}/subscribers20next_cursor
/communities/{id}/tweets (coming soon)20next_cursor
/communities/{id}/members (coming soon)20next_cursor
/search (POST)20next_cursor
/search/users (POST)20next_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.

More in Guides

Full documentation with search: xcrop.io/docs