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

# Authentication

> How to authenticate with the Encrata API.

All API requests require an API key passed via the `Authorization` header using the Bearer scheme.

```bash theme={"dark"}
Authorization: Bearer YOUR_API_KEY
```

## Creating a key

1. Go to [encrata.com/api-keys](https://encrata.com/api-keys)
2. Click **Create Key**
3. Copy the key it's only shown once

### Key behavior

| Behavior           | Detail                                                          |
| ------------------ | --------------------------------------------------------------- |
| **Format**         | Opaque string                                                   |
| **Scope**          | Tied to your user account                                       |
| **Revocation**     | Instant revoked keys are rejected immediately                   |
| **Usage tracking** | Every request is logged with credits consumed and response time |

## Example request

```bash theme={"dark"}
curl -X POST https://encrata.com/api/agent/lookup \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "test@example.com"}'
```

## Error responses

If authentication fails, the API returns:

**Standard endpoints:**

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

**Agent endpoint:**

```json theme={"dark"}
{
  "c": 401,
  "m": "bad key"
}
```

<Warning>
  Keep your API key secret. Do not commit it to version control or expose it in client-side code.
</Warning>
