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

# Create a new API key.

`POST /apikey/`

## Request

- Base URL: `https://api.capgo.app`
- URL: `https://api.capgo.app/apikey/`
- Auth: API key in header `x-api-key`

Create a new API key with a selected permission mode (`read`, `upload`, `write`, or `all`). The secret is returned once at creation time.

## Request body

- ApiKeyCreate
  - `name` string, required
  - `mode` 'read' | 'write' | 'upload' | 'all', required
  - `limited_to_apps` string[]
  - `limited_to_orgs` string[]
  - `hashed` boolean
  - `expires_at` string, date-time

## Response `200`

Created API key. The raw secret may only be returned once.

- ApiKeyCreateEnvelope
  - `apikey` ApiKey, required
    - `id` integer, required
    - `key` string, nullable
    - `mode` 'read' | 'write' | 'upload' | 'all', required
    - `name` string, required
    - `created_at` string, date-time, nullable
    - `updated_at` string, date-time, nullable
    - `expires_at` string, date-time, nullable
    - `limited_to_apps` string[]
    - `limited_to_orgs` string[]

## Other responses

- `400`: The request body or query parameters were invalid.
- `401`: The API key is missing, invalid, or expired.
- `403`: The API key is valid but lacks the required scope or org access.
- `429`: Too many requests. Back off and retry later.
- `500`: Unexpected Capgo server error.

---

[API](https://skmtc.dev/capgo/apis/capgo-public-api.md) · [All operations](https://skmtc.dev/capgo/apis/capgo-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/capgo/apis/capgo-public-api/revisions/8496acb7a95b?raw)
