---
title: "Create a new API key"
method: POST
path: "/api/org-api-keys"
tags: ["API Keys"]
---

# Create a new API key

`POST /api/org-api-keys`

## Request

- Base URL: `https://app.dailyplay.ai`
- URL: `https://app.dailyplay.ai/api/org-api-keys`
- Auth: HTTP bearer

Creates a new API key for an organization. The raw key is only returned once in the response.

## Request body

- CreateApiKeyRequest
  - `org_id` integer, required: Organization ID
  - `name` string, required: Descriptive name for the key
  - `description` string: Optional description
  - `allowed_game_ids` integer[], nullable: Restrict key to specific game IDs. Null = all games.
  - `allowed_stream_ids` integer[], nullable: Restrict key to specific stream IDs. Null = all streams.
  - `rate_limit_per_minute` integer: Max requests per minute
  - `rate_limit_per_day` integer: Max requests per day
  - `expires_at` string, date-time: Optional auto-expiry date

## Response `200`

API key created. The `key` field is only included in this response.

- CreateApiKeyResponse
  - `success` boolean
  - `data` object
    - `id` integer
    - `name` string
    - `key_prefix` string: First 8 characters for identification
    - `key` string: The full API key. Only shown once at creation time.

## Other responses

- `401`: Invalid or revoked API key / missing auth

---

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