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.
Path parameters
organizationId
The ID of the Organization where you want to create the token.
Headers
Authorization
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
This endpoint expects an object.
name
The name of the API token.
role
The role of the API token.
type
The scope of the API token.
Allowed values:
description
The description for the API token.
entityId
The ID of the Workspace or Deployment to which the API token is scoped. It is required if Type
is WORKSPACE
or DEPLOYMENT
.
tokenExpiryPeriodInDays
The expiry period of the API token in days. If not specified, the token will never expire.
Response
OK
createdAt
The time when the API token was created in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ
.
description
The description of the API token.
id
The API token's ID.
name
The name of the API token.
shortToken
The short value of the API token.
startAt
The time when the API token will become valid in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ
.
type
The type of the API token.
Allowed values:
updatedAt
The time when the API token was last updated in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ
.
createdBy
endAt
The time when the API token expires in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ
.
expiryPeriodInDays
The expiry period of the API token in days.
lastUsedAt
The time when the API token was last used in UTC, formatted as YYYY-MM-DDTHH:MM:SSZ
.
roles
The roles of the API token.
token
The value of the API token.
updatedBy