LinkedIn API v2 search pagination: bounding limit and cursor lifetime for a large dataset export
0 reputation · 08 Dec 2023, 17:03 UTC
0 reputation · 08 Dec 2023, 17:03 UTC
LinkedIn's v2 REST search endpoints return results in pages, with a limit parameter controlling page size and cursor-based paging used to walk large result sets. A planned export needs to pull a large dataset through these endpoints in bounded requests rather than one unbounded call, and the pagination configuration has to be settled before implementation.
The open decision is how to bound the walk. The per-request limit is reportedly capped at a small maximum, and pagination cursors are said to have a limited lifetime, which matters for an export that may pause and resume. It is also unclear whether offset-style start paging remains a supported alternative for these endpoints, or whether it truncates results beyond an undocumented bound.
31275 reputation · 09 Dec 2023, 01:36 UTC
The v2 search endpoints accept a limit parameter with a hard ceiling of 100 records per request. Sending a value greater than 100 returns a 400 Bad Request with error code INVALID_PARAMETER; the service does not silently truncate the response.
Pagination cursors (found in paging.next or paging.cursor) remain valid for roughly 5 minutes. After expiry the same cursor yields a 400 with code EXPIRED_CURSOR. Because the TTL is not covered by an SLA, treat it as a best‑effort window.
Recommended checkpoint pattern for a resumable export:
start offset that you have tracked separately to skip already‑processed records.start) reliabilityThe start parameter is not supported on v2 search endpoints. Supplying start is ignored and the response always returns the first page. Cursor‑based paging is the only supported mechanism for walking large result sets.
# 1. Confirm limit ceiling
curl -G "https://api.linkedin.com/v2/search" \
-d q=people -d limit=101 \
-H "Authorization: Bearer $TOKEN"
# Expect 400 INVALID_PARAMETER
# 2. Observe cursor expiry
curl -G "https://api.linkedin.com/v2/search" \
-d q=people -d limit=10 \
-H "Authorization: Bearer $TOKEN" > page1.json
CURSOR=$(jq -r '.paging.cursor' page1.json)
sleep 360 # 6 minutes
curl -G "https://api.linkedin.com/v2/search" \
-d q=people -d limit=10 -d cursor="$CURSOR" \
-H "Authorization: Bearer $TOKEN"
# Expect 400 EXPIRED_CURSOR
# 3. Test offset ignorance
curl -G "https://api.linkedin.com/v2/search" \
-d q=people -d limit=10 -d start=50 \
-H "Authorization: Bearer $TOKEN"
# Response should match first page (start ignored)
count field in the paging object is an estimate capped at 10 000 and should not drive progress reporting.If your application holds a partner‑level API contract that documents a higher limit ceiling or a longer cursor TTL, the above bounds would need to be adjusted. Please confirm the exact tier you are using.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.