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

# Create Api Key

`POST /api/api-keys`

## Request

- Base URL: `https://www.gateco.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://www.gateco.ai/api/api-keys`
- Auth: OAuth 2 (password, token URL `/api/auth/login`)

Create a new API key.

The full plaintext key is returned **once** in the ``key`` field of the
response. It is not stored and cannot be retrieved again.

Requires JWT authentication. API keys may not create other API keys.

## Request body

- CreateApiKeyRequest: Request body for POST /api/api-keys.
  - `name` string, required: Human-readable label
  - `expires_at` string, date-time, nullable: Optional expiry timestamp (timezone-aware). Omit for no expiry.

## Response `201`

Successful Response

- CreateApiKeyResponse: Response for POST /api/api-keys — includes the plaintext key exactly once.
  - `id` string, required
  - `name` string, required
  - `prefix` string, required
  - `last_used_at` string, nullable, required
  - `expires_at` string, nullable, required
  - `created_at` string, required
  - `key` string, required: Full API key — display once and discard

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/gateco/apis/gateco-api.md) · [All operations](https://skmtc.dev/gateco/apis/gateco-api/llms.txt) · [OpenAPI document](https://skmtc.dev/gateco/apis/gateco-api/revisions/5debaf204950?raw)
