---
title: "Create API key"
method: POST
path: "/v1/communities/{communityId}/api-keys"
tags: ["API Keys"]
---

# Create API key

`POST /v1/communities/{communityId}/api-keys`

## Request

- Base URL: `https://api.subo.ai`
- URL: `https://api.subo.ai/v1/communities/{communityId}/api-keys`
- Auth: API key in header `X-API-Key`

Create a new API key. Returns the full key value once — store it immediately. Admin role required.

## Path parameters

- `communityId` string, required

## Request body

- object
  - `name` string, required
  - `description` string
  - `expires_at` string, date-time: ISO 8601 expiry timestamp. Omit for non-expiring key.

## Response `201`

Created key with api_key value (shown once — store immediately)

- object
  - `data` ApiKeyCreated
    - `id` string
    - `community_id` string
    - `name` string
    - `description` string, nullable
    - `key_prefix` string
    - `is_active` boolean
    - `created_at` string, date-time, nullable
    - `last_used_at` string, date-time, nullable
    - `expires_at` string, date-time, nullable

## Other responses

- `400`: Invalid request body
- `401`: Invalid or missing API key
- `403`: Forbidden — the key or user lacks permission for this resource or operation
- `429`: Rate limit exceeded — wait `retry_after` seconds before retrying. The same value appears in the `Retry-After` header.

---

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