# invalid_api_key

- HTTP status: 401
- Retry: No
- Execution: not started
- Admin needed: yes

**Invalid API key.** The token does not match any API key. Console sign-in tokens and other credentials are not API keys and are refused here too.

## What it means

The API returns HTTP 401 with `error.code` set to `invalid_api_key`. The default message is: "The API key is not valid."

## Common causes

- A typo or a truncated key.
- A key copied with surrounding whitespace or quotes.
- A credential that is not a RelationsAI API key.

## How to identify it

Check the response status (`401`) and `error.code` (`invalid_api_key`). Branch on `error.code`, not on the message text: messages can be reworded, codes do not change within v1. Log `error.request_id` (also sent as the `X-Request-Id` header) so support can find the request.

## How to fix it

- Copy the key again from where you stored it when it was created. Keys are shown only once; if it is lost, create a new key in the console under API & Developers.

## Retry guidance

Sending the request unchanged fails the same way. Fix the cause first (see How to fix it), then send it again.

## Did anything happen?

This request was refused before any call was placed and before anything was charged.

## Idempotency

Nothing was done and nothing was stored (under an Idempotency-Key, if you sent one), so the request can be sent again, with the same key if you used one, once the cause is fixed.

## Who can fix it

A workspace administrator usually has to act, in the RelationsAI console.

## When to contact support

If the error persists after the steps above, contact [support@relationsai.com](mailto:support@relationsai.com). See [Support](/resources/support) for what to include (the `request_id`, the time in UTC, the operation, and whether you used a test or live key) and what never to send (API keys, Authorization headers, webhook signing secrets, recording links, transcripts or customer data).

## Example error response

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is not valid.",
    "details": {},
    "request_id": "req_deaiecuycog7xnloqx4ounlo",
    "retry": "no",
    "doc_url": "https://docs.relationsai.com/errors/invalid_api_key"
  }
}
```

See all codes in the [error-code reference](/fundamentals/error-codes).
