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

# Create a personal API key

`POST /api-keys`

## Request

- Base URL: `https://api.mnemom.ai/v1`
- URL: `https://api.mnemom.ai/v1/api-keys`
- Auth: HTTP bearer

Mints a new personal API key. The full secret is returned in the `key` field — capture it now, it is not retrievable again. Scopes use the capability-based vocabulary (ADR-049); the default scope set is `["gateway", "api:read", "api:write"]`. Admin scopes (`admin:org`, `admin:platform`) are opt-in and rejected at mint time if the requester does not hold the corresponding role.

## Request body

- object
  - `name` string: Friendly name for the key (e.g., "ci-prod", "local-dev"). Capped at 100 characters; longer names are truncated server-side.
  - `scopes` ApiKeyScope[]: Capability set for this key. If omitted, the API substitutes the default. Admin scopes (`admin:org`, `admin:platform`) are gated by the requester's current role and return HTTP 403 at mint time if the requester is not eligible.

## Response `201`

API key created (secret shown once)

- object
  - `key_id` string, required
  - `key` string, required: Full secret. Capture now — never returned again.
  - `key_prefix` string, required
  - `name` string, required
  - `scopes` ApiKeyScope[], required
  - `created_at` string, date-time, required

## Other responses

- `400`: Bad request
- `401`: Authentication required
- `403`: Forbidden
- `404`: Resource not found
- `429`: Rate-limit exceeded. The global per-IP limiter (100 requests/minute, applied to every `/v1/*` route) rejected this request. Back off until the window resets — `Retry-After` carries the cooldown in seconds and `X-RateLimit-Reset` the absolute reset time.
- `500`: Server error — request was well-formed but the server failed to fulfill it. Typically a downstream dependency (DB / RPC / external API) returned an unexpected error.

---

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