# Create API key

Generate a new API key for the organization.

Source: https://statusdashboard.com/docs/api/account-management/api-keys/create

`POST /app/api-keys`

Creates a new API key for the authenticated user and returns the full secret **once**. The secret cannot be retrieved again after this response — store it securely immediately.

The number of API keys per user is limited by your plan quota. Creating a key when the limit is reached returns `409`.

> **Interactive login required.**
>    This endpoint accepts a JWT session from the StatusDashboard web app only — not a platform API key. Use the 
>   [API Keys](/app/api-keys)
>    page in the user menu to generate keys, or call this endpoint with your session token. List and revoke endpoints still accept 
>   `Bearer {keyId}:{secret}`
>    for automation.

***

## Request
See [API Basics](/docs/api) for standard headers. Authenticate with your **JWT session token**, not an existing API key.

### Request body
| Field  | Type   | Required | Description                                                                                                          |
| ------ | ------ | -------- | -------------------------------------------------------------------------------------------------------------------- |
| `name` | string | No       | Human-readable label for the key. Defaults to a date-stamped `"API Key (…)"` label when omitted. Max 100 characters. |

***

## Sample request
```bash
curl -X POST https://api.statusdashboard.com/app/api-keys \
  -H "Authorization: Bearer <jwt-session-token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Zapier integration"}'
```

## Sample response
**Status: `201 Created`**

```json
{
  "key": "bcf847abf5c6:s3cr3tDef456plaintext",
  "keyId": "bcf847abf5c6",
  "name": "Zapier integration",
  "createdAt": "2026-04-15T12:00:00.000Z"
}
```

The `key` field is the full `keyId:secret` string to use in the `Authorization` header. It is returned **only once** and cannot be recovered. Revoke and recreate the key if lost.

***

## Error responses
| Status | When                                                                                                                                    |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| `403`  | The API access feature is not enabled for the organization, or the caller authenticated with a platform API key (minting requires JWT). |
| `409`  | The user has reached their plan's API key quota.                                                                                        |
