# Sports Leagues (`sports.leagues`)

The leagues the sports scores and odds APIs accept: NFL, NBA, MLB, NHL, college football and basketball, and the top soccer leagues, with sport, country and home time zone.

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

- Endpoint: `POST https://api.primaryapi.com/v1/run/sports.leagues`
- 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.leagues`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

This API takes no input fields: send `{}`.

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 |
|---|---|---|
| `leagues` | object[] |  |
| `leagues[].key` | string | League key to pass as `league`. |
| `leagues[].name` | string |  |
| `leagues[].sport` | enum |  |
| `leagues[].country` | string | ISO country code, or EU for UEFA competitions. |
| `leagues[].timezone` | string | IANA zone a bare `date` is read in for this league. |
| `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

_Input values are placeholders built from the schema._

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/sports.leagues" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## 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": {
      "leagues": [
        {
          "key": "nfl",
          "name": "NFL",
          "sport": "american-football",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "ncaaf",
          "name": "NCAA Football",
          "sport": "american-football",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "nba",
          "name": "NBA",
          "sport": "basketball",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "ncaab",
          "name": "NCAA Men's Basketball",
          "sport": "basketball",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "wnba",
          "name": "WNBA",
          "sport": "basketball",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "mlb",
          "name": "MLB",
          "sport": "baseball",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "nhl",
          "name": "NHL",
          "sport": "ice-hockey",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "mls",
          "name": "MLS",
          "sport": "soccer",
          "country": "US",
          "timezone": "America/New_York"
        },
        {
          "key": "epl",
          "name": "Premier League",
          "sport": "soccer",
          "country": "GB",
          "timezone": "Europe/London"
        },
        {
          "key": "la-liga",
          "name": "LaLiga",
          "sport": "soccer",
          "country": "ES",
          "timezone": "Europe/Madrid"
        },
        {
          "key": "bundesliga",
          "name": "Bundesliga",
          "sport": "soccer",
          "country": "DE",
          "timezone": "Europe/Berlin"
        },
        {
          "key": "serie-a",
          "name": "Serie A",
          "sport": "soccer",
          "country": "IT",
          "timezone": "Europe/Rome"
        },
        {
          "key": "ligue-1",
          "name": "Ligue 1",
          "sport": "soccer",
          "country": "FR",
          "timezone": "Europe/Paris"
        },
        {
          "key": "ucl",
          "name": "UEFA Champions League",
          "sport": "soccer",
          "country": "EU",
          "timezone": "Europe/Zurich"
        },
        {
          "key": "liga-mx",
          "name": "Liga MX",
          "sport": "soccer",
          "country": "MX",
          "timezone": "America/Mexico_City"
        },
        {
          "key": "2-bundesliga",
          "name": "2. Bundesliga",
          "sport": "soccer",
          "country": "DE",
          "timezone": "Europe/Berlin"
        },
        {
          "key": "3-liga",
          "name": "3. Liga",
          "sport": "soccer",
          "country": "DE",
          "timezone": "Europe/Berlin"
        },
        {
          "key": "dfb-pokal",
          "name": "DFB-Pokal",
          "sport": "soccer",
          "country": "DE",
          "timezone": "Europe/Berlin"
        }
      ],
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 18,
  "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.leagues`

## 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 fixed list of 18 leagues. Which ones answer at a given time depends on the season and on data availability; a league with no games that day returns found=false from sports.games.

## 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.

