---
title: "Create an API key"
method: POST
path: "/api/keys"
tags: ["API Keys"]
---

# Create an API key

`POST /api/keys`

## Request

- Base URL: `https://api.wondercal.com`
- URL: `https://api.wondercal.com/api/keys`
- Auth: HTTP bearer

Generates a new API key. The plaintext key is returned once and cannot be retrieved later. Maximum 25 keys per user.

## Request body

- CreateApiKeyRequest
  - `name` string, required: Human-readable name for the API key

## Response `201`

API key created successfully

- object
  - `data` ApiKeyCreated
    - `id` string: API key ID
    - `key` string: Plaintext API key (shown once, cannot be retrieved later)
    - `name` string: Key name
    - `createdAt` string, date-time: ISO 8601 timestamp

## Other responses

- `400`: Validation error (empty name, name too long, key limit reached)
- `401`: Not authenticated
- `413`: Request body exceeds 1 MB limit (PAYLOAD_TOO_LARGE)
- `429`: Rate limit exceeded. The Retry-After header indicates how many seconds to wait before retrying.

---

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