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

# Create Api Key

`POST /api/api-keys`

## Request

- Base URL: `https://api-v1.unusual.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api-v1.unusual.ai/api/api-keys`
- Auth: OAuth 2
  - Password
  - Token URL: `/auth/login`

Create API key. Superusers may pass org_id to create for another org.

Set bind_to_user=false to create an org-scoped external API key (no user
linked, cannot be used as a bearer token for session auth).

## Headers

- `x-view-as` string, nullable

## Request body

- ApiKeyCreate
  - `name` string, nullable
  - `org_id` string, nullable
  - `bind_to_user` boolean

## Response `200`

Successful Response

- ApiKeyCreatedOut
  - `id` string, uuid, required
  - `name` string, nullable
  - `key_prefix` string, required
  - `created_at` string, date-time, required
  - `last_used_at` string, date-time, nullable
  - `revoked_at` string, date-time, nullable
  - `user_email` string, nullable
  - `is_superuser` boolean
  - `expires_at` string, date-time, nullable
  - `api_key` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/unusual/apis/dashboard-server.md) - [All operations](https://skmtc.dev/unusual/apis/dashboard-server/llms.txt) - [OpenAPI document](https://skmtc.dev/unusual/apis/dashboard-server/revisions/89f716930ead?raw)
