---
title: "Generate API key"
method: POST
path: "/v1/api-keys"
tags: ["API Keys"]
---

# Generate API key

`POST /v1/api-keys`

Generates a new API key for the organization. The token is only returned once — store it securely.

## Request body

- CreateApiKeyBody
  - `name` string, required — Human-readable name for the API key. Used to distinguish keys in the UI.

## Response `201`

API key generated

- ApiKey
  - `id` string, required — Stable API-key identifier.
  - `organizationId` string, required — Organization that owns this API key.
  - `name` string, required — Human-readable name.
  - `token` string, required — The full API key token. Returned by create / get / update — store it securely; treat it as a password.
  - `lastUsedAt` string, nullable, required — ISO-8601 timestamp of the most recent successful authentication. `null` until first use.
  - `deletedAt` string, nullable, required — ISO-8601 timestamp at which the key was revoked. `null` while the key is active.
  - `createdAt` string, required — ISO-8601 timestamp of creation.
  - `updatedAt` string, required — ISO-8601 timestamp of the last metadata update (rename, revoke, last-used touch).

## Other responses

- `400` — Validation error
- `401` — Unauthorized
- `404` — Not found

---

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