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

# invalid_key

> 401 authentication — the bearer key is missing or unknown.

**HTTP 401 · type `authentication`.** The `Authorization` header is missing, isn't a
bearer token, or the key doesn't exist. (A key that existed and was revoked returns
[`key_revoked`](/errors/key_revoked) instead.) Nothing ran and nothing was charged.

## The shape

```json theme={null}
{
  "error": {
    "type": "authentication",
    "code": "invalid_key",
    "message": "No API key matches this token.",
    "doc_url": "https://docs.fiveninelabs.com/errors/invalid_key",
    "request_id": "req_7wq20a"
  }
}
```

## How to fix

* Send the key as `Authorization: Bearer fn_live_…` (or `fn_test_…`). No other auth
  scheme is accepted.
* Check for truncation or whitespace — keys are shown once at mint; if yours is lost,
  mint a new one at [platform.fiveninelabs.com](https://platform.fiveninelabs.com)
  (minting is dashboard-only).
* Confirm which environment your process actually loaded: a `fn_test_` key where you
  expected `fn_live_` authenticates fine but [never spends](/guides/test-mode) — an
  unknown-key 401 usually means the env var is empty or stale.
* Prove the fix with the \$0 identity call: `GET /v1/me`.

## Reproduce it

```bash theme={null}
curl https://api.fiveninelabs.com/v1/me \
  -H "Authorization: Bearer fn_live_not_a_real_key"
```
