Create an API token

Create an API token. An API token is an alphanumeric token that grants programmatic access to Astro for automated workflows. An API token can be scoped to an Organization or a Workspace.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

organizationIdstringRequired
The ID of the Organization where you want to create the token.

Request

The Request body for creating an API token
namestringRequired
The name of the API token.
rolestringRequired
The role of the API token.
scopeenumRequired
The scope of the API token.
Allowed values:
descriptionstringOptional
The description for the API token.
entityIdstringOptional

The ID of the Workspace or Deployment to which the API token is scoped. It is required if Scope is WORKSPACE or DEPLOYMENT.

kindenumOptional
The kind of API token. Defaults to STANDARD if not specified.
Allowed values:
tokenExpiryPeriodInDaysintegerOptional1-3650
The expiry period of the API token in days. If not specified, the token will never expire.

Response

OK
createdAtstringformat: "date-time"

The time when the API token was created in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ.

descriptionstring
The description of the API token.
idstring
The API token's ID.
kindenum
The kind of the API token.
Allowed values:
namestring
The name of the API token.
scopeenum
The scope of the API token.
Allowed values:
shortTokenstring
The short value of the API token.
startAtstringformat: "date-time"

The time when the API token will become valid in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ.

updatedAtstringformat: "date-time"

The time when the API token was last updated in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ.

createdByobject or null
endAtstring or nullformat: "date-time"

The time when the API token expires in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ.

expiryPeriodInDaysinteger or null
The expiry period of the API token in days.
lastUsedAtstring or nullformat: "date-time"

The time when the API token was last used in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ.

roleslist of objects or null
The roles of the API token.
tokenstring or null
The value of the API token.
updatedByobject or null

Errors