Data as a Service

Sport Data API

Pagination and filters

Opaque cursors, stable orders, and the filters each spine resource accepts.

Every spine resource is cursor-paged. Send limit (1 to 100, default 10). If more rows exist, the response carries a next_page_token; pass it back as page_token. When next_page_token is null, you have everything.

def all_rows(path: str, **params):
    token = None
    while True:
        body = requests.get(
            f"{BASE_URL}{path}",
            headers=headers,
            params={**params, "limit": 100, **({"page_token": token} if token else {})},
            timeout=30,
        ).json()
        yield from body["data"]
        token = body.get("next_page_token")
        if not token:
            return

winners = [r for r in all_rows("/v1/wsl/event-results") if r["finish_position"] == 1]
async function* allRows(path: string, params: Record<string, string> = {}) {
  let token: string | null | undefined;
  do {
    const qs = new URLSearchParams({ ...params, limit: '100', ...(token ? { page_token: token } : {}) });
    const res = await fetch(`${BASE_URL}${path}?${qs}`, { headers });
    const body = await res.json();
    yield* body.data;
    token = body.next_page_token;
  } while (token);
}

Rules worth knowing

  • limit is validated, not clamped. A value outside 1 to 100 returns 400 invalid_request.
  • Tokens are opaque. Their contents can change at any time. Do not parse or construct them.
  • A token is bound to the query that minted it. Changing sort or any filter mid-walk is rejected with 400 invalid_request. Start a new walk instead.
  • Orders are stable. Each resource pages on a unique key, so rows never repeat or skip between pages.
  • Tokens expire after 24 hours. An expired token is 400 invalid_request ("Page token has expired"); start again from the first page.
  • Unknown parameters are rejected. On the spine resources a parameter the endpoint does not take, or the same parameter twice, is 400 invalid_request, and details lists the allowed filters and sorts. A since later than until is also a 400.

A real page pair

Captured from the live API on 2026-10-08. Page one, GET /v1/smx/events?sort=-start_date&limit=2 (IDs and tokens trimmed):

{
  "object": "list",
  "data": [
    { "event_id": "bcfe67d73f5103bc…", "event_name": "Ironman National - Crawfordsville, IN", "start_date": "2026-08-29" },
    { "event_id": "30f9107ede346c7e…", "event_name": "Budds Creek National - Mechanicsville, MD", "start_date": "2026-08-22" }
  ],
  "next_page_token": "eyJjIjp7Il9xIjoiMjYwZTk4YmU0YjQ4MTE5…",
  "meta": { "count": 2, "limit": 2, "order_by": ["start_date DESC NULLS LAST", "event_id"], "sort": "-start_date" }
}

Page two, the same query plus &page_token=<next_page_token>:

{
  "object": "list",
  "data": [
    { "event_id": "f2c4b1ff67203930…", "event_name": "Unadilla National - New Berlin, NY", "start_date": "2026-08-15" },
    { "event_id": "327f08d023f851f0…", "event_name": "Washougal National - Washougal, WA", "start_date": "2026-07-25" }
  ],
  "next_page_token": "eyJjIjp7Il9xIjoiMjYwZTk4YmU0YjQ4MTE5…",
  "meta": { "count": 2, "limit": 2, "order_by": ["start_date DESC NULLS LAST", "event_id"], "sort": "-start_date" }
}

Rows are shortened to three fields here; real rows carry every column in meta.columns. Sending page one's token with sort=start_date instead was refused:

{
  "object": "error",
  "code": "invalid_request",
  "message": "This page token was issued for different filters or sort. Repeat the exact filters and sort of the request that returned it, or restart from the first page.",
  "request_id": "req_8549543ed8020a5fc5506a57",
  "details": { "parameter": "page_token" }
}

Events: dates and sort

ParameterEffect
season_idOnly events in that season.
since, untilInclusive bounds on start_date (YYYY-MM-DD). Undated events are excluded.
sort=-start_dateNewest first. sort=start_date is oldest first. Undated events come last either way; event_id breaks ties.

Drilling down

Events, competitions and results chain through IDs:

/v1/smx/events?season_id=…          → event_id
/v1/smx/competitions?event_id=…     → competition_id, label, division
/v1/smx/results?event_id=…          → per-heat finishes
/v1/smx/event-results?event_id=…    → overall finishes (finish_position = 1 is the winner)
/v1/smx/event-results?competitor_id=… → one rider's record, event by event, across all seasons

On this page