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

# Authentication

> Authenticate Clearlayer API requests using your API key.

Clearlayer uses API key authentication via the HTTP `Authorization` header. Every request (except `GET /v1/health`) must include a Bearer token. Requests without a valid key are rejected with a `401` response.

## Your API key

The sandbox API key is:

```
cl_test_key_1234567890
```

Use this key for all sandbox requests. See the [Sandbox](/concepts/sandbox) guide for details on available test data.

## Making authenticated requests

Pass your API key in the `Authorization` header on every request:

```
Authorization: Bearer cl_test_key_1234567890
```

<CodeGroup>
  ```bash curl theme={null}
  curl https://clearlayer-api-production.up.railway.app/v1/investors \
    -H "Authorization: Bearer cl_test_key_1234567890"
  ```
</CodeGroup>

<Tip>
  Store your API key in an environment variable rather than hardcoding it in scripts or source files.

  ```bash theme={null}
  export CLEARLAYER_API_KEY="cl_test_key_1234567890"

  curl https://clearlayer-api-production.up.railway.app/v1/investors \
    -H "Authorization: Bearer $CLEARLAYER_API_KEY"
  ```
</Tip>

<Warning>
  `GET /v1/health` does not require authentication. All other endpoints require a valid `Authorization: Bearer <API_KEY>` header.
</Warning>

## Error responses

The API returns `401` for two distinct authentication failures.

### Missing or malformed header

Returned when the `Authorization` header is absent or does not start with `Bearer `.

```json theme={null}
{
  "error": "unauthorized",
  "message": "Missing or malformed Authorization header. Expected: Bearer YOUR_API_KEY",
  "docs": "https://docs.clearlayer.io/authentication"
}
```

### Invalid API key

Returned when the header is correctly formed but the key is not recognized.

```json theme={null}
{
  "error": "invalid_api_key",
  "message": "The provided API key is not valid. Check your key or generate a new one.",
  "docs": "https://docs.clearlayer.io/authentication"
}
```
