Replace an active API token atomically, without changing its grants.
curl --request POST \
--url https://api.erdo.ai/v1/tokens/{tokenID}/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.erdo.ai/v1/tokens/{tokenID}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.erdo.ai/v1/tokens/{tokenID}/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://api.erdo.ai/v1/tokens/{tokenID}/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://api.erdo.ai/v1/tokens/{tokenID}/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://api.erdo.ai/v1/tokens/{tokenID}/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.erdo.ai/v1/tokens/{tokenID}/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{
"access": "<string>",
"capabilities": [
"<string>"
],
"default_org": {
"id": "<string>",
"name": "<string>"
},
"expires_at": "<string>",
"hint": "<string>",
"id": "<string>",
"is_scoped": true,
"replaced_token_id": "<string>",
"resource_slugs": [
"<string>"
],
"token": "<string>"
}{
"code": "not_found",
"details": {},
"message": "<string>"
}API Reference
Replace an active API token atomically, without changing its grants.
Only the key’s OWNER may rotate it. An admin of the owner’s home organization can revoke a member’s key but not rotate it, because the replacement acts as the owner and its secret is returned to the caller. Owner, default organization, access mode, capabilities and resource slugs are preserved; the original lifetime starts again from the time of rotation, capped at 36500 days. The new secret is returned once, and the old key stops working immediately. Scoped and read-only credentials cannot perform rotation.
POST
/
v1
/
tokens
/
{tokenID}
/
rotate
Replace an active API token atomically, without changing its grants.
curl --request POST \
--url https://api.erdo.ai/v1/tokens/{tokenID}/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.erdo.ai/v1/tokens/{tokenID}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.erdo.ai/v1/tokens/{tokenID}/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://api.erdo.ai/v1/tokens/{tokenID}/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://api.erdo.ai/v1/tokens/{tokenID}/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://api.erdo.ai/v1/tokens/{tokenID}/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.erdo.ai/v1/tokens/{tokenID}/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{
"access": "<string>",
"capabilities": [
"<string>"
],
"default_org": {
"id": "<string>",
"name": "<string>"
},
"expires_at": "<string>",
"hint": "<string>",
"id": "<string>",
"is_scoped": true,
"replaced_token_id": "<string>",
"resource_slugs": [
"<string>"
],
"token": "<string>"
}{
"code": "not_found",
"details": {},
"message": "<string>"
}Authorizations
An Erdo API key (erdo_api_...) or scoped token (erdo_token_...).

