---
title: "Create API Key"
method: POST
path: "/keys"
tags: ["System"]
---

# Create API Key

`POST /keys`

Create a new API key. Requires an internal or enterprise API key. Returns the generated key string — save it, it cannot be retrieved later.

## Request body

- CreateKey
  - `name` string, required
  - `mode` 'live' | 'test'
  - `origin_restriction` object
    - `type` 'server-only' | 'public' | 'allowlist'
    - `allowed_origins` string[]

## Response `200`

Successful calculation

- object
  - `ok` boolean
  - `data` object
    - `apiKey` string, nullable
    - `name` string, nullable
    - `plan` string, nullable
    - `rateLimit` number, nullable

## Other responses

- `400` — Validation error
- `401` — Missing or invalid API key

---

[API](https://skmtc.dev/astroway/apis/astroway-calculation-api.md) · [All operations](https://skmtc.dev/astroway/apis/astroway-calculation-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/astroway/astroway-calculation-api/revisions/793e5c2dbcdf/schema)
