# authentication_required

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

**Authentication required.** The request carried no `Authorization` header, or the header was not of the form `Bearer &lt;key&gt;`.

## What it means

The API returns HTTP 401 with `error.code` set to `authentication_required`. The default message is: "Send your API key as a Bearer token in the Authorization header."

## Common causes

- No `Authorization` header.
- A scheme other than `Bearer`.
- An empty token.

## How to identify it

Check the response status (`401`) and `error.code` (`authentication_required`). 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

- Send `Authorization: Bearer rai_test_...` (test mode) or `Authorization: Bearer rai_live_...` (live mode).

## 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

The developer who sends the request can fix it; no administrator action is normally needed.

## 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": "authentication_required",
    "message": "Send your API key as a Bearer token in the Authorization header.",
    "details": {},
    "request_id": "req_stwgrknsunh4rsqs7632uj2u",
    "retry": "no",
    "doc_url": "https://docs.relationsai.com/errors/authentication_required"
  }
}
```

## Incorrect and corrected request

Incorrect: The key was sent without the `Bearer ` scheme.

```http
GET /v1/workspace
Authorization: rai_test_YOUR_TEST_KEY
```

Corrected: The key as a Bearer token.

```http
GET /v1/workspace
Authorization: Bearer rai_test_YOUR_TEST_KEY
```

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