Pagination

One call returns one page; pass page.next_cursor back as cursor for the next. Each page is 1 call, charged on its own. A regular call never fetches extra pages; to get many pages in one request, see the collection section below.

Updated 2026-11-29 · Works with API v1Open in ChatGPTOpen in Claude

The cursor

The cursor is the only way to page. Take page.next_cursor from one page and send it as cursor to the same endpoint with the same parameters. When page.has_more is false there is no next page and next_cursor is null; page.returned says how many items the page holds.

curl -G "https://api.dataxapi.com/v1/tiktok/videos/search" \
  --data-urlencode "query=space station" \
  --data-urlencode "cursor=c1.bGY_kn5Dxsgl6MN3VXHyMcLAdlxPxQw-FwjswIlE" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
dataxapi call tiktok.videos.search 'query=space station' cursor=c1.bGY_kn5Dxsgl6MN3VXHyMcLAdlxPxQw-FwjswIlE

Page size and how long a cursor lasts

  • The page size is the platform's. Each endpoint's page gives the usual size and the largest: tiktok.videos.search returns about 30 items a page, 30 at most.
  • limit sets the size only on the 1 endpoints that list it among their parameters.
  • A cursor expires. The lifetime is on each endpoint's page (1 hour for tiktok.videos.search), and every page carries the exact time in page.cursor_expires_at.
  • A request that is answered whole (a board, for example) returns no cursor.

Errors

CodeStatusWhat it means
cursor_expired410The cursor expired; start again from the first page
cursor_invalid400The cursor does not exist
cursor_mismatch400The cursor was issued for another endpoint or other parameters
cursor_unavailable502This cursor is unavailable just now; retry later or start again from the first page

None of these is charged.

Walk pages with the SDKs and the command line

A call never fetches a page you did not ask for. The SDKs and the command line loop on your side, one call a page, and stop at the limits you set: items, pages, or money. A page that could take the total past the money limit is not fetched.

import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI();
for await (const item of dx.items("tiktok.videos.search", { query: "space station" }, { maxItems: 100, maxSpend: "0.008" })) {
  console.log(item.id);
}
for await (const page of dx.pages("tiktok.videos.search", { query: "space station" }, { maxPages: 3 })) {
  console.log(page.page?.returned, page.meta.billing.amount);
}
from dataxapi import DataXAPI

dx = DataXAPI()
for item in dx.items("tiktok.videos.search", query="space station", max_items=100, max_spend="0.008"):
    print(item["id"])
for page in dx.pages("tiktok.videos.search", query="space station", max_pages=3):
    print(page["page"]["returned"], page["meta"]["billing"]["amount"])
dataxapi call tiktok.videos.search 'query=space station' --pages 3 --max-spend 0.006

Many pages in one request, and a CSV

To have the service page for you, send POST /v1/collect the endpoint's ID, its parameters without cursor, and how many items you want (up to 5,000). You can also set a total spending limit with max_spend; left out, one is worked out from the number of items. It drops repeats and stops at that number, at the last page, when a page adds nothing new, or before a page that would pass the limit. The last page comes whole, so there may be a few more items than asked for.

bash
curl -X POST https://api.dataxapi.com/v1/collect \
  -H "Authorization: Bearer $DATAXAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"capability":"tiktok.videos.search","params":{"query":"space station"},"items":100,"max_spend":"0.008"}'
  • Every page is a call charged at its usual price, and the answer lists each one's request ID and charge. A page that fails is not charged.
  • A request starts no new page after 20 seconds. If done is false, check next (you may need to top up, for example), then resend the original request with collection_id added to continue. The hour runs from the first request; continuing does not extend it. If done is true, stopped says why it ended.
  • GET /v1/collections/{id} reads what has been collected: 100 items at a time by default, up to 1,000 with limit. If next_offset is not null, pass it as offset to read on. ?format=csv returns everything as one CSV file, one column per field; add &view=full to include the ext fields. Both need your key and are free; results are kept for 24 hours.
  • Over MCP, pass collect_items to call, optionally with max_spend. To continue, keep the original parameters and add collection_id. Read all the items in parts for free with read_more, with the collection_id as its result_id; the CSV is downloaded from the address above.

What paging costs

The bill is the number of pages times the price. For tiktok.videos.search at $0.0020 a call and about 30 items a page:

PagesItems, aboutCharged
130$0.0020
390$0.0060
10300$0.0200

A page that fails is not charged. More on what is and is not charged: Billing.