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

# Create Api Key

`POST /api_keys/`

Create a new API key.

## Headers

- `X-Chutes-Hotkey` string, nullable
- `X-Chutes-Signature` string, nullable
- `X-Chutes-Nonce` string, nullable
- `Authorization` string, nullable

## Request body

- APIKeyArgs
  - `admin` boolean, required
  - `name` string, required
  - `scopes` ScopeArgs[], nullable
    - `object_type` string, required
    - `object_id` string, nullable
    - `action` 'read' | 'write' | 'delete' | 'invoke'

## Response `200`

Successful Response

- APIKeyCreationResponse — Representation of an API key when it's initially created.
  - `api_key_id` string, required
  - `user_id` string, required
  - `admin` boolean, required
  - `name` string, required
  - `created_at` string, date-time, required
  - `last_used_at` string, date-time, nullable, required
  - `scopes` APIKeyScopeResponse[], nullable, required
    - `scope_id` string, required
    - `object_type` string, nullable
    - `object_id` string, nullable
    - `method` string, nullable
  - `secret_key` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/chutes/apis/fastapi.md) · [All operations](https://skmtc.net/chutes/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/chutes/fastapi/revisions/352418d4e3a2/schema)
