---
title: "Create a scoped API key (session credential only)"
method: POST
path: "/v1/api-keys"
tags: ["api-keys"]
---

# Create a scoped API key (session credential only)

`POST /v1/api-keys`

## Request

- Base URL: `https://api.cueframe.ai`
- URL: `https://api.cueframe.ai/v1/api-keys`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.cueframe.ai/api/auth/mcp/authorize`, token URL `https://api.cueframe.ai/api/auth/mcp/token`)
  - API key in header `PAYMENT-SIGNATURE`

## Request body

- ApiKeyCreateRequest
  - `name` string, required
  - `permissions` object, required: Resource → actions grant. Resources: media, sessions, projects, renders, webhooks, billing. Actions: read, write. Least-privilege — grant only what's needed (billing:write is required to start a checkout).
  - `expiresIn` integer: Lifetime in seconds; omit for no expiry.

## Response `201`

Key created — the secret is returned ONCE.

- ApiKeyResponse
  - `key` string, required: The full secret key (cf_test_… / cf_live_…). Shown ONCE — store it now.
  - `id` string, required
  - `prefix` string, required
  - `start` string, required: First chars of the key, for later identification.

## Other responses

- `400`: Bad request — validation_error / invalid_cursor / invalid_query.
- `401`: Missing or invalid Authorization header.
- `402`: Payment required. Returned when the caller presents no API key on a priced operation: the body AND the `Payment-Required` header carry the x402 v2 challenge (accepted scheme, network, USDC asset, amount, payTo). Sign the EIP-3009 authorization and retry with a `PAYMENT-SIGNATURE` header. A KEYED caller sees this status instead when their plan lacks or has exhausted the feature (`billing_required`).
- `403`: Forbidden — permission insufficient.
- `422`: Unprocessable — invalid_composition / media_in_use / session_in_use / render_not_cancellable.
- `500`: Internal error.

---

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