Pagination looks trivial until a page boundary lands in the middle of a record set that is still being written to. The APIs below implement both common styles — page numbers with a total, and opaque cursors — so you can write a client against each and find out which assumptions your code is making.
Real endpoints from the catalog — every request above is served, and every status code shown is one that endpoint actually returns.
How to practise it
Walk every page of a collection and assert that the number of records you collected equals the total the API reported.
Request a page past the end of the collection. Some APIs answer with an empty list and a 200; the Friends API answers 404. Both are defensible, and your client has to handle whichever it meets.
Check the last page: it is almost always partially full, and off-by-one errors hide there.
Walk the Bank API by cursor and confirm no record is skipped or repeated — the failure mode cursors are supposed to prevent.
Combine pagination with a filter and verify the counts still agree.
Test cursor pagination with Python
Install requests, then run this read-only example. It uses account 1 and an isolated sandbox; the demo token is public. Keep the same sandbox ID across all pages.
import uuid
import requests
url = 'https://funapi.dev/api/bank/v1/accounts/1/transactions'
headers = {
'Authorization': 'Bearer qa-admin-token',
'X-Sandbox-ID': str(uuid.uuid4()),
}
cursor = None
seen_ids = set()
seen_cursors = set()
while True:
params = {'limit': 2}
if cursor is not None:
params['cursor'] = cursor
response = requests.get(url, headers=headers, params=params, timeout=10)
response.raise_for_status()
page = response.json()
for transaction in page['data']:
assert transaction['id'] not in seen_ids, 'Repeated transaction'
seen_ids.add(transaction['id'])
cursor = page['nextCursor']
assert page['hasMore'] == (cursor is not None)
if cursor is None:
break
assert cursor not in seen_cursors, 'Repeated cursor'
seen_cursors.add(cursor)
assert seen_ids, 'Expected seeded transactions'
print(f'Checked {len(seen_ids)} unique transactions')
The nextCursor value is opaque: pass it back unchanged. This test checks for duplicate records and cursor loops; a changing dataset requires additional consistency checks to prove no records were missed.
APIs to try it on
Friends API — Characters, episodes & quotes from the coffee-house gang. (14 endpoints)
Star Wars API — Characters, planets & starships from a galaxy far away. (11 endpoints)
Bank API — Accounts, transfers & cursor pagination. Home of the 402. (9 endpoints)
Rate limit testing — Trigger a real 429 with Retry-After and X-RateLimit headers, and verify your client backs off instead of retrying straight into the limit.
Idempotency key testing — Send the same write twice with an Idempotency-Key and confirm the operation happens once — the mechanism that stops a network retry becoming a duplicate charge.
ETag and If-Match testing — Provoke a 412 Precondition Failed by writing with a stale ETag — the check that stops two clients silently overwriting each other.
Webhook signature testing — Register a callback, trigger a delivery, verify its HMAC signature, and confirm a tampered payload is rejected.
OAuth and JWT testing — Run real client-credentials, authorization-code and device-code flows, then test what your client does when the token expires mid-session.
Negative testing — Provoke 400, 401, 403, 404, 409, 418, 422, 429, 500 and 503 deliberately, and check your client handles each one differently.
Async job testing — Start a long-running job, follow the 202 and its Location header, and poll to completion — including the failure and timeout paths.
LLM API testing — Test code that calls a language model — reassemble streamed answers, detect a dropped stream, honour Retry-After and complete a tool-call round trip — without a real key.
MCP client testing — Test an MCP client or agent over Streamable HTTP — initialize and session ids, tool schemas and structured output, tool errors versus protocol errors, and authentication.