---
title: "Create API key"
method: POST
path: "/v1/api_keys"
tags: ["API Keys"]
---

# Create API key

`POST /v1/api_keys`

Creates a new API key for the authenticated organization. The response includes the full `raw_key` — this is the only time it is returned, so store it securely.

## Request body

- CreateApiKeyRequest
  - `name` string, required — Human-readable name for the key.

## Response `200`

Successful response

- CreateApiKeyResponse — Response from creating an API key. The `raw_key` field is only returned on creation and cannot be retrieved again — store it securely.
  - `api_key` ApiKey, required
    - `id` string, required — Unique API key identifier (e.g. `akey_CjXuYOtW`).
    - `name` string, required — Human-readable key name.
    - `key_prefix` string, required — The prefix portion of the key (e.g. `sk-prod`).
    - `key_suffix` string, required — The last few characters of the key, for display.
    - `created_by` string, required — Name or identifier of the user who created the key.
    - `created_at` string, date-time, required — ISO 8601 timestamp.
    - `last_used_at` string, date-time, nullable, required — ISO 8601 timestamp of the last request authenticated with this key, or `null` if never used.
  - `raw_key` string, required — The full API key. Only returned at creation time.

## Other responses

- `400` — The request was invalid.
- `401` — Missing or invalid API key.

---

[API](https://skmtc.net/charcoalhq/apis/charcoal-api.md) · [All operations](https://skmtc.net/charcoalhq/apis/charcoal-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/charcoalhq/charcoal-api/revisions/eee9850f4746/schema)
