Rotate service account token
curl --request POST \
--url https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "ee45f34b-9685-40d8-8724-23c31252ca46",
"name": "my-service-account",
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"creationTime": "2024-05-31T14:11:00Z",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"groupIDs": [
"f2000047-19f8-426e-93b9-9f0a5bfa0edd"
]
},
"status": {
"expiry": "2025-03-14T16:10:00Z",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}{
"error": "access_denied",
"error_description": "authentication failed"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges"
}{
"error": "server_error",
"error_description": "failed to token claim"
}Service accounts
Rotate service account token
Rotates a service account’s access token. The returned access token can only be read once.
POST
/
api
/
v1
/
organizations
/
{organizationID}
/
serviceaccounts
/
{serviceAccountID}
/
rotate
Rotate service account token
curl --request POST \
--url https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://identity.nks.europe-west4.nscale.com/api/v1/organizations/{organizationID}/serviceaccounts/{serviceAccountID}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "ee45f34b-9685-40d8-8724-23c31252ca46",
"name": "my-service-account",
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"creationTime": "2024-05-31T14:11:00Z",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"groupIDs": [
"f2000047-19f8-426e-93b9-9f0a5bfa0edd"
]
},
"status": {
"expiry": "2025-03-14T16:10:00Z",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}{
"error": "access_denied",
"error_description": "authentication failed"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges"
}{
"error": "server_error",
"error_description": "failed to token claim"
}Authorizations
Operation requires OAuth 2.0 bearer token authentication.
Path Parameters
An organization ID.
A service account ID.
Was this page helpful?
⌘I