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

# Unauthorized

> The request had no API key, or the key isn't valid. HTTP 401, code UNAUTHORIZED.

```json theme={null}
{
  "success": false,
  "error": "Invalid API key",
  "code": "UNAUTHORIZED",
  "documentationUrl": "https://www.importly.io/docs/errors/unauthorized"
}
```

| `error` | Meaning | What to do |
| - | - | - |
| `Missing or invalid Authorization header. Must be in format: Bearer YOUR_API_KEY` | No key was sent, or the header isn't in `Bearer <key>` form | Add `Authorization: Bearer <your key>` |
| `Invalid API key` | The key doesn't match an account | Copy the current key from the API key page |

## Reasons and how to fix

### The header is missing or malformed

Send the key on every request, exactly as `Authorization: Bearer <key>`, with the word `Bearer` and one space:

```bash theme={null}
curl https://api.importly.io/balance \
  -H "Authorization: Bearer $IMPORTLY_API_KEY"
```

### The key was regenerated

Each account has one key. Clicking **Regenerate** on the [API key page](https://www.importly.io/dashboard/api-key) stops the old one immediately. Update your server's environment variable and your MCP client config with the new key.

### The key isn't reaching your server code

If the key comes from an environment variable, check that it's set where the code runs (your host's dashboard, not only your local `.env`), and that it has no quotes or trailing spaces.

See [Authentication](/docs/authentication.md).


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