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

# Create Api Key

`POST /api/v1/api-keys`

Create a new API key for the current business.

The request body is optional; omitting it creates a key with the default
scope (`admin`) and expiry (365 days). The plaintext key is returned
**once** in this response and never again; only its HMAC-SHA256 hash and a
masked prefix are persisted.

**Security:** Store this key securely - it won't be shown again!

## Request body

- CreateApiKeyRequest — Request model for creating a new API key.
  - `name` string, nullable
  - `scopes` ApiKeyScope[]
  - `expires_in_days` integer

## Response `200`

Successful Response

- CreateApiKeyResponse — Response model for creating a new API key. `api_key` is the plaintext value, returned exactly once at creation.
  - `api_key` string, required
  - `key` ApiKeyMetadata, required — Non-sensitive metadata for an API key. Never includes the key value.
    - `id` string, required
    - `prefix` string, required
    - `name` string, nullable
    - `scopes` ApiKeyScope[]
    - `created_at` string, date-time, nullable
    - `expires_at` string, date-time, nullable
    - `last_used_at` string, date-time, nullable
    - `legacy` boolean
    - `created_by_email` string, nullable
  - `message` string

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/neosapien/apis/neocore.md) · [All operations](https://skmtc.dev/neosapien/apis/neocore/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/neosapien/neocore/revisions/8b94ef58f2cf/schema)
