> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sportsxapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors & Status Codes

> HTTP status codes, structured error JSON responses, request correlation headers, and troubleshooting tips.

SportSXAPI uses standard HTTP status codes and returns structured JSON error payloads so your services can handle transient failures cleanly.

## Error Payload Format

Application and route errors return a JSON payload containing `error` and optional `requestId` (which also appears in the `X-Request-Id` response header):

```json theme={"system"}
{
  "error": "Route not found",
  "requestId": "74c8a2d0-41c5-4b5b-b08d-b152b0c82641"
}
```

Gateway authentication and policy middleware errors return `error` and an actionable `message` when applicable:

```json theme={"system"}
{
  "error": "Missing API key"
}
```

## HTTP Status Reference

| Status | Meaning | Common Cause & Resolution |
| :- | :- | :- |
| `200` | **OK** | Request succeeded and returned JSON or an `event-stream`. |
| `400` | **Bad Request** | Missing required query/path argument (for example missing `matchId` or `query`). |
| `401` | **Unauthorized** | `Missing API key` or `Invalid API key`. Verify `X-API-Key` is active in your dashboard. |
| `403` | **Forbidden** | Cross-tier host mismatch (paid key sent to `api.sportsxapi.com`, or free key sent to `apiv2.sportsxapi.com`). |
| `404` | **Not Found** | Invalid endpoint path (`Route not found`) or missing entity ID. |
| `421` | **Misdirected Request** | Request sent to an unrecognized host header instead of `api.sportsxapi.com` or `apiv2.sportsxapi.com`. |
| `429` | **Too Many Requests** | `Monthly rate limit exceeded`, `Demo limit reached`, paid-only `/stream` in demo mode, or `Too many authentication attempts`. |
| `500` / `502` | **Internal Server Error** | Temporary backend processing failure (`Internal server error`). Retry with exponential backoff. |
| `503` | **Service Initializing / Retry** | Live match snapshot is initializing or under transient load. Retry after 1–2 seconds. |

## Correlation & Latency Headers

Every response includes telemetry headers to help debug support requests:

```http theme={"system"}
X-Request-Id: 74c8a2d0-41c5-4b5b-b08d-b152b0c82641
X-Response-Time: 11.42ms
```

> [accordion] Why am I seeing 403 Forbidden even with a valid key?
>
> Check your base URL. Paid keys (`Starter`, `Pro`, `Business`, `Ultra`, `Custom`) must target `https://apiv2.sportsxapi.com`, whereas `FREE` keys must target `https://api.sportsxapi.com`.

> [accordion] Why did a live endpoint return 503 momentarily?
>
> When a live match stream or match state snapshot is first requested or refreshed during active play, the endpoint may briefly return `503` while initializing real-time state. Wait 1–2 seconds and retry to receive live JSON data.

> [accordion] How should I report an unexpected 5xx response?
>
> Email `support@sportxapi.com` or open a ticket on [sportsxapi.com/contact](https://sportsxapi.com/contact) with the endpoint URL, timestamp, and `X-Request-Id` header value.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.