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

# Create Api Key

`POST /api/api-keys`

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.net/deeptrace/apis/fastapi.md) · [All operations](https://skmtc.net/deeptrace/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/deeptrace/fastapi/versions/2e2a6de8aeda/schema)
