---
title: "POST /v1/api-keys"
method: POST
path: "/v1/api-keys"
---

# POST /v1/api-keys

`POST /v1/api-keys`

Create a new normal API key for the account that owns the supplied **management** API key. The Authorization header must contain a management key (Bearer). Management keys cannot be used to call any other endpoint.

## Request body

- object
  - `name` string, required — Human-readable name for the new API key
  - `spend_limit` number, nullable — Optional spend cap in USD. Requests are blocked once the key has spent this amount within the current window (see `spend_limit_period`). Omit or set to null for no limit. The owner can change it later from the API keys dashboard.
  - `spend_limit_period` 'day' | 'week' | 'month', nullable — Optional reset window for `spend_limit`. `day`/`week`/`month` reset at 00:00 UTC on the corresponding boundary (today / Monday / 1st of the month). Omit or set to null for a lifetime/cumulative cap. Requires `spend_limit` to be set.
  - `expires_at` string, nullable — Optional ISO 8601 timestamp at which the key automatically stops working. Must be in the future. Omit or set to null to never expire.

## Response `201`

Created

- object
  - `id` string, required
  - `name` string, required
  - `key` string, required — The generated API key. Shown only once.
  - `created_at` string, required
  - `is_active` boolean, required
  - `is_management` boolean, required
  - `spend_limit` number, nullable, required — Spend cap in USD, or null when no limit is set.
  - `spend_limit_period` 'day' | 'week' | 'month', nullable, required — Reset window for the spend limit, or null for lifetime cap.
  - `expires_at` string, nullable, required — Expiration timestamp, or null when the key never expires.

## Other responses

- `400` — Invalid request body
- `401` — Unauthorized — management key required

---

[API](https://skmtc.dev/imagerouter/apis/image-router-api.md) · [All operations](https://skmtc.dev/imagerouter/apis/image-router-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/imagerouter/image-router-api/revisions/716322e546d5/schema)
