Rotate API Key
API Key
This endpoint validates the existence of the provided API key name. If the key name exists and belongs to the authenticated user, it checks its expiration status. If the API key is found to be expired or within 1 day of expiration, its validity is extended by the specified duration.
Authorization<token>
Bearer token for authentication. Type "Bearer" followed by a space and JWT token. Example: "Bearer YOUR_JWT_TOKEN"
In: header
API Key Rotation Request (using API key name and optional expiration in days)
api_key_namestring
Length
3 <= length <= 64expires_in_days?integer
Range
1 <= valueResponse Body
curl -X POST "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/apikey/rotate" \
-H "Content-Type: application/json" \
-d '{
"api_key_name": "MyFirstKey"
}'const body = JSON.stringify({
"api_key_name": "MyFirstKey"
})
fetch("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/apikey/rotate", {
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/apikey/rotate"
body := strings.NewReader(`{
"api_key_name": "MyFirstKey"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/apikey/rotate"
body = {
"api_key_name": "MyFirstKey"
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;
var body = BodyPublishers.ofString("""{
"api_key_name": "MyFirstKey"
}""");
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/apikey/rotate"))
.header("Content-Type", "application/json")
.POST(body)
.build();
try {
HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Response body: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}using System;
using System.Net.Http;
using System.Text;
var body = new StringContent("""
{
"api_key_name": "MyFirstKey"
}
""", Encoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.PostAsync("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/apikey/rotate", body);
var responseBody = await response.Content.ReadAsStringAsync();{
"confirmation": "API key expiration extended to 2026-08-31T23:59:59Z"
}{
"details": "string",
"message": "Bad Request: Invalid input.",
"status_code": 400
}{
"details": "string",
"message": "Unauthorized: Invalid or missing credentials.",
"status_code": 401
}{
"details": "string",
"message": "Forbidden: Insufficient permissions or tier access.",
"status_code": 403
}{
"details": "string",
"message": "Not Found: The requested resource could not be found.",
"status_code": 404
}{
"details": "string",
"message": "Conflict - The provided alias is already taken by another user. Please choose a different alias.",
"status_code": 409
}{
"details": "string",
"message": "Unprocessable Entity: Invalid request structure or data.",
"status_code": 422
}{
"details": "string",
"message": "Too Many Requests: Rate limit or quota exceeded.",
"status_code": 429
}{
"details": "string",
"message": "Internal Server Error: An unexpected error occurred.",
"status_code": 500
}