---
title: "Create API token"
method: POST
path: "/api/api-tokens"
tags: ["API Tokens"]
---

# Create API token

`POST /api/api-tokens`

Generates a new scoped API token. The full token is only returned in the creation response
and cannot be retrieved again. Requires admin role.

**Note:** API tokens cannot create other API tokens.

## Request body

- object
  - `name` string, required — Human-readable token name. Must be unique among the user's active tokens.
  - `scope` 'read-only' | 'deploy-only' | 'full-admin', required — Permission scope: - `read-only` — GET requests only - `deploy-only` — Read + stack deploy/stop/restart operations - `full-admin` — All operations (except license, user, and token management)
  - `expires_in` 30 | 60 | 90 | 365 | null, nullable — Token lifetime in days. Use `null` for no expiry.

## Response `201`

Token created. The `token` field contains the full JWT. Save it now; it will not be shown again.

- object
  - `id` integer, required
  - `token` string, required — Full JWT token. Store securely — this is the only time it's returned.

## Other responses

- `400` — Validation error (missing/invalid fields, or maximum of 25 active tokens reached).
- `403` — Insufficient permissions or license tier.
- `409` — An active token with this name already exists.
- `500` — Internal server error.

## Changes

- **2026-06-04** `d58cf9d6195b` — 4 info
  - removed the `ADMIRAL_REQUIRED` enum value from the `code` response property for the response status `400`
  - removed the `ADMIRAL_REQUIRED` enum value from the `code` response property for the response status `403`
  - removed the `ADMIRAL_REQUIRED` enum value from the `code` response property for the response status `409`
  - removed the `ADMIRAL_REQUIRED` enum value from the `code` response property for the response status `500`
- **2026-04-13** `ae0afff8a96e` — 1 info
  - added the non-success response with the status `409`
- **2026-04-05** `7464894ea582` — 3 warning, 3 info
  - added the new `PAID_REQUIRED` enum value to the `code` response property for the response status `400`
  - added the new `PAID_REQUIRED` enum value to the `code` response property for the response status `403`
  - added the new `PAID_REQUIRED` enum value to the `code` response property for the response status `500`
  - removed the `PRO_REQUIRED` enum value from the `code` response property for the response status `400`
  - …2 more

[Change history](https://skmtc.dev/studio-saelix/apis/sencho-api/changes/api/api-tokens/post.md)

---

[API](https://skmtc.dev/studio-saelix/apis/sencho-api.md) · [All operations](https://skmtc.dev/studio-saelix/apis/sencho-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/studio-saelix/sencho-api/revisions/82aac94c016e/schema)
