---
title: "Create inbox API key"
method: POST
path: "/v1/inboxes/{id}/api-keys"
tags: ["inboxes"]
---

# Create inbox API key

`POST /v1/inboxes/{id}/api-keys`

## Request

- Base URL: `https://api.openmail.sh`
- URL: `https://api.openmail.sh/v1/inboxes/{id}/api-keys`
- Auth: HTTP bearer

Mint an API key scoped to this inbox. The key can only read and send from this one inbox — its threads, messages, and drafts — and can never reach another inbox, manage pods, or mint keys. The full `token` is returned once, here — store it securely, it cannot be retrieved again. An account-wide key, or a pod-scoped key for this inbox's pod, may mint; an inbox-scoped key cannot.

## Path parameters

- `id` string, required

## Request body

- object
  - `name` string, nullable: Human-readable label to identify the key later.

## Response `201`

API key created

- ApiKeyWithToken
  - `id` string: OpenMail API key ID
  - `name` string, nullable: Human-readable label for the key, if set.
  - `podId` string, nullable: ID of the pod this key is scoped to, or null for an account-wide key. A pod-scoped key can only access resources in this pod.
  - `inboxId` string, nullable: ID of the inbox this key is confined to, or null. When set, the key can only access this single inbox and its threads, messages, and drafts (its `podId` is the inbox's pod).
  - `tokenPrefix` string: Non-secret leading characters of the token, to help you identify it.
  - `last4` string: Last 4 characters of the token, shown alongside the prefix.
  - `createdAt` string, date-time
  - `lastUsedAt` string, date-time, nullable: When the key last authenticated a request, or null if never used.

## Other responses

- `403`: The authenticating key is inbox-scoped, or a pod-scoped key for a different pod, and cannot mint keys
- `404`: Inbox not found
- `409`: The inbox is not assigned to a pod, so an inbox-scoped key cannot be minted for it (`inbox_has_no_pod`)
- `422`: The inbox already has the maximum number of active keys (`api_key_limit_reached`)

---

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