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

# AGENT API Authentication: Bearer and ApiKey

> Authenticate AGENT API requests with Bearer tokens or ApiKey headers. Auth is optional when AGENT_CLOUD_API_KEY is unset at server boot.

Aria Compute's AGENT API supports two header-based authentication schemes. Authentication is enforced only when `AGENT_CLOUD_API_KEY` is set at server boot. When it is unset, endpoints are open and do not require an Authorization header.

## Supported schemes

You can use either `Bearer` or `ApiKey` in the Authorization header. Both accept the same API key value.

### Scheme 1: Bearer

```bash theme={null}
curl https://agent.example.com/v1/agents \
  -H "Authorization: Bearer <api_key>"
```

### Scheme 2: ApiKey

```bash theme={null}
curl https://agent.example.com/v1/agents \
  -H "Authorization: ApiKey <key>"
```

In both examples, replace `<api_key>` with your self-serve API key.

## Self-serve API keys

Generate and rotate keys by calling the `/v1/api-keys` endpoints. You can create multiple keys and revoke them independently.

## Error response

If the key is missing or invalid when auth is required, the API returns a 401 with:

```json theme={null}
{
  "error": "Unauthorized"
}
```


## Related topics

- [GET /v1/apikeys: List PIN API Keys](/api-reference/pin/apikeys/list.md)
- [POST /v1/apikeys — Create PIN API Key](/api-reference/pin/apikeys/create.md)
- [Authenticate with PIN API Keys and Agent Tokens](/api-reference/pin/authentication.md)
- [Delete an Aria Agent Cloud Agent Definition](/api-reference/agent/agents/delete.md)
- [Retrieve an Aria Agent Cloud Agent by ID](/api-reference/agent/agents/get.md)
