---
title: "Create an API key"
description: "Mint a key for this workspace. The key itself is returned once; only its hash is stored. `expiresAt` makes it stop working at an instant (a key for a contractor or a one-off script); it stays listed until revoked."
canonical: https://docs.mentio.dev/api/api-keys/create-api-key
markdown: https://docs.mentio.dev/api/api-keys/create-api-key.mdx
---

# Create an API key

`POST /v1/api-keys`

Mint a key for this workspace. The key itself is returned once; only its hash is stored. `expiresAt` makes it stop working at an instant (a key for a contractor or a one-off script); it stays listed until revoked.

## Body

- `name`: A label for the key; "default" when omitted.
- `scope`: read: GET only. write: everything.
- `expiresAt`: When the key stops working (ISO 8601, or epoch ms), for a key handed to a script or a contractor. Must be in the future. Omit or null for a key that never expires.

## Responses

- 201: The new key, shown once
- 400: expiresAt is not in the future
- 401: Missing or invalid API key

Full schemas: https://api.mentio.dev/v1/openapi.json. Conventions: https://docs.mentio.dev/conventions.mdx
