---
title: "Create Api Key"
method: POST
path: "/admin/api-keys/"
tags: ["admin", "api-keys"]
---

# Create Api Key

`POST /admin/api-keys/`

## Request

- Base URL: `https://api.trytrata.com`
- URL: `https://api.trytrata.com/admin/api-keys/`
- Auth: HTTP bearer

## Request body

- CreateUserApiKeyRequest
  - `user_id` string, required
  - `scope` 'ADMIN' | 'USER', required
  - `name` string, nullable

## Response `200`

Successful Response

- CreateUserApiKeyResponse
  - `key_id` string, required
  - `user_id` string, required
  - `scope` 'ADMIN' | 'USER', required
  - `key_prefix` string, required
  - `name` string, nullable, required
  - `is_active` boolean, required
  - `created_at` string, date-time, required
  - `plaintext_key` string, required

## Other responses

- `404`: Not found
- `422`: Validation Error

## Changes

- **2026-09-19** `25feb5dd4c71`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/trytrata/apis/trytrata-api/changes/admin/api-keys/post.md)

---

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