---
title: "Create an API key"
method: POST
path: "/v1/admin/api-keys"
tags: ["Admin"]
---

# Create an API key

`POST /v1/admin/api-keys`

## Request

- Base URL: `http://api.technooptimist.io`
- URL: `http://api.technooptimist.io/v1/admin/api-keys`
- Auth: HTTP bearer

Requires the ADMIN_TOKEN (or a key with the `admin` scope). The raw key is returned ONCE; only its hash is stored.

## Request body

- CreateApiKeyInput
  - `name` string, required
  - `tier` 'free' | 'pro' | 'enterprise' | 'internal'
  - `scopes` string[]

## Response `201`

Created

- CreateApiKeyResult
  - `key` string, required: The raw key. Shown ONCE; only its hash is stored.
  - `prefix` string, required
  - `name` string, required
  - `tier` 'free' | 'pro' | 'enterprise' | 'internal', required
  - `scopes` string[], required

## Other responses

- `401`: Missing or invalid credentials
- `403`: Credential lacks the required scope
- `422`: Validation failed

---

[API](https://skmtc.dev/technooptimist/apis/the-techno-optimist-api.md) · [All operations](https://skmtc.dev/technooptimist/apis/the-techno-optimist-api/llms.txt) · [OpenAPI document](https://skmtc.dev/technooptimist/apis/the-techno-optimist-api/revisions/b7bcde6a0f30?raw)
