Skip to main content
POST
/
organizations
/
{organizationId}
/
tokens
Create an API token
curl --request POST \
  --url https://api.astronomer.io/platform/v1beta1/organizations/{organizationId}/tokens \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "My token",
  "role": "WORKSPACE_OWNER",
  "type": "WORKSPACE",
  "description": "This is my API token",
  "entityId": "clm8pxjjw000008l23jm08hyu",
  "kind": "STANDARD",
  "tokenExpiryPeriodInDays": 30
}
'
{
  "createdAt": "2022-11-22T04:37:12Z",
  "description": "my token description",
  "id": "clm8q7f6q000008lcgyougpsk",
  "kind": "STANDARD",
  "name": "My token",
  "shortToken": "short-token",
  "startAt": "2022-11-22T04:37:12Z",
  "type": "WORKSPACE",
  "updatedAt": "2022-11-22T04:37:12Z",
  "createdBy": {
    "id": "clm8qv74h000008mlf08scq7k",
    "apiTokenName": "my-token",
    "avatarUrl": "https://avatar.url",
    "fullName": "Jane Doe",
    "subjectType": "USER",
    "username": "user1@company.com"
  },
  "endAt": "2022-11-22T04:37:12Z",
  "expiryPeriodInDays": 30,
  "lastUsedAt": "2022-11-22T04:37:12Z",
  "roles": [
    {
      "entityId": "clm8sgvai000008l794psbkdv",
      "entityType": "WORKSPACE",
      "role": "WORKSPACE_MEMBER",
      "deploymentId": "clm8t5u4q000008jq4qoc3031"
    }
  ],
  "token": "token",
  "updatedBy": {
    "id": "clm8qv74h000008mlf08scq7k",
    "apiTokenName": "my-token",
    "avatarUrl": "https://avatar.url",
    "fullName": "Jane Doe",
    "subjectType": "USER",
    "username": "user1@company.com"
  }
}

Documentation Index

Fetch the complete documentation index at: https://astronomer-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

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

Path Parameters

organizationId
string
required

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

Body

application/json

The Request body for creating an API token

name
string
required

The name of the API token.

Example:

"My token"

role
string
required

The role of the API token.

Example:

"WORKSPACE_OWNER"

type
enum<string>
required

The scope of the API token.

Available options:
DEPLOYMENT,
WORKSPACE,
ORGANIZATION
Example:

"WORKSPACE"

description
string

The description for the API token.

Example:

"This is my API token"

entityId
string

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

Example:

"clm8pxjjw000008l23jm08hyu"

kind
enum<string>

The kind of API token. Defaults to STANDARD if not specified.

Available options:
STANDARD,
DIRECT_ACCESS
Example:

"STANDARD"

tokenExpiryPeriodInDays
integer

The expiry period of the API token in days. If not specified, the token will never expire.

Required range: 1 <= x <= 3650
Example:

30

Response

OK

createdAt
string<date-time>
required

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

Example:

"2022-11-22T04:37:12Z"

description
string
required

The description of the API token.

Example:

"my token description"

id
string
required

The API token's ID.

Example:

"clm8q7f6q000008lcgyougpsk"

kind
enum<string>
required

The kind of the API token.

Available options:
STANDARD,
DIRECT_ACCESS
Example:

"STANDARD"

name
string
required

The name of the API token.

Example:

"My token"

shortToken
string
required

The short value of the API token.

Example:

"short-token"

startAt
string<date-time>
required

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

Example:

"2022-11-22T04:37:12Z"

type
enum<string>
required

The type of the API token.

Available options:
DEPLOYMENT,
WORKSPACE,
ORGANIZATION
Example:

"WORKSPACE"

updatedAt
string<date-time>
required

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

Example:

"2022-11-22T04:37:12Z"

createdBy
object
endAt
string<date-time>

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

Example:

"2022-11-22T04:37:12Z"

expiryPeriodInDays
integer

The expiry period of the API token in days.

Example:

30

lastUsedAt
string<date-time>

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

Example:

"2022-11-22T04:37:12Z"

roles
object[]

The roles of the API token.

token
string

The value of the API token.

Example:

"token"

updatedBy
object