---
title: "Create an API Key"
method: POST
path: "/v1/api-keys"
tags: ["API Keys"]
---

# Create an API Key

`POST /v1/api-keys`

Generates a new programmatic API key for accessing authorized resources.
The full, secret API key is returned ONLY once in this response and cannot be recovered later.

## Request body

- CreateAPIKeyRequest
  - `name` string, required — Descriptive name for the key.
  - `org_id` string, uuid, required — Organization that owns the API key.
  - `team_ids` string[] — Optional list of teams the key can access. Omit or pass an empty array for organization-wide access.
  - `operation` 'read_render' | 'all' | 'admin'

## Response `201`

API key created successfully

- APIKeyCreatedResponse
  - `id` string, uuid, required — Unique API Key identifier.
  - `name` string, required — Human-readable name of the key.
  - `key` string, required — The fully generated secure raw API Key string. This is returned ONLY ONCE.
  - `operation` string, required
  - `created_at` string, date-time, required — Timestamp of creation.

## Other responses

- `400` — Invalid request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Referenced team not found
- `500` — Internal Server Error

## Changes

- **2026-07-14** `bed7a47c6f25` — 1 info
  - added the non-success response with the status `404`
- **2026-07-02** `e500bc0895c5` — 1 breaking
  - removed the required property `key_prefix` from the response with the `201` status
- **2026-06-29** `162c1e986d3a` — 1 info
  - added the new `admin` enum value to the request property `operation`
- **2026-06-27** `08e27b8a28f4` — 1 breaking, 1 warning, 4 info
  - added the new required request property `org_id`
  - removed the request property `team_id`
  - added the new optional request property `operation`
  - added the new optional request property `team_ids`
  - …2 more
- **2026-06-25** `f917015ed0b5` — 1 info
  - added the new optional request property `team_id`

[Change history](https://skmtc.dev/px0-ai/apis/px0-api/changes/v1/api-keys/post.md)

---

[API](https://skmtc.dev/px0-ai/apis/px0-api.md) · [All operations](https://skmtc.dev/px0-ai/apis/px0-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/px0-ai/px0-api/revisions/3ed72443989d/schema)
