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

# Create an API key

`POST /api/key/`

Create an API key for the current user; the secret is returned only once.

## Query parameters

- `cookie_name` string, nullable

## Request body

- ApiKeyCreateRequest — Payload for creating an API key. All fields are optional.
  - `name` string, nullable — Human-readable label to identify the key later.
  - `description` string, nullable — Optional longer note describing what the key is used for.

## Response `201`

Successful Response

- ApiKeyCreateResponse — Returned once when an API key is created.
  - `key` string, required — The full secret token, in the form `ak.<key_id>.<secret>`. **Shown only once at creation** — store it securely; it cannot be retrieved again.
  - `key_id` string, required — Public identifier of the key. Safe to log and reference.
  - `expires_at` string, date-time, nullable — UTC timestamp when the key expires, or null if it never expires.

## Other responses

- `401` — Missing or invalid authentication.
- `422` — Validation Error

---

[API](https://skmtc.net/neulandai/apis/neuland-ai-hub-api.md) · [All operations](https://skmtc.net/neulandai/apis/neuland-ai-hub-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/neulandai/neuland-ai-hub-api/revisions/b53e89b98c2b/schema)
