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

# API keys

> Create and manage API keys for programmatic access to deployment predictions.

API keys authenticate requests to the Chemolytic prediction API. Each key has a name, a scope, an optional expiration date, and is tied to a deployment (or is project-wide).

API keys are managed on the **API Keys** tab of any deployment detail page.

<Frame>
  <img src="https://mintcdn.com/chemolytic/Z4NdeoejDDDPqHhB/images/screenshots/deployments/api-keys-tab.png?fit=max&auto=format&n=Z4NdeoejDDDPqHhB&q=85&s=a9f0fa2ab300d52cc3ac934445963a50" alt="API Keys tab showing a list of keys with name, prefix, status, and last-used columns" width="1714" height="1196" data-path="images/screenshots/deployments/api-keys-tab.png" />
</Frame>

<Note>
  API keys require the **`allow_api_predict`** plan feature. Free plans don't include API access. Upgrade to Pro or higher to create and use keys.
</Note>

## Creating a key

Click **Create API key** to open the dialog.

<Frame>
  <img src="https://mintcdn.com/chemolytic/Z4NdeoejDDDPqHhB/images/screenshots/deployments/create-api-key.png?fit=max&auto=format&n=Z4NdeoejDDDPqHhB&q=85&s=7751cefd53fd9f5566573f1a9ac5e18e" alt="Create API key dialog with name and expiration date fields and a predict scope badge" width="1714" height="1196" data-path="images/screenshots/deployments/create-api-key.png" />
</Frame>

| Field          | Required  | Notes                                                    |
| -------------- | --------- | -------------------------------------------------------- |
| **Name**       | Yes       | Descriptive label, e.g., "Production LIMS integration"   |
| **Expires at** | No        | Date after which the key is automatically rejected       |
| **Scopes**     | Read-only | Currently always **predict** (call prediction endpoints) |

Click **Create key**.

### The key reveal modal

Immediately after creation, a modal opens showing the **full raw key**.

<Frame>
  <img src="https://mintcdn.com/chemolytic/Z4NdeoejDDDPqHhB/images/screenshots/deployments/api-key-revealed.png?fit=max&auto=format&n=Z4NdeoejDDDPqHhB&q=85&s=74ca14cccb1d8969107555c027a4e124" alt="Modal showing a full API key in a code block with a copy button and a warning to save it securely" width="1714" height="1196" data-path="images/screenshots/deployments/api-key-revealed.png" />
</Frame>

<Warning>
  **Copy the key now.** Chemolytic stores only a hash of the key, never the raw value. Once you close this modal, the full key cannot be retrieved. You'll need to create a new key if you lose it.
</Warning>

The key is shown in a copyable code block. Click **Copy** to copy it to the clipboard, then save it somewhere secure (a password manager, your CI secret store, etc.).

Click **Done** to close the modal.

## Key list

The keys table shows:

| Column        | Description                                                  |
| ------------- | ------------------------------------------------------------ |
| **Name**      | The label you gave the key                                   |
| **Key**       | The first 12 characters of the key followed by `...`         |
| **Status**    | **Active** (moss dot) or **Revoked** (grey dot)              |
| **Last used** | Timestamp of the most recent successful API call, or "Never" |

You can see the prefix at any time, but never the full key again after creation.

## Using a key

Send the key in the `Authorization` header on every API request:

```
Authorization: Api-Key sk_<your-key>
```

See [API predictions](/production/predictions-api) for full request/response examples.

## Revoking a key

Click **Revoke** on any active key. The key is immediately disabled. Any subsequent request using it returns `403 Forbidden`.

Revoked keys remain in the table for your reference (you can still see when they were last used). To remove them entirely, click the trash icon to delete.

<Note>
  Revoking is reversible only by creating a new key. Once revoked, the old key cannot be reactivated.
</Note>

## Deleting a key

Click the trash icon next to a key. The key is permanently removed from the table.

If the key was still active at the time of deletion, it's automatically revoked first. Existing prediction logs that referenced the key keep their record but the key field is left dangling.

## Scoping

Keys can be:

* **Per-deployment**: created from a specific deployment's API Keys tab. Only authorized to call that deployment's `/predict/` endpoints.
* **Project-wide**: created at the project level (when supported). Authorized to call any deployment in the project.

The scoping is set automatically based on where you create the key. Per-deployment keys are the default and the safest option (least privilege).

If you call a deployment with a key that's not authorized for it, you get `403 Forbidden`: "API key is not authorized for this deployment."

## Plan limits

Your plan limits how many API keys you can have per project (`max_api_keys`). The current count and limit are shown at the top of the API Keys tab.

When you reach the limit, the **Create API key** button is disabled. Revoke or delete an unused key first.

## Tips

<Tip>
  **One key per integration.** Create separate keys for each system that uses your model (production LIMS, staging environment, internal scripts). If one needs to be revoked, you don't break the others.
</Tip>

<Tip>
  **Set expirations.** Even for "permanent" integrations, set a 6 or 12 month expiration. It forces rotation and limits damage if a key leaks.
</Tip>

<Tip>
  **Audit last\_used regularly.** If a key hasn't been used in months, revoke it. Unused keys are a liability.
</Tip>

<Tip>
  **Never commit keys to git.** Use environment variables or a secrets manager. If you accidentally commit a key, revoke it immediately and create a new one.
</Tip>
