---
title: "Create an API key"
method: POST
path: "/api/keys"
---

# Create an API key

`POST /api/keys`

## Request

- Base URL: `https://api.peelaway.io`
- URL: `https://api.peelaway.io/api/keys`
- Auth: one of:
  - API key in cookie `better-auth.session_token`
  - HTTP bearer

Mints a new pk_ key and returns it ONCE (never shown again — store it). Send the session cookie from sign-in. Requires verified email ownership or provider-confirmed billing (else 403 code:email_unverified). Use the returned key as `Authorization: Bearer pk_...` on every /api/process and /mcp call.

## Request body

- CreateApiKeyRequest
  - `name` string, required: A human label for the key (e.g. 'agent-prod').

## Response `201`

Key created (secret returned once)

- CreateApiKeyResponse
  - `key` string, required: The full secret key (pk_...). Returned ONCE — store it now. Send as `Authorization: Bearer <key>`.
  - `id` string, required
  - `prefix` string, required: Display prefix (first 15 chars + '...').
  - `name` string, required

## Other responses

- `400`: Name is required
- `401`: Authentication required
- `403`: Account lacks email or billing verification (code: email_unverified)

---

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