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

# Mint an API key

`POST /keys`

## Request

- Base URL: `https://account.close.city`
- URL: `https://account.close.city/keys`
- Auth: API key in cookie `__Host-wtm_session`

Create a new ck_ API key for the signed-in account. The raw key is returned exactly once; store it and pass it as the Authorization bearer on api.close.city. Accounts hold at most 3 active keys.

## Headers

- `X-CSRF-Token` string, required

## Request body

- object
  - `label` string: Optional label.

## Response `201`

The new key, shown once.

- object
  - `key` string
  - `prefix` string
  - `tokens_remaining` integer: The account's current token balance. The signup grant is once per account, so this can be 0 for a returning account.

## Other responses

- `401`: No signed-in session.
- `403`: Missing or invalid X-CSRF-Token.
- `409`: Active-key limit reached; revoke one.

---

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