---
title: "Create a project API token."
method: POST
path: "/api/admin/projects/{projectId}/api-tokens"
tags: ["Projects"]
---

# Create a project API token.

`POST /api/admin/projects/{projectId}/api-tokens`

Endpoint that allows creation of [project API tokens](https://docs.getunleash.io/concepts/api-tokens-and-client-keys#api-token-visibility) for the specified project.

## Path parameters

- `projectId` string, required

## Request body

- CreateProjectApiTokenSchema — The schema for creating a project API token. This schema is used to create a new project API token.
  - `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".
  - `expiresAt` string, date-time — The date and time when the token should expire. The date should be in ISO 8601 format.
  - `tokenName` string, required — A unique name for this particular 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

- `400` — The request data does not match what we expect.
- `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
- `404` — The requested resource was not found.

---

[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/versions/b2c3116e633e/schema)
