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

# Error 2004: Authentication required

> Resolve Relay error 2004.

The bearer credential is missing, invalid, expired, or revoked.

## Response

```json theme={null}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "The bearer credential is missing, invalid, expired, or revoked.",
    "doc_url": "https://docs.relayapp.im/error/codes/2xxx/2004"
  },
  "success": false,
  "trace_id": "b923d71e50be43ba9e0fe1e34a7676c2"
}
```

## Fix

1. Restore the correct user session or Agent Token.
2. Keep credentials in server-side secret storage.

## Retry

Do not retry the same request unchanged.

## Related

* [Error overview](/error)
* [Debugging](/guides/platform/debugging)
