Python SDK
from revenuebase_sdk import RevenuebaseClient
client = RevenuebaseClient()
response = client.account.rotate_api_key()
print(response.api_key)curl --request POST \
--url https://api.revenuebase.ai/v2/account/api-keys/rotate \
--header 'x-key: <api-key>'const options = {method: 'POST', headers: {'x-key': '<api-key>'}};
fetch('https://api.revenuebase.ai/v2/account/api-keys/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.revenuebase.ai/v2/account/api-keys/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 => [
"x-key: <api-key>"
],
]);
$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.revenuebase.ai/v2/account/api-keys/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-key", "<api-key>")
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.revenuebase.ai/v2/account/api-keys/rotate")
.header("x-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revenuebase.ai/v2/account/api-keys/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"api_key": "<string>"
}Utilities
Rotate your API key
Replace the account’s default API key used by your integrations.
POST
/
v2
/
account
/
api-keys
/
rotate
Python SDK
from revenuebase_sdk import RevenuebaseClient
client = RevenuebaseClient()
response = client.account.rotate_api_key()
print(response.api_key)curl --request POST \
--url https://api.revenuebase.ai/v2/account/api-keys/rotate \
--header 'x-key: <api-key>'const options = {method: 'POST', headers: {'x-key': '<api-key>'}};
fetch('https://api.revenuebase.ai/v2/account/api-keys/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.revenuebase.ai/v2/account/api-keys/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 => [
"x-key: <api-key>"
],
]);
$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.revenuebase.ai/v2/account/api-keys/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-key", "<api-key>")
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.revenuebase.ai/v2/account/api-keys/rotate")
.header("x-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revenuebase.ai/v2/account/api-keys/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"api_key": "<string>"
}Credits and plans
PAYG is Pay-as-you-go. AYCE is All-you-can-eat.| Usage | PAYG | AYCE |
|---|---|---|
| This request | Free 0 credits | Free 0 credits |
When to use this endpoint
Use this when replacing the account’s default integration key. Rotation changes credentials; it does not reset credits, allowances, or job ownership.The previous default key stops working immediately. Save the returned key securely and update every integration that used the old default key.
Example
SetREVENUEBASE_API_KEY to your API key.
curl --request POST 'https://api.revenuebase.ai/v2/account/api-keys/rotate' \
--header "X-Key: $REVENUEBASE_API_KEY"
Read the response
api_key is the new plaintext key. Capture it from this response and store it in your secret manager. Avoid logging it or including it in shared examples. This rotates the default key slot; separately named keys are managed in your account.
Retries and recovery
Do not automatically repeat a rotation after a lost response: another successful rotation replaces the key again. Check your account’s key controls to recover access, then update your integrations. Use the new key inX-Key for subsequent requests. Read the authentication guide for setup.Was this page helpful?
