Pagination
When you query creators, items, or engagement history, the API doesn’t return everything at once. Instead, it delivers results in pages — like flipping through pages of a book.
This is called cursor-based pagination. Here’s how it works in plain terms:
How it works
Think of it like scrolling through a social media feed:
- You ask for the first batch — “Give me the first 20 items”
- The API gives you 20 items + a bookmark — the bookmark tells the API where you stopped
- You ask for the next batch using the bookmark — “Give me the next 20 items, starting from where I left off”
- Repeat until there are no more results
The “bookmark” is what the API calls a cursor (the endCursor value). It’s a long encoded string like eyJpZCI6Ii4uLiJ9 — you don’t need to understand what’s inside it, just pass it back to the API.
Step by step
Step 1: Make your first request
Ask for the first page of results. Always include pageInfo so you know if there are more pages:
query FirstPage {
items(first: 20) {
totalCount
nodes {
id
caption
type
}
pageInfo {
hasNextPage
endCursor
}
}
}Step 2: Check the response
Look at pageInfo in the response:
{
"data": {
"items": {
"totalCount": 350,
"nodes": [
{ "id": "abc-123", "caption": "First post...", "type": "REEL" },
{ "id": "def-456", "caption": "Second post...", "type": "POST" }
],
"pageInfo": {
"hasNextPage": true,
"endCursor": "eyJpZCI6Ii4uLiJ9"
}
}
}
}totalCount: 350— there are 350 items totalhasNextPage: true— there are more results after this pageendCursor: "eyJpZCI6Ii4uLiJ9"— this is your bookmark for the next page
Step 3: Get the next page
Pass the endCursor value as the after parameter:
query NextPage {
items(first: 20, after: "eyJpZCI6Ii4uLiJ9") {
nodes {
id
caption
type
}
pageInfo {
hasNextPage
endCursor
}
}
}Step 4: Repeat until done
Keep repeating Step 3 with the new endCursor from each response. When hasNextPage is false, you’ve reached the last page.
Quick reference
| Field | What it means |
|---|---|
first | How many results per page (max 100) |
after | The cursor (bookmark) from the previous page |
totalCount | Total number of results across all pages — use this for displaying “X of Y” (e.g. “Showing 20 of 1,284”) |
hasNextPage | true = more pages available, false = this is the last page — use this to control your pagination loop |
endCursor | The bookmark to pass as after in your next request |
hasPreviousPage | true = there are pages before this one |
startCursor | Bookmark for the first item on this page |
Which queries use pagination?
| Query | Paginated? |
|---|---|
items | Yes |
creators | Yes |
engagementHistory | Yes |
workspaces | Yes |
filterPresets | No — returns all at once |
mediaContents | No — returns all for the given item IDs |
transcriptions | No — returns all for the given item IDs |
Tips
- Max page size is 100. Setting
firsthigher than 100 will return an error. - You don’t need to paginate manually with AI. Just tell Claude to “get all results” and it will handle the pagination loop for you.
- Cursors are temporary. Don’t store them for long-term use — they may expire. Always start fresh from the first page.
Using with AI:
“Get all my creators, not just the first 20” “Fetch every item in my workspace across all pages” “Keep going until there are no more pages”