ApiToken

Rotate API token

POST
Rotate an API token. Creates a new API token and invalidates the one you specify. Any workflows using the previous value stop working.

Path parameters

organizationIdstringRequired
The ID of the Organization where you want to rotate an API token.
tokenIdstringRequired
The token to rotate

Response

This endpoint returns an object
createdAt
datetime

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

description
string
The description of the API token.
id
string
The API token's ID.
name
string
The name of the API token.
shortToken
string
The short value of the API token.
startAt
datetime

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

type
enum
The type of the API token.
Allowed values: DEPLOYMENTWORKSPACEORGANIZATION
updatedAt
datetime

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

createdBy
objectOptional
endAt
datetimeOptional

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

expiryPeriodInDays
integerOptional
The expiry period of the API token in days.
lastUsedAt
datetimeOptional

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

roles
list of objectsOptional
The roles of the API token.
token
stringOptional
The value of the API token.
updatedBy
objectOptional
POST
1curl -X POST https://api.astronomer.io/iam/v1beta1/organizations/organizationId/tokens/tokenId/rotate \
2 -H "Authorization: Bearer <token>"
Response
1{
2 "createdAt": "2022-11-22T04:37:12Z",
3 "description": "my token description",
4 "id": "clm8q7f6q000008lcgyougpsk",
5 "name": "My token",
6 "shortToken": "short-token",
7 "startAt": "2022-11-22T04:37:12Z",
8 "type": "DEPLOYMENT",
9 "updatedAt": "2022-11-22T04:37:12Z",
10 "createdBy": {
11 "id": "clm8qv74h000008mlf08scq7k",
12 "apiTokenName": "my-token",
13 "avatarUrl": "https://avatar.url",
14 "fullName": "Jane Doe",
15 "subjectType": "USER",
16 "username": "user1@company.com"
17 },
18 "endAt": "2022-11-22T04:37:12Z",
19 "expiryPeriodInDays": 30,
20 "lastUsedAt": "2022-11-22T04:37:12Z",
21 "roles": [
22 {
23 "entityId": "clm8sgvai000008l794psbkdv",
24 "entityType": "DEPLOYMENT",
25 "role": "WORKSPACE_MEMBER"
26 }
27 ],
28 "token": "token",
29 "updatedBy": {
30 "id": "clm8qv74h000008mlf08scq7k",
31 "apiTokenName": "my-token",
32 "avatarUrl": "https://avatar.url",
33 "fullName": "Jane Doe",
34 "subjectType": "USER",
35 "username": "user1@company.com"
36 }
37}