---
title: "Create another API key. The key is in this response only."
method: POST
path: "/v1/keys"
tags: ["keys"]
---

# Create another API key. The key is in this response only.

`POST /v1/keys`

## Request

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

A new key on the same account, for example one per agent or machine, so one can be
revoked without touching the others. Give it only what it needs: scopes (read, write,
research, admin; all four when left out), credit_limit (the most its runs may spend
over its life, 1 to 100000) and expires_in_days (1 to 365). The full key is in this
response and nowhere else, ever. Needs admin. 409 key_limit_reached at 10 active
keys; creation is limited per account per hour (429). MCP: create_key.

## Headers

- `authorization` string, nullable: Bearer hd_... from POST /v1/accounts or POST /v1/keys

## Request body

- KeyIn
  - `name` string, nullable: up to 60 characters, to tell your keys apart; defaults to 'API key'
  - `scopes` string[]: what the key may do: read, write, research, admin. Left out: all four. Give an agent only what it needs, for example ["read", "write", "research"]
  - `credit_limit` integer: the most credits runs started with this key may spend over its life, 1 to 100000; left out: no cap
  - `expires_in_days` integer: the key stops working after this many days, 1 to 365; left out: never

## Response `201`

Successful Response

- KeyCreatedOut
  - `key_id` string, required
  - `name` string, required
  - `prefix` string, required
  - `api_key` string, required: shown this once; store it now
  - `created_at` string, required

## Other responses

- `401`: missing, invalid, revoked or expired API key (code key_expired)
- `403`: the key lacks the scope this call needs (insufficient_scope), or its credit_limit is spent (key_credit_limit_reached)
- `409`: conflict with the account's state
- `413`: request body over the size cap
- `422`: invalid input
- `429`: rate limited; see Retry-After
- `500`: our fault; names the request id

---

[API](https://skmtc.dev/hookdetector/apis/hook-detector.md) · [All operations](https://skmtc.dev/hookdetector/apis/hook-detector/llms.txt) · [OpenAPI document](https://skmtc.dev/hookdetector/apis/hook-detector/revisions/b136a2804d2b?raw)
