Skip to main content

Create a project API token.

POST 

/api/admin/projects/:projectId/api-tokens

Endpoint that allows creation of project API tokens for the specified project.

Request

Path Parameters

    projectId stringrequired

Body

required

createApiTokenSchema

    oneOf

    expiresAt date-time

    The time when this token should expire.

    Example: 2023-07-04T11:26:24+02:00
    type stringrequired

    An admin token. Must be the string "admin" (not case sensitive).

    Possible values: Value must match regular expression ^[Aa][Dd][Mm][Ii][Nn]$

    Example: admin
    tokenName stringrequired

    The name of the token.

    Example: token-64522

Responses

The resource was successfully created.

Response Headers

  • location

    string

    The location of the newly created resource.

Schema

    secret stringrequired

    The token used for authentication.

    Example: project:environment.xyzrandomstring
    username stringdeprecated

    This property was deprecated in Unleash v5. Prefer the tokenName property instead.

    Example: a-name
    tokenName stringrequired

    A unique name for this particular token

    Example: some-user
    type stringrequired

    The type of API token

    Possible values: [client, admin, frontend]

    Example: client
    environment string

    The environment the token has access to. * if it has access to all environments.

    Example: development
    project stringrequired

    The project this token belongs to.

    Example: developerexperience
    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 [*]

    Example: ["developerexperience","enterprisegrowth"]
    expiresAt date-timenullable

    The token's expiration date. NULL if the token doesn't have an expiration set.

    Example: 2023-04-19T08:15:14.000Z
    createdAt date-timerequired

    When the token was created.

    Example: 2023-04-19T08:15:14.000Z
    seenAt date-timenullable

    When the token was last seen/used to authenticate with. NULL if the token has not yet been used for authentication.

    Example: 2023-04-19T08:15:14.000Z
    alias stringnullable

    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.

    Example: randomid-or-some-alias
Loading...