---
title: "Creates a metered API key."
method: POST
path: "/admin/keys"
tags: ["admin"]
---

# Creates a metered API key.

`POST /admin/keys`

## Request

- Base URL: `https://api.mapmap.ai`
- URL: `https://api.mapmap.ai/admin/keys`
- Auth: HTTP bearer

## Request body

- CreateKeyRequest: Body for `POST /admin/keys`.
  - `allowed_origins` string[], nullable: Origins this key may be called from, e.g. `["https://app.example.com", "https://*.staging.example.com"]`. At most 20; each is `scheme://host[:port]` with no path, and a wildcard may only stand for a single subdomain label. Omit for an unrestricted key, the default.
  - `monthly_quota` integer, required: Requests allowed per calendar month (>= 1).
  - `name` string, required: Human-readable key name (1–120 characters).
  - `rate_per_min` integer, required: Requests allowed per minute (>= 1).
  - `scope` string, nullable: `"full"` (the default) or `"maps"`, a key restricted to tiles, style/font/sprite reads, geocoding and its own status endpoints.

## Response `201`

Key created; the `key` field is shown once only

- CreatedKeyResponse: Response for `POST /admin/keys`, the only time the key is revealed.
  - `allowed_origins` string[], nullable: The canonical origin allow-list stored for this key, echoed back. Absent on unrestricted keys.
  - `created_at` string, required: RFC 3339 creation timestamp.
  - `id` string, required: Key id, used for revocation and usage queries.
  - `key` string, required: The full API key (`snk_…`). **Store it now; it is never shown again**, only its BLAKE3 hash is persisted.
  - `monthly_quota` integer, required: Requests allowed per calendar month.
  - `name` string, required: Key name.
  - `rate_per_min` integer, required: Requests allowed per minute.
  - `scope` string, nullable: `"maps"` when the key was minted map-scoped; absent for the full surface.

## Other responses

- `400`: Invalid name, quota, rate, `allowed_origins` or `scope` (the last two carry `problems[]`)
- `401`: Missing or wrong admin token

---

[API](https://skmtc.dev/mapmap/apis/sn-gateway.md) · [All operations](https://skmtc.dev/mapmap/apis/sn-gateway/llms.txt) · [OpenAPI document](https://skmtc.dev/mapmap/apis/sn-gateway/revisions/2293be8b4c38?raw)
