---
title: "Generate API token"
method: POST
path: "/api/auth/api-keys/"
tags: ["auth"]
---

# Generate API token

`POST /api/auth/api-keys/`

## Request

- Base URL: `https://api.overmindlab.ai`
- URL: `https://api.overmindlab.ai/api/auth/api-keys/`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Api-Key`
  - API key in cookie `sessionid`
  - API key in header `X-Api-Key`
  - HTTP bearer

Create a new API token. Passing ``project`` (or ``scope.scope=project``) mints a key pinned to that project. ``scope.scope=account`` covers every project the user belongs to. ``description`` and ``expires_in_days`` (0, 30, 90, 180 or 365) match the Console dialog. 0 does not expire.

## Request body

- APITokenCreateRequestRequest
  - `name` string
  - `description` string
  - `expires_in_days` 0 | 30 | 90 | 180 | 365: * `0` - 0 * `30` - 30 * `90` - 90 * `180` - 180 * `365` - 365
  - `project` string, uuid
  - `scope` APITokenScopeRequest
    - `scope` 'account' | 'project', required: * `account` - account * `project` - project
    - `resourceIds` string[]
    - `permission` PermissionEnum[]

## Response `201`

Plaintext key is returned only in this response.

- APITokenCreateResponse
  - `id` string, uuid, required
  - `key` string, required: Plaintext secret. Shown only once.
  - `name` string, required
  - `description` string, required
  - `prefix` string, required
  - `project` string, uuid, nullable, required
  - `scope` APITokenScope, required
    - `scope` 'account' | 'project', required: * `account` - account * `project` - project
    - `resourceIds` string[]
    - `permission` PermissionEnum[]
  - `expires_at` string, date-time, nullable, required
  - `created_at` string, date-time, required

---

[API](https://skmtc.dev/overmindlab/apis/overmind-api.md) - [All operations](https://skmtc.dev/overmindlab/apis/overmind-api/llms.txt) - [OpenAPI document](https://skmtc.dev/overmindlab/apis/overmind-api/revisions/0ecfd39e80c6?raw)
