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

# Create Api Key

`POST /api/api-keys`

## Request

- Base URL: `https://api.flagpost.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.flagpost.ai/api/api-keys`
- Auth: HTTP bearer

Create an API key. The plaintext token is returned only in this response.

## Request body

- CreateApiKeyRequest
  - `name` string, required
  - `scopes` string[]
  - `business_ids` string[], nullable
  - `expires_at` string, date-time, required

## Response `200`

Successful Response

- CreateApiKeyResponse: Includes the plaintext token — returned once at creation.
  - `id` string, uuid, required
  - `name` string, required
  - `prefix` string, required
  - `scopes` string[], required
  - `business_ids` string[], nullable, required
  - `expires_at` string, date-time, required
  - `last_used_at` string, date-time, nullable, required
  - `revoked_at` string, date-time, nullable, required
  - `created_at` string, date-time, required
  - `advisor_id` string, uuid, required
  - `token` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/flagpost/apis/flagpost-api.md) - [All operations](https://skmtc.dev/flagpost/apis/flagpost-api/llms.txt) - [OpenAPI document](https://skmtc.dev/flagpost/apis/flagpost-api/revisions/0308cef485ca?raw)
