STAT-API

Quickstart: your first request

Every endpoint is a GET under https://api.stat-api.com/api/v1/{league}/{table}. Authentication is a single API key sent as a Bearer token. You can explore with the shared trial key right away, then swap in your own key for unrestricted access.

  1. 1. Send a request with the trial key

    The trial key `trial_demo` runs every endpoint's documented default request — exactly what the Execute buttons in the API reference send. List the NFL seasons:

    curl -sS \
      -H 'Authorization: Bearer trial_demo' \
      'https://api.stat-api.com/api/v1/nfl/seasons'
    
  2. 2. Read the response envelope

    List endpoints return the rows under a key named for the table, plus pagination metadata. A call without `from_id` returns the first page in the table's default sort (newest first for seasons) with `next_from_id: null`; `has_more` says a full page came back, so more rows can exist.

    {
      "seasons": [
        {
          "id": 2030,
          "start_year": 2023,
          "regular_season_weeks": 18
        }
      ],
      "limit": 10,
      "next_from_id": null,
      "has_more": true
    }
    
  3. 3. Page through with from_id

    Pagination is keyset-based, in ascending id order, and stable even as data changes. Start at `from_id=0`; each response then returns `next_from_id`, which you pass back as `from_id` until it is null. Keyset pagination and full dataset iteration are unlocked on paid plans (Starter from $49/mo).

    curl -sS \
      -H 'Authorization: Bearer YOUR_API_KEY' \
      'https://api.stat-api.com/api/v1/nfl/seasons?limit=10&from_id=0'
    
  4. 4. Filter with real parameters

    Your key unlocks every documented filter on every table. The header stays identical — only the query string changes. Active NBA players, 25 at a time:

    curl -sS \
      -H 'Authorization: Bearer YOUR_API_KEY' \
      'https://api.stat-api.com/api/v1/nba/players?roster_status=active&limit=25'