Pagination
Search results come in pages. Each page ends with a cursor that points to the next page. You send the same request again with that cursor until there are no more pages.
How the cursor works
Every search response has a pagination object:
{
"limit": 20,
"returned": 20,
"hasMore": true,
"nextCursor": "eyJ2IjoxLCJrIjpbMTc5NTU0MjQzNjAwMCwi..."
}
- The cursor is opaque. Pass it back exactly as you got it. Do not parse it, build it or change it. Its format can change.
- The cursor does not expire. You can continue a walk hours or days later.
- Pages are not a snapshot. New articles keep arriving while you page. Depending on where their timestamp sorts, they can show up on a later page or not at all in this walk. The cursor keeps your place, so you do not get the same article twice because of new arrivals.
- There is no total count. You only know whether another page exists.
- The last page has
hasMore: falseandnextCursor: null. Stop when you see either one.
Every page is a separate request and costs 1 credit. See Rate limits & credits.
Walk through the pages
- Send the first request without
cursor. - Read
pagination.nextCursorfrom the response. - Send the same body again, with
cursorset to that value. - Repeat until
hasMoreisfalseornextCursorisnull.
The client libraries do this for you with searchAll (TypeScript, Java, PHP), SearchAll (Go), SearchAllAsync (.NET) or search_all (Python, Ruby, Rust). It freezes your request body when you call it and only adds the cursor on later pages. It stops after 10 pages by default (maxPages or max_pages), because every page costs a credit. If it stops early, the result says so (truncated) and gives you the cursor to continue.
Request
BODY='{"query":"eventType:mna","limit":50}'
# Page 1
curl -s -X POST 'https://api.finlight.me/v3/articles/search' \
-H 'Content-Type: application/json' \
-H "X-API-KEY: $FINLIGHT_API_KEY" \
-d "$BODY" > page1.json
CURSOR=$(jq -r '.pagination.nextCursor' page1.json)
# Page 2: the same body plus the cursor
curl -s -X POST 'https://api.finlight.me/v3/articles/search' \
-H 'Content-Type: application/json' \
-H "X-API-KEY: $FINLIGHT_API_KEY" \
-d "$(jq -c --arg cursor "$CURSOR" '. + {cursor: $cursor}' <<< "$BODY")" > page2.json
What may change between pages
Send the identical body on every page. Only three fields may change:
| Field | May change between pages? |
|---|---|
cursor | Yes. It is the cursor of the previous page. |
limit | Yes. You can ask for bigger or smaller pages. |
include | Yes. It changes which blocks you get, not which articles match. |
orderBy, order | No. Gives CURSOR_MISMATCH. |
Every other field (query, from, to, languages, tickers, sourceTypes, ...) | No. Gives CURSOR_MISMATCH. |
Rules for the request body
The server compares the filters of each page with the filters of the first page. These rules decide what counts as "the same":
- The order of values in a list does not matter.
["en", "de"]and["de", "en"]are the same. Duplicates do not matter either. - Values are compared as written.
["EN"]is not the same as["en"], even though both search English. - A missing filter is not the same as its default. If page 1 had no
languages, do not add["en"]on page 2. If page 1 had noto, do not add one later. OnlyorderByandorderare compared with their defaults filled in. - Do not compute
to = nowfor each page. That changestoon every page and breaks the cursor. Either leavetoout on all pages, or compute it once and send the same value on every page.
The simplest way to follow these rules is to build the body once, store it, and only add the cursor. That is what searchAll and search_all do.
Polling for new articles
To fetch articles in the order they became available, sort by availableAt:
{
"orderBy": "availableAt",
"order": "asc",
"from": "2026-11-24T18:45:54.077Z",
"limit": 100
}
Set from to the availableAt of the last article you processed. from is inclusive, so you will see that article again. Skip it by its id. Only articles indexed after availableAt was introduced have this timestamp. See Dates and sorting.
For real time delivery, use the WebSocket or webhooks instead of polling.
Cursor errors
CURSOR_MISMATCH (400) means the cursor belongs to a different request. The detail says which part changed:
The cursor was issued for sort order 'publishedAt:desc', the request asks for 'publishedAt:asc'.You changedorderByororder.The cursor was issued for a different set of filters. Start a new search without a cursor.You changed a filter or the query, or added or removed a field.
To fix it, send the body of the first page again, or start a new search without a cursor. See Cursor mismatch.
CURSOR_INVALID (400) means the value is not a cursor from this API, for example because it was cut off or changed. Possible detail texts:
The cursor is not a valid base64url-encoded value.The cursor does not carry the expected fields.Unsupported cursor version '<v>'.
Pass nextCursor back unchanged, or start again without a cursor. See Cursor invalid.
Response (400)
{
"type": "https://docs.finlight.me/errors/cursor-mismatch",
"title": "Cursor mismatch",
"status": 400,
"detail": "The cursor was issued for a different set of filters. Start a new search without a cursor.",
"code": "CURSOR_MISMATCH",
"requestId": "req_8e6c26de-fb44-4aaf-9cf7-de8fd29de944",
"errors": [
{
"field": "cursor",
"issue": "The cursor was issued for a different set of filters. Start a new search without a cursor."
}
]
}
Response (400)
{
"type": "https://docs.finlight.me/errors/cursor-invalid",
"title": "Cursor invalid",
"status": 400,
"detail": "The cursor is not a valid base64url-encoded value.",
"code": "CURSOR_INVALID",
"requestId": "req_107f6dcd-c7ff-4a16-ac11-7546b657b10d",
"errors": [
{
"field": "cursor",
"issue": "The cursor is not a valid base64url-encoded value."
}
]
}