---
title: "Create Api Key"
method: POST
path: "/v1/api-keys"
tags: ["api-keys"]
---

# Create Api Key

`POST /v1/api-keys`

Create a new API key.

## Headers

- `authorization` string, nullable

## Request body

- APIKeyCreate — Request model for creating an API key.
  - `customer_id` string, required — Customer ID the key is scoped to
  - `name` string, required — Friendly name for the API key
  - `description` string, nullable — Optional description
  - `scope` 'read_only' — API key access scope - ALL KEYS ARE READ-ONLY
  - `expires_days` integer, nullable — Number of days until expiration (None = no expiration)

## Response `201`

Successful Response

- APIKeyResponse — Response model for API key.
  - `id` string, required
  - `customer_id` string, required
  - `name` string, required
  - `description` string, nullable, required
  - `scope` string, required
  - `status` string, required
  - `created_at` string, date-time, required
  - `expires_at` string, date-time, nullable, required
  - `last_used_at` string, date-time, nullable, required
  - `api_key` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/knownwell/apis/knownwell-api.md) · [All operations](https://skmtc.net/knownwell/apis/knownwell-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/knownwell/knownwell-api/versions/3cf7fd5ae733/schema)
