---
title: "Create Token"
method: POST
path: "/api/tokens"
tags: ["Admin"]
---

# Create Token

`POST /api/tokens`

## Request

- Base URL: `https://app.getdot.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://app.getdot.ai/api/tokens`
- Auth: one of:
  - API key in header `X-API-KEY`
  - API key in cookie `Authorization`
  - OAuth 2 (password, token URL `/api/auth/token`)

Create a new API token for a user.

Request body:
- user_id: ID of the user to create token for
- name: Name of the token
- expires_in_days: Optional number of days until token expires
- description: Optional description

## Request body

- BodyCreateTokenApiTokensPost
  - `name` string, required
  - `user_id` string, nullable
  - `expires_in_days` integer, nullable
  - `description` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/getdot/apis/dot-api-2.md) · [All operations](https://skmtc.dev/getdot/apis/dot-api-2/llms.txt) · [OpenAPI document](https://skmtc.dev/getdot/apis/dot-api-2/revisions/d26fe7163a7f?raw)
