---
title: "management.keys.create"
method: POST
path: "/management/keys"
---

# management.keys.create

`POST /management/keys`

## Request

- Base URL: `https://www.ninjachat.ai/api/v1`
- URL: `https://www.ninjachat.ai/api/v1/management/keys`
- Auth: HTTP bearer

Requires keys:write. Changing routing also requires routing:write. Budgets are integer USD cents. Responses are not cacheable. Keys/secrets are shown only at creation/rotation. Mutations do not support automatic retries: read current resource state after an ambiguous failure. Standard limits: 120 reads/minute and 30 writes/minute per account.

## Request body

- object
  - `name` string, required
  - `projectId` string, nullable
  - `readOnly` boolean
  - `expiresInDays` integer, nullable
  - `monthlyBudgetCents` integer, nullable

## Response `201`

Management operation result. Lists use a data array; key/project/audit lists include next_cursor (null at end). Key create/rotate returns key once plus data metadata. X-Audit-Status: pending means the operation succeeded but its completion audit append needs investigation using X-Request-ID.

- object

## Other responses

- `400`: Invalid or unsupported request parameter.
- `401`: Missing or invalid API key.
- `402`: Insufficient balance or project spend limit reached.
- `403`: Management scope is missing, or the account is unavailable.
- `404`: Resource does not exist in this account.
- `409`: Resource quota exceeded.
- `429`: Rate limit exceeded.
- `500`: Gateway error.

---

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