---
title: "Create Agent Api Key"
method: POST
path: "/agent/keys"
tags: ["agent"]
---

# Create Agent Api Key

`POST /agent/keys`

## Request

- Base URL: `https://api.threadchain.pro` (the document declares no server; this is the origin it was published from)
- URL: `https://api.threadchain.pro/agent/keys`
- Auth: OAuth 2
  - Password
  - Token URL: `auth/token`

Mint a new MCP key. The plaintext ``key`` is returned exactly once —
it is never persisted or logged again (see api_keys.py).

## Request body

- CreateApiKeyRequest
  - `name` string, required
  - `scopes` string[], required
  - `daily_cost_cap_usd` number, nullable

## Response `200`

Successful Response

- CreateApiKeyResponse
  - `id` string, required
  - `name` string, required
  - `key_prefix` string, required
  - `scopes` string[], required
  - `daily_cost_cap_usd` number, nullable
  - `last_used_at` string, nullable
  - `revoked_at` string, nullable
  - `created_at` string, nullable
  - `key` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/threadchain/apis/threadchain-backend.md) - [All operations](https://skmtc.dev/threadchain/apis/threadchain-backend/llms.txt) - [OpenAPI document](https://skmtc.dev/threadchain/apis/threadchain-backend/revisions/8ee288a7e6bd?raw)
