Skip to main content
POST
/
organizations
/
{organizationId}
/
deployments
/
{deploymentId}
/
agent-tokens
Create an Agent API token
curl --request POST \
  --url https://api.astronomer.io/platform/v1beta1/organizations/{organizationId}/deployments/{deploymentId}/agent-tokens \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "My token",
  "description": "This is my API token",
  "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 that owns the deployment where you want to create the Agent API token.

deploymentId
string
required

The ID of the deployment where you want to create the Agent API token.

Body

application/json

The request body for creating an Agent API Token.

name
string
required

The name of the API token.

Example:

"My token"

description
string

The description for the API token.

Example:

"This is my API token"

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