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

# Authenticate with API keys

> Create, rotate and revoke Elastly API keys, choose the key type each system needs, and send the key as a bearer token on every request.

Every API request carries a workspace API key. This page covers the key types, how to send a key, how to create, rotate and revoke keys on the **API & webhooks** page, and what each key status means.

## Send the key

Send the key in the `Authorization` header with the `Bearer` scheme.

```bash theme={null}
curl https://api.elastly.ai/v1/customers \
  -H "Authorization: Bearer YOUR_API_KEY"
```

A request with no key, a malformed key, or a key that is revoked or past its expiry date is refused with `401` and `unauthenticated`. Repeated failed attempts from one source are refused with `429` and `rate_limited` for a short time.

> [!WARNING]
>
> Treat an API key like a password. Keep it on your server and never place it in a browser, a mobile app or a public repository. A key found in public code is marked **Exposed** and revoked at once.

## Key types

The type sets the key's environment and what it can call. It is chosen when the key is created and cannot be changed.

| Type | Prefix | What it can call |
| - | - | - |
| **Live** | `el_live_` | Every pricing, outcome, decision, catalog, customer and event endpoint |
| **Test** | `el_test_` | The same endpoints as **Live**, kept apart from live data and not billed as usage |
| **Read-only** | `el_live_` | Prices, decisions, the catalog, customers and events. It cannot report outcomes |
| **Storefront** | `el_live_` | Price requests on `POST /v1/price` and channel price reads. It receives no cost or margin fields, and it can be limited to a list of channels |
| **Connector** | `el_live_` | The data endpoints for one connected integration. Created from that integration, not from this page |

A **Live**, **Test** or **Read-only** key receives the full price response, including cost and margin fields. Role field visibility, such as hiding cost and margin from a role, applies to members in the dashboard and through the [MCP server](/docs/developers/mcp.md); it does not apply to API keys. Give a key only to a system that may see cost and margin.

## Who can manage keys

Members with **View** access to the **API & webhooks** area can see the key list. Creating, rotating and revoking keys needs **Edit** access to that area. See [Roles](/docs/administration/roles.md).

## Create a key

**1. Open the key list**

Go to **Manage** > **API & webhooks**. On the **API keys** card, select **Open keys**.

**2. Start a new key**

Select **Create key**. In an empty list, select **Create your first key**.

**3. Describe the key**

Enter a **Name** that tells you which system uses the key. Choose a **Type** and an **Expires** value: **30 days**, **90 days**, **1 year** or **Never**. The default is a **Live** key that expires in **1 year**.

**4. Limit a Storefront key to channels**

For a **Storefront** key, the **Channels** field lists the workspace's channels. Leave it on **All channels**, or choose the channels the key may read.

**5. Copy the secret**

Select **Create key**. The dialog shows the full key once. Select **Copy**, store the key in your secret manager, then select **Done**.

> [!WARNING]
>
> The key is shown only once and cannot be viewed again. If you lose it, rotate the key or create a new one.

A key works through its expiry date in the workspace time zone and is refused from the next day. **Never** means the key works until it is revoked.

## Change a Storefront key's channels

A **Storefront** key reads every channel, or only the channels chosen for it. A key limited to channels is refused on any other channel with `404` and `not_found`.

**1. Select the keys**

Go to **Manage** > **API & webhooks**, select **Open keys** and select one or more **Storefront** keys.

**2. Edit the channels**

Choose **Edit channels** from the bulk actions, choose the channels in **Channels** and select **Save**. With one key selected, the field starts with that key's channels.

Keys of another type in the selection are skipped. Rotating a key keeps its channels.

## Rotate a key

Rotating issues a new secret for the same key. The old secret keeps working for 24 hours so your systems can switch over, then stops.

**1. Find the key**

Go to **Manage** > **API & webhooks** and select **Open keys**.

**2. Rotate it**

Select **Rotate** on the key's row and confirm with **Rotate key**. To rotate several keys, select them and choose **Rotate** from the bulk actions.

**3. Replace the secret**

Copy the new secret from the **Key rotated** dialog and update it wherever the key is used within 24 hours.

## Revoke a key

Revoking stops a key at once. Systems that use it stop working right away.

**1. Select the keys**

Go to **Manage** > **API & webhooks**, select **Open keys** and select the keys to revoke.

**2. Revoke them**

Choose **Revoke** from the bulk actions. To confirm, type the key's name when you revoke one key, or `revoke` when you revoke several, then select **Revoke**.

Connector keys are rotated and revoked from the integration they belong to, not from this list.

## Key list

| Column | Meaning |
| - | - |
| **Name** | The key's name and the last characters of its secret |
| **Type** | **Live**, **Test**, **Read-only**, **Storefront** or **Connector** |
| **Limit** | The plan's request limit per second for this key |
| **Refused, 7 days** | Calls from this key refused by the rate limit in the last 7 days |
| **Last used** | When the key last made an accepted call |
| **Expires** | The last day the key works |
| **Status** | Whether the key is accepted |

| Status | Meaning |
| - | - |
| **Active** | Accepted on every request |
| **Expired** | Past its last day and refused from the day after it |
| **Exposed** | Its secret was found in public code. The key is revoked at once |

Refusals for a missing scope or plan are recorded in the audit log.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.