# Sports Scores and Schedules (`sports.games`)

Games for a league on a date or short date range: teams, start time, status (scheduled, live, final, postponed), score, period scores and live clock.

Docs: https://primaryapi.com/docs/api-reference/sports/games

- Endpoint: `POST https://api.primaryapi.com/v1/run/sports.games`
- Category: Knowledge & Data · Platform: `sports` · Kind: list · Status: live
- Price: 1 credit per call. Every call costs the same, including calls that were retried automatically.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=sports.games`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `league` | enum | yes |  | one of: nfl, ncaaf, nba, ncaab, wnba, mlb, nhl, mls, epl, la-liga, bundesliga, serie-a, ligue-1, ucl, liga-mx, 2-bundesliga, 3-liga, dfb-pokal | League key: nfl, ncaaf, nba, ncaab, wnba, mlb, nhl, mls, epl, la-liga, bundesliga, serie-a, ligue-1, ucl, liga-mx, 2-bundesliga, 3-liga, dfb-pokal (see sports.leagues). |
| `date` | string | no |  | pattern: ^\d{4}-\d{2}-\d{2}$ | Games on this date (YYYY-MM-DD) in `timezone`. Omit (with no range) for today in the league’s home zone. |
| `dateFrom` | string | no |  | pattern: ^\d{4}-\d{2}-\d{2}$ | First date of a range (YYYY-MM-DD), with dateTo; at most 7 days. |
| `dateTo` | string | no |  | pattern: ^\d{4}-\d{2}-\d{2}$ | Last date of the range (YYYY-MM-DD), inclusive. |
| `timezone` | string | no |  | max 64 chars | IANA time zone the dates are read in, e.g. "America/Los_Angeles" or "UTC". Default: the league’s home zone (US leagues: America/New_York). |
| `status` | enum | no |  | one of: scheduled, live, final, postponed, delayed, suspended, cancelled, unknown | Only games with this status, e.g. "final" or "live". |
| `clock` | boolean | no | true |  | Include the live game clock. Set false for monitors that should fire only when the score or status changes. |
| `limit` | integer | no | 100 | 1–300 | Maximum number of games to return (1-300, default 100), earliest first. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `league` | string |  |
| `timezone` | string | Zone the dates were read in. |
| `dateFrom` | string |  |
| `dateTo` | string |  |
| `games` | object[] | Games by start time, then id. |
| `games[].id` | string | Game id for sports.game and odds.event. |
| `games[].league` | string | League key. |
| `games[].sport` | string |  |
| `games[].startTime` | string | Scheduled start, ISO-8601 UTC. |
| `games[].status` | enum |  |
| `games[].statusDetail` | string \| null | Status as published, e.g. "Final/OT" or "Top 3rd". |
| `games[].homeTeam` | object |  |
| `games[].homeTeam.name` | string |  |
| `games[].homeTeam.abbreviation` | string \| null |  |
| `games[].awayTeam` | object |  |
| `games[].awayTeam.name` | string |  |
| `games[].awayTeam.abbreviation` | string \| null |  |
| `games[].homeScore` | integer \| null | null before the game starts. |
| `games[].awayScore` | integer \| null |  |
| `games[].periods` | object[] | Score per period (quarter, half, inning, period), when published. |
| `games[].periods[].period` | string |  |
| `games[].periods[].home` | integer \| null |  |
| `games[].periods[].away` | integer \| null |  |
| `games[].period` | string \| null | Current period of a live game. |
| `games[].clock` | string \| null | Game clock of a live game (omitted when clock=false). |
| `games[].venue` | string \| null |  |
| `games[].attribution` | string \| null | Credit line the data licence asks you to show with this game, when there is one. |
| `nextCursor` | null |  |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/sports.games" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"league":"bundesliga","date":"2025-11-07"}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "league": "bundesliga",
      "timezone": "Europe/Berlin",
      "dateFrom": "2025-11-07",
      "dateTo": "2025-11-07",
      "games": [
        {
          "id": "WyJvIiw3NzM0MCwiYnVuZGVzbGlnYSJd",
          "league": "bundesliga",
          "sport": "soccer",
          "startTime": "2025-11-07T19:30:00.000Z",
          "status": "final",
          "statusDetail": "Full time",
          "homeTeam": {
            "name": "SV Werder Bremen",
            "abbreviation": null
          },
          "awayTeam": {
            "name": "VfL Wolfsburg",
            "abbreviation": null
          },
          "homeScore": 2,
          "awayScore": 1,
          "periods": [
            {
              "period": "1H",
              "home": 0,
              "away": 0
            },
            {
              "period": "2H",
              "home": 2,
              "away": 1
            }
          ],
          "period": null,
          "clock": null,
          "venue": null,
          "attribution": "Data from OpenLigaDB (www.openligadb.de), licensed under ODbL 1.0"
        }
      ],
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 1 credit per call
- Price ceiling: the usual price, even when a call is retried. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=sports.games`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

## Notes

A bare date means that calendar day in the league’s home time zone (US leagues: Eastern), so a 7:30 pm game is listed on its own date; pass timezone to read dates elsewhere. Statuses are normalised to scheduled, live, final, postponed, delayed, suspended, cancelled or unknown. No games that day returns found=false. For a monitor on a final score, use sports.game with clock=false. When a game carries an `attribution`, show it wherever you display that game.

## Legal

Scores and schedules are informational; they are not official league data and are not suitable for settling bets. Team and league names are trademarks of their owners.

