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

# Authentication

> How to obtain and use an API key to authenticate with the Aampe Composer API.

## Overview

The Composer API uses API key authentication. Every request must include your API key in the `X-API-KEY` header.

```python theme={null}
import requests

response = requests.get(
    "https://composer.api.aampe.com/api/formulas",
    headers={"X-API-KEY": "YOUR_API_KEY"},
)
```

***

## Getting Your API Key

1. In the Aampe dashboard, navigate to **System setup → Integrations → API Keys**
2. Click **+ Create new**
3. Copy the generated key immediately — it will not be shown again

<Warning>
  Store your API key somewhere safe as soon as you create it. The dashboard will not show the full key again after you leave the page.
</Warning>

***

## Using the Key

Pass the key in the `X-API-KEY` request header on every call:

```python theme={null}
headers = {
    "X-API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json",  # required for POST/PUT requests with a body
}
```

Requests without a valid key, or with a key that has been revoked, receive a `401 Unauthorized` response.

***

## Best Practices

* Store keys in environment variables or a secrets manager — never hard-code them in source files
* Use a separate key for each environment (production, staging, local development)
* Rotate keys immediately if you suspect compromise
* Contact [support@aampe.com](mailto:support@aampe.com) to revoke or regenerate a key
