Skip to main content
Most list endpoints support cursor-based pagination for fetching large datasets efficiently.

How Cursor Pagination Works

1

Initial Request

Make your initial request without a cursor
2

Check Response

The response includes a cursor and has_more flag
3

Next Page

If has_more is true, use the cursor in your next request
4

Repeat

Continue until has_more is false

Example: Paginating TikTok Posts

Initial Request

curl -X POST "https://api.yourservice.com/tiktok/posts" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "charlidamelio",
    "limit": 10
  }'

Response

{
  "success": true,
  "data": {
    "posts": [...],
    "cursor": "1705315800000",
    "has_more": true
  },
  "metadata": {
    "credits_used": 11
  }
}

Next Page Request

curl -X POST "https://api.yourservice.com/tiktok/posts" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "charlidamelio",
    "limit": 10,
    "cursor": "1705315800000"
  }'

Code Examples

import requests

def fetch_all_posts(username, max_posts=100):
    all_posts = []
    cursor = None

    while len(all_posts) < max_posts:
        payload = {
            "username": username,
            "limit": min(100, max_posts - len(all_posts))
        }
        if cursor:
            payload["cursor"] = cursor

        response = requests.post(
            "https://api.yourservice.com/tiktok/posts",
            headers={"X-API-Key": "your-api-key"},
            json=payload
        )

        data = response.json()
        posts = data["data"]["posts"]
        all_posts.extend(posts)

        if not data["data"]["has_more"]:
            break

        cursor = data["data"]["cursor"]

    return all_posts

Endpoints with Pagination

EndpointCursor FieldMax Limit
/tiktok/postscursor100
/instagram/postscursor100
/reddit/postscursor100
/youtube/channel/videosN/A (uses depth)50

Important Notes

Cursors are opaque strings - don’t try to parse or modify them
Cursors may expire after some time. If you get an error, start from the beginning.
  • The limit parameter controls how many items per page (not total)
  • Credit costs apply to each paginated request