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

# Create API key

`POST /api/api-keys`

## Request

- Base URL: `http://dobby-ai.com`
- URL: `http://dobby-ai.com/api/api-keys`
- Auth: HTTP bearer

Create a new API key (session auth required). The full key is only returned once!

## Request body

- object
  - `name` string, required: Friendly name for the API key
  - `scopes` string[], required: Permission scopes
  - `expires_at` string, date-time: Optional expiration date
  - `rate_limit` integer: Custom rate limit (requests/minute)

## Response `200`

API key created

- object
  - `success` boolean
  - `key` ApiKey
    - `key_id` string
    - `name` string
    - `key_prefix` string
    - `scopes` string[]
    - `is_active` boolean
    - `rate_limit` integer
    - `last_used_at` string, date-time, nullable
    - `expires_at` string, date-time, nullable
    - `created_at` string, date-time
  - `secret` string: Full API key secret - only shown once!

## Other responses

- `400`: Bad Request - Invalid parameters
- `401`: Unauthorized - Missing or invalid authentication

---

[API](https://skmtc.dev/dobby-ai/apis/dobby-platform-api.md) · [All operations](https://skmtc.dev/dobby-ai/apis/dobby-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dobby-ai/apis/dobby-platform-api/revisions/398634f0306f?raw)
