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

# Create an API key

`POST /v1/account/keys`

Create a new API key for the authenticated account and return the plaintext key once.

## Request body

- ApiKeyCreate — Request model for creating an API key
  - `name` string, required — Name for the API key
  - `credit_limit` number, nullable — Optional credit limit for the API key
  - `expires_at` string, date-time, nullable — Optional expiration datetime for the API key. Must be in the future.

## Response `201`

API key created successfully.

- ApiKeyCreateResponse — Response model for created API key (includes the actual key)
  - `id` integer, required
  - `name` string, required
  - `key` string, required
  - `created_at` string, date-time, required
  - `expires_at` string, date-time, nullable, required
  - `is_enabled` boolean, required
  - `credit_limit` number, nullable, required
  - `message` string

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `402` — Insufficient credits
- `403` — Forbidden
- `410` — Model deprecated
- `422` — Validation error
- `429` — Rate limited
- `500` — Internal server error
- `503` — Upstream service error

---

[API](https://skmtc.net/naga/apis/nagaai-api.md) · [All operations](https://skmtc.net/naga/apis/nagaai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/naga/nagaai-api/revisions/8bfb4677a79e/schema)
