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

# Errors & status codes

> The error format, HTTP status codes, and common error responses for the Ornn Data API.

## Error format

Errors return a JSON body with an `error` label and a human-readable `message`:

```json theme={null}
{
  "error": "Bad request",
  "message": "Invalid GPU type. Allowed: H100 SXM, H200, A100 SXM4, B200, RTX PRO 6000 WS"
}
```

## Status codes

| Status | Meaning |
| - | - |
| `200` | Success. |
| `400` | Bad request: a missing or invalid parameter. |
| `401` | Unauthorized: missing, malformed, invalid, or revoked API key. |
| `403` | Forbidden: the request is authenticated but not allowed. A `sk_prem_` key gets this on GPU hourly (`/api/gpu/{gpuName}/hourly`), the current-value rolling 24-hour average (`/api/gpu/{gpuName}/rolling-24h-average`), hourly power operations (`/api/power/load` and `/api/power/fuel-mix`), and neocloud routes. Creating a key can also 403 if the account cannot mint (no own grant and no organization access). Daily history at `/api/gpu/{gpuName}/rolling-24h-average/history` remains Premium. |
| `404` | Not found: no data for the requested parameters. |
| `429` | Too many requests. See [Rate limits](/docs/rate-limits). |
| `500` | Internal server error. |
| `503` | Service unavailable (e.g. `/health` when the database is unreachable). |

## Common errors

### 401: Missing key

```json theme={null}
{
  "error": "Unauthorized",
  "message": "API key required. Use Authorization: Bearer YOUR_API_KEY"
}
```

### 401: Invalid or revoked key

```json theme={null}
{ "error": "Unauthorized", "message": "Invalid API key" }
```

```json theme={null}
{ "error": "Unauthorized", "message": "API key is inactive" }
```

### 403: Premium grain or dataset

A Premium (`sk_prem_`) key asking for a Full-only surface — a sub-daily GPU route, hourly power operations, or a neocloud route — is refused rather than silently emptied. The `message` names the surface and the subscription that unlocks it, for example:

```json theme={null}
{
  "error": "Forbidden",
  "message": "Neocloud site data is not included in premium access. A full subscription unlocks it."
}
```

See [Access tiers](/docs/access-tiers).

### 403: Cannot mint a key

Trial, Premium, and Full own grants can mint keys. A member of a Full organization with no own grant can mint an unstamped `sk_live_` key, and a member of a trial or Premium organization a `sk_prem_` key. An account with neither an own grant nor organization access cannot. `POST /api/create-api-key` then returns:

```json theme={null}
{ "success": false, "error": "API keys need an access grant, either your own or through your organization. Write to data@ornn.com for access." }
```

See [Manage API keys](/docs/manage-api-keys) for details.

### 400: Unknown GPU

```json theme={null}
{
  "error": "Bad request",
  "message": "Invalid GPU type. Allowed: H100 SXM, H200, A100 SXM4, B200, RTX PRO 6000 WS"
}
```

### 400: Missing required parameter

```json theme={null}
{
  "error": "Bad request",
  "message": "datetime query parameter is required (format: YYYY-MM-DD HH:MM:SS or ISO 8601)"
}
```

### 404: No data

```json theme={null}
{ "error": "No data available", "message": "No daily index data found for H100 SXM" }
```

<Note>
  Endpoints that return the **nearest** record, such as [`/api/gpu/{gpuName}/history`](/docs/api-reference/historical-prices/get-index-value-nearest-a-timestamp), won't 404 for an out-of-range timestamp. They return the closest match and report the gap in `time_difference`.
</Note>

## Handling errors

Always check the HTTP status before reading the body.

```python theme={null}
import requests

resp = requests.get(
    "https://api.ornnai.com/api/gpu/H100 SXM",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
if not resp.ok:
    err = resp.json()
    raise RuntimeError(f"{resp.status_code}: {err.get('message', err.get('error'))}")

data = resp.json()["data"]
```


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