# Errors

> Status codes the Content API returns and what to do about them.

The Content API uses standard HTTP status codes. A successful request returns `200`.

| Status | Meaning | What to do |
| --- | --- | --- |
| `400` | A query parameter is invalid, such as `limit=500` | Fix the request |
| `401` | The API key is unknown, malformed, or belongs to another site. Or the preview endpoint was called without a key | Check the key and the `siteId` |
| `404` | The site, post, page, tag or author doesn't exist, or isn't published | Show your not-found page |
| `500` | Something went wrong on our side | Retry later. If it keeps happening, email us |

## Not found

A `404` for a single resource returns that key set to `null`, so you can handle it like any other response:

```json
{ "post": null }
```

Drafts and scheduled posts are reported as `404`, the same as missing ones. Nothing about unpublished content leaks through the public endpoints.

## Unauthorized

A `401` carries an `error` message:

```json
{ "error": "API key does not match the requested site" }
```

| Message | Cause |
| --- | --- |
| `Invalid authorization header format` | The header isn't `Authorization: Bearer <key>` |
| `Invalid API key` | The key doesn't exist or was deleted |
| `API key does not match the requested site` | The key belongs to another site |
| `An API key is required for previews` | The preview endpoint was called without a key |

> [!TIP]
> Public endpoints work without a key. If you only read published content, leaving the header out avoids every `401`.
