---
title: "Create a new API key"
method: POST
path: "/api-keys"
tags: ["API Keys"]
---

# Create a new API key

`POST /api-keys`

## Request

- Base URL: `https://api.llm-broker.net`
- URL: `https://api.llm-broker.net/api-keys`
- Auth: HTTP bearer

## Request body

- CreateApiKeyRequest
  - `name` string: Key name (default: 'API Key')
  - `scopes` string[], nullable: Optional scope restrictions

## Response `200`

Created key (includes plainKey)

- ApiKeyItem
  - `enabled` boolean
  - `expiresAt` string, date-time, nullable
  - `id` string
  - `insertedAt` string, date-time
  - `lastUsedAt` string, date-time, nullable
  - `name` string

## Other responses

- `400`: Bad request

---

[API](https://skmtc.dev/llm-broker/apis/astrioncore-core-api.md) · [All operations](https://skmtc.dev/llm-broker/apis/astrioncore-core-api/llms.txt) · [OpenAPI document](https://skmtc.dev/llm-broker/apis/astrioncore-core-api/revisions/f85835487bf5?raw)
