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

# Create Api Key

`POST /v1/api-keys/`

Create a new API key. The raw ``token`` value is returned once — store it securely.

## Request body

- APIKeyCreateRequest
  - `expires_in_days` integer, nullable — Optional expiry in days (omit for non-expiring)
  - `name` string, required — Human-friendly label for this API key

## Response `201`

Successful Response

- APIKeyCreateResponse — Extends APIKeyResponse with the raw token — shown ONCE at creation.
  - `access_count` integer, required
  - `created_at` string, required
  - `expires_at` string, nullable, required
  - `id` string, uuid, required
  - `is_active` boolean, required
  - `last_accessed_at` string, nullable, required
  - `name` string, required
  - `token` string, required — Raw token value — copy it now, it won't be shown again
  - `token_prefix` string, required

## Other responses

- `422` — Validation Error

---

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