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

# API keys

## 1. Concepts

### What an API key is

An API key authenticates a request to the Zenskar API without a user login session. It is sent in the request's `x-api-key` header.

### Key prefix identifies the environment

A generated key is prefixed with `sandbox_` or `production_`, matching the type of the organization it belongs to, so the environment a key belongs to is visible from the key itself.

### Shown once, never recoverable

Zenskar stores only a hash of the key, not the key itself. The full key is shown exactly once, immediately after creation. If it is lost, generate a new key; there is no way to retrieve an existing key's value again.

### Creating and deleting a key requires permission

Viewing, creating, and deleting API keys each require a separate permission. A user without the relevant permission does not see the corresponding action.

***

## 2. How-to guides

### Create an API key

1. Click the account menu at the bottom of the sidebar, and select **Settings**.
2. Open the **API Keys** tab.
3. Click **Create API Key**.
4. Enter a descriptive name, and click **Generate API Key**.
5. Copy the key immediately. It is shown only once and cannot be viewed or copied again after this step.

### Delete an API key

1. Open **Settings > API Keys**.
2. Open the actions menu on the row for the key to remove, and select **Delete**.
3. Confirm the deletion.

### Authenticate a request with an API key

Add the key to the request's `x-api-key` header.

### Troubleshooting

* **The API key value was lost after creation**: a key cannot be retrieved once its creation screen is closed. Delete the old key if it is no longer usable, and create a new one.
* **Create API Key or Delete is not available**: the signed-in user does not have permission to create or delete API keys.

***

## 3. Reference

### Location

**Settings > API Keys**.

### Fields

| Field | Required | Notes                                   |
| ----- | -------- | --------------------------------------- |
| Name  | Yes      | The only field required to create a key |

### List columns

| Column | Description                         |
| ------ | ----------------------------------- |
| Name   | Name given at creation              |
| Key    | The key's last 4 characters, masked |

### Authentication

| Detail     | Value                                                                     |
| ---------- | ------------------------------------------------------------------------- |
| Header     | `x-api-key`                                                               |
| Key format | Prefixed with `sandbox_` or `production_`, matching the organization type |

### What is not currently supported

| Capability                            | Status                                                            |
| ------------------------------------- | ----------------------------------------------------------------- |
| Setting an expiry date on a key       | Not available                                                     |
| Scoping a key to specific permissions | Not available; a key inherits the permissions of the organization |
| Viewing a key's value after creation  | Not available; only a masked last-4 value is shown afterward      |
