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

# Authentication

> Authenticate every request with your Mindcase API key.

Every request needs your API key as a Bearer token, except the public catalog endpoints (`GET /v1/data/all` and `GET /v1/data/{group}/{slug}`).

```
Authorization: Bearer mk_live_xxxxxxxxxxxxxxxxxxxx
```

Get your key at [console.mindcase.co](https://console.mindcase.co). Keys start with `mk_live_`. Runs are charged to the wallet of the key's owner, and all keys on an account share one wallet and one set of [rate limits](https://docs.mindcase.co/rate-limits.md).

> [!WARNING]
>
> Keep your key secret. Don't commit it to version control or ship it in client-side code. Read it from an environment variable such as `MINDCASE_API_KEY`.

## Key errors

| HTTP | `error.code` | What to do |
| - | - | - |
| 401 | `missing_api_key` | Add the `Authorization: Bearer mk_live_...` header |
| 401 | `invalid_api_key` | The key isn't recognised. Check it was copied in full |
| 401 | `revoked_api_key` | The key was revoked. Create a new one in the console |
| 401 | `expired_api_key` | The key was replaced and its grace period ended. Use your new key |
| 402 | `insufficient_balance` | Your wallet is empty. `details.top_up_url` says where to top up |

Handle all four `401` key codes, not just `invalid_api_key`. After 20 failed key attempts in a minute from one address, requests return `429 rate_limited` until the minute passes.


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