Create a service token
import requests
url = "https://platform.ankra.app/api/v1/org/organisation/service-tokens"
payload = {
"name": "<string>",
"label": "<string>",
"role_slug": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": ["<string>"],
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
label: '<string>',
role_slug: '<string>',
expires_at: '2023-11-07T05:31:56Z',
scopes: ['<string>'],
project_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://platform.ankra.app/api/v1/org/organisation/service-tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/organisation/service-tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"label": "<string>",
"role_slug": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
"<string>"
],
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account_name": "<string>",
"label": "<string>",
"role_slug": "<string>",
"expires_at": "<string>",
"type": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Organisation IAM
Create a service token
Mints a token for a service account of the organisation and returns the secret once. Requires members.manage; a service account cannot mint tokens, and a token cannot carry more than the caller holds or reach outside the caller’s project.
POST
/
api
/
v1
/
org
/
organisation
/
service-tokens
Create a service token
import requests
url = "https://platform.ankra.app/api/v1/org/organisation/service-tokens"
payload = {
"name": "<string>",
"label": "<string>",
"role_slug": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": ["<string>"],
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
label: '<string>',
role_slug: '<string>',
expires_at: '2023-11-07T05:31:56Z',
scopes: ['<string>'],
project_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://platform.ankra.app/api/v1/org/organisation/service-tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/organisation/service-tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"label": "<string>",
"role_slug": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
"<string>"
],
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account_name": "<string>",
"label": "<string>",
"role_slug": "<string>",
"expires_at": "<string>",
"type": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The service account to mint the token for; created when it does not exist.
The role the service account holds.
RFC 3339 expiry.
Absent pins the token to the caller's current project, null leaves it unpinned, a UUID pins it to that project.