---
title: "Create API Key"
method: POST
path: "/api_keys"
tags: ["API Key"]
---

# Create API Key

`POST /api_keys`

Creates a new API key. This endpoint allows you to generate an API key that can be used to authenticate requests to the Attention service.

## Request body

- CreateAPIKeyRequest
  - `name` string, required — The name of the API key
  - `orgLevel` boolean, required — Whether the API key is organization-level or user-level

## Response `200`

Successfully created API key

- APIKey
  - `id` string, required — The unique identifier of the API key
  - `name` string, required — The name of the API key
  - `organizationUUID` string, required — The UUID of the organization this API key belongs to, if applicable
  - `userUUID` string, required — The UUID of the user this API key belongs to, if applicable
  - `value` string, required — The actual API key value
  - `lastSeenAt` string, date-time, required — The last time this API key was used

## Other responses

- `401` — Unauthorized
- `default` — Unexpected error

---

[API](https://skmtc.net/attention/apis/attention-service-v2.md) · [All operations](https://skmtc.net/attention/apis/attention-service-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/attention/attention-service-v2/revisions/5de55d3804cf/schema)
