---
title: "Create a workspace API key"
method: POST
path: "/api/workspace/api-keys"
tags: ["workspace"]
---

# Create a workspace API key

`POST /api/workspace/api-keys`

[cloud-only] Creates a new API key for the current workspace.

## Request body

- object
  - `name` string, required — Display name for the API key
  - `description` string — User-provided description of the key's purpose

## Response `201`

API key created

- CreateWorkspaceAPIKeyResponse — [cloud-only] Response containing the newly created workspace API key.
  - `id` string, uuid, required — API key ID
  - `name` string, required — User-provided label
  - `description` string, required — User-provided description of the key's purpose. Limit is byte-based (UTF-8 encoding); 5000 bytes equals 5000 ASCII characters or fewer multi-byte characters.
  - `key` string, required — The full plaintext API key (only shown once)
  - `key_prefix` string, required — First 8 chars after prefix for display
  - `expires_at` string, date-time — When the key expires (if set)
  - `created_at` string, date-time, required — When the key was created

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Workspace not found
- `422` — Validation error
- `429` — Key limit reached
- `500` — Internal server error

## Changes

- **2026-05-22** `c4db9e1283df` — 1 warning, 3 info
  - removed the optional property `prefix` from the response with the `201` status
  - added the optional property `expires_at` to the response with the `201` status
  - the response property `created_at` became required for the status `201`
  - added the required property `key_prefix` to the response with the `201` status
- **2026-05-22** `09a5075587c8` — 5 info
  - api operation id `createWorkspaceApiKey` removed and replaced with `createWorkspaceAPIKey`
  - added the non-success response with the status `404`
  - added the non-success response with the status `422`
  - added the non-success response with the status `429`
  - …1 more
- **2026-05-19** `154b54b72941` — 1 warning, 1 info
  - the `description` request property's maxLength was set to `5000`
  - the response property `description` became required for the status `201`
- **2026-05-19** `cc79ecd094b4` — 2 info
  - added the new optional request property `description`
  - added the optional property `description` to the response with the `201` status
- **2026-05-08** `c9640fded659` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/comfy-org/apis/comfyui-api/changes/api/workspace/api-keys/post.md)

---

[API](https://skmtc.dev/comfy-org/apis/comfyui-api.md) · [All operations](https://skmtc.dev/comfy-org/apis/comfyui-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/comfy-org/comfyui-api/revisions/c4db9e1283df/schema)
