---
title: "Create Api Key"
method: POST
path: "/api/api-keys"
---

# Create Api Key

`POST /api/api-keys`

## Request

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

Create a new Deeptrace API key for the authenticated user.

API keys are used to trigger and retrieve investigations via the REST API
(POST /api/v1/investigate, GET /api/v1/investigations/{id}).

The API key is returned only once upon creation and cannot be retrieved later.

## Request body

- CreateMCPApiKeyRequest: Request body for creating an MCP API key.
  - `name` string, required: A descriptive name for this API key (e.g., 'My Cursor', 'Claude Desktop')
  - `expires_in_days` integer, nullable: Number of days until the key expires. Null for no expiration.

## Response `200`

Successful Response

- MCPApiKeyResponse: Response containing the newly created API key (shown only once).
  - `id` string, required
  - `name` string, required
  - `api_key` string, required
  - `key_prefix` string, required
  - `expires_at` string, nullable, required
  - `created_at` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/deeptrace/apis/deeptrace-api.md) - [All operations](https://skmtc.dev/deeptrace/apis/deeptrace-api/llms.txt) - [OpenAPI document](https://skmtc.dev/deeptrace/apis/deeptrace-api/revisions/855e59bb07f0?raw)
