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

# Create Api Key

`POST /v1/api-keys`

## Request

- Base URL: `http://localhost:8000`
- URL: `http://localhost:8000/v1/api-keys`
- Auth: OAuth 2 (password, token URL `/v1/auth/login`)

## Request body

- ApiKeyCreate
  - `label` string, nullable

## Response `201`

Successful Response

- ApiKeyCreated: Returned once after creation — includes the full plaintext key.
  - `id` integer, required
  - `key_prefix` string, required
  - `label` string, nullable
  - `created_at` string, date-time, required
  - `last_used_at` string, date-time, nullable
  - `key` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/rubenayla/apis/partle-api.md) · [All operations](https://skmtc.dev/rubenayla/apis/partle-api/llms.txt) · [OpenAPI document](https://skmtc.dev/rubenayla/apis/partle-api/revisions/628cce2acee5?raw)
