---
title: "Create Api Key"
method: POST
path: "/api/developer/keys"
tags: ["developer"]
---

# Create Api Key

`POST /api/developer/keys`

## Request

- Base URL: `https://api.dialogbrain.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.dialogbrain.com/api/developer/keys`
- Auth: none declared

Create a new API key. Returns the full key once — store it safely.

`workspace_id` in the body is a choice among the caller's OWN workspaces,
never an arbitrary id. The MCP middleware trusts `api_keys.workspace_id`
verbatim on every request (it re-reads no membership), so a key minted
against a foreign workspace would be a standing pass into it. Omitted, the
key takes the caller's active workspace, which `get_workspace_id` has
already verified.

## Request body

- CreateKeyRequest
  - `name` string, required
  - `workspace_id` integer, nullable
  - `expires_at` string, date-time, nullable
  - `workspace_locked` boolean

## Response `200`

Successful Response

- CreateKeyResponse
  - `id` integer, required
  - `name` string, required
  - `key` string, required
  - `key_prefix` string, required
  - `workspace_id` integer, required
  - `workspace_locked` boolean

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/dialogbrain/apis/dialogbrain-v2-api-gateway.md) · [All operations](https://skmtc.dev/dialogbrain/apis/dialogbrain-v2-api-gateway/llms.txt) · [OpenAPI document](https://skmtc.dev/dialogbrain/apis/dialogbrain-v2-api-gateway/revisions/77bef09a9209?raw)
