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

# Authentication

> Authenticate UseAgents API requests with an organization-scoped API key.

UseAgents uses API keys to authenticate protected API requests. Include the key in the `Authorization` header as a Bearer token.

<Note>
  During the public beta, the UseAgents API is **free and does not require authentication**. The information below applies when authentication is re-enabled after the beta. Requests are subject to [rate limits](/api-reference/rate-limit).
</Note>

You can view and manage API keys in the [UseAgents Dashboard](https://useagents.site/dashboard) under **Settings** → **API Keys**.

## Protected endpoints

Protected API endpoints require authentication. The `/tools/search` endpoint is one example.

## How to authenticate

Include this header in authenticated API requests:

```text theme={null}
Authorization: Bearer YOUR_API_KEY
```

Replace `YOUR_API_KEY` with the key from your dashboard.

## Example request

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" "https://api.useagents.site/tools/search?q=typescript%20authentication%20sdk"
```

## Authentication errors

When authentication fails, the API returns specific error responses to help you troubleshoot.

### Missing API key

If you do not include the `Authorization` header on a protected endpoint, the API returns `401 Unauthorized`:

```json theme={null}
{
  "error": {
    "status": 401,
    "code": "missing_api_key",
    "message": "Missing API key in the authorization header."
  }
}
```

### Invalid API key

If the key is incorrect, malformed, revoked, or otherwise invalid, the API returns `403 Forbidden`:

```json theme={null}
{
  "error": {
    "status": 403,
    "code": "invalid_api_key",
    "message": "API key is invalid."
  }
}
```

## Best practices

* Store API keys securely and never commit them to version control.
* Rotate keys if you suspect they were exposed.
* Use separate keys for different environments or integrations when appropriate.

## Next steps

* [Errors](/api-reference/errors) to understand other failure responses
