---
title: "Create an API key"
method: POST
path: "/v1/keys"
tags: ["API Keys"]
---

# Create an API key

`POST /v1/keys`

Creates a new API key associated with one or more workspaces.
The response includes the key token which is only shown once upon creation.

## Request body

- CreateKeyRequest
  - `name` string, required — Unique name for the API key
  - `workspaces` string[], required — Array of workspace names to associate with this key

## Response `201`

API key created

- CreateKeyResponse
  - `name` string
  - `enabled` boolean
  - `workspaces` object[]
    - `_id` string
    - `name` string
  - `key` string — The JWT token for this API key (only shown once)
  - `createdBy` object
    - `fullname` string
  - `_id` string

## Other responses

- `400` — Bad request - at least one workspace must be selected
- `401` — Missing authentication
- `409` — Conflict - key name already exists

---

[API](https://skmtc.dev/liara-cloud/apis/ai-api-keys.md) · [All operations](https://skmtc.dev/liara-cloud/apis/ai-api-keys/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/liara-cloud/ai-api-keys/revisions/bba2d0674527/schema)
