Documentation / Guides
Pagination
Reading long lists a page at a time with limit and next_cursor.
Long lists come back a page at a time. Set the page size with limit. When there is more, meta.has_more is true and meta.next_cursor holds where to carry on.
The loop
- Make the call with your parameters.
- Keep the rows.
- While
meta.has_moreis true, make the same call with every other parameter the same andcursorset tometa.next_cursor.
import requests
url = "https://api.horseracingapi.co.uk/v1/races/search"
params = {"date_from": "2026-10-01", "date_to": "2026-10-07", "limit": 200}
rows = []
while True:
r = requests.get(url, params=params, headers={"X-API-Key": KEY}).json()
rows += r["data"]
if not r["meta"].get("has_more"):
break
params["cursor"] = r["meta"]["next_cursor"]A cursor is sealed. Never build or change one: anything that is not a cursor we gave is a 400 bad_request.