---
title: "Create API key"
method: POST
path: "/api/v1/add/api-key"
tags: ["API Keys"]
---

# Create API key

`POST /api/v1/add/api-key`

## Request

- Base URL: `/` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/add/api-key`
- Auth: API key in header `X-API-Key`

Create an API key with a random value (admin only, not with a read-only API key). Get the key value with the GET method. Without `skip_ip_check` at least one IP/network in `allow_from` is required.

## Request body

- object
  - `description` string: free text, max. 255 characters
  - `access` 'ro' | 'rw': ro (read-only, GET endpoints only) or rw (read-write), required
  - `allow_from` string: IPs/CIDR networks the key may be used from, separated by commas, spaces or newlines (or an array)
  - `skip_ip_check` boolean: allow the key from any IP
  - `active` boolean: is key active or not

## Response `200`

OK

- object
  - `log` unknown[]: contains request object
    - unknown
  - `msg` unknown[]
    - unknown
  - `type` 'success' | 'danger' | 'error'

## Other responses

- `401`: Unauthorized

## Changes

- **2026-10-23** `679bcc1881c6`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/mailcow/apis/mailcow-api/changes/api/v1/add/api-key/post.md)

---

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