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

# Create API token

`POST /api/admin/api-tokens`

Create an API token of a specific type: one of client, admin, frontend, backend.

## Request body

- CreateApiTokenSchema — The data required to create an [Unleash API token](https://docs.getunleash.io/concepts/api-tokens-and-client-keys).
  - `expiresAt` string, date-time — The time when this token should expire.
  - `type` string, required — A client or frontend token. Must be one of the strings "client" (deprecated), "backend" (preferred over "client") or "frontend" (not case sensitive).
  - `environment` string — The environment that the token should be valid for. Defaults to "default"
  - `project` string — The project that the token should be valid for. Defaults to "*" meaning every project. This property is mutually incompatible with the `projects` property. If you specify one, you cannot specify the other.
  - `projects` string[] — A list of projects that the token should be valid for. This property is mutually incompatible with the `project` property. If you specify one, you cannot specify the other.
  - `tokenName` string, required — The name of the token.

## Response `201`

The resource was successfully created.

- ApiTokenSchema — An overview of an [Unleash API token](https://docs.getunleash.io/concepts/api-tokens-and-client-keys).
  - `secret` string, nullable — The token used for authentication.
  - `tokenName` string, required — A unique name for this particular token
  - `type` 'client' | 'admin' | 'frontend' | 'backend', required — The type of API token
  - `environment` string — The environment the token has access to.
  - `project` string — The project this token belongs to.
  - `projects` string[], required — The list of projects this token has access to. If the token has access to specific projects they will be listed here. If the token has access to all projects it will be represented as `[*]`
  - `expiresAt` string, date-time, nullable — The token's expiration date. NULL if the token doesn't have an expiration set.
  - `createdAt` string, date-time, required — When the token was created.
  - `seenAt` string, date-time, nullable — When the token was last seen/used to authenticate with. NULL if the token has not yet been used for authentication.
  - `alias` string, nullable — Alias is no longer in active use and will often be NULL. It's kept around as a way of allowing old proxy tokens created with the old metadata format to keep working.
  - `secure` boolean, nullable — True if using the new api token format. This means copy token will no longer work

## Other responses

- `401` — Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`.
- `403` — The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation
- `415` — The operation does not support request payloads of the provided type. Please ensure that you're using one of the listed payload types and that you have specified the right content type in the "content-type" header.

---

[API](https://skmtc.net/unleash/apis/unleash-api-3.md) · [All operations](https://skmtc.net/unleash/apis/unleash-api-3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unleash/unleash-api-3/revisions/b2c3116e633e/schema)
