Andamio LogoAndamio
Andamio API/API Key

Rotate API Key

API Key

This endpoint validates the existence of the provided API key. If the key exists, 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.

POST
/apikey/rotate
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

api_keystring
expires_at?string

Response Body

curl -X POST "https://andamio-api-308006323670.us-central1.run.app/api/v1/apikey/rotate" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }'
const body = JSON.stringify({
  "api_key": "ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
})

fetch("https://andamio-api-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-308006323670.us-central1.run.app/api/v1/apikey/rotate"
  body := strings.NewReader(`{
    "api_key": "ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }`)
  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-308006323670.us-central1.run.app/api/v1/apikey/rotate"
body = {
  "api_key": "ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
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": "ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}""");
HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://andamio-api-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": "ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.PostAsync("https://andamio-api-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.",
  "statusCode": 400
}
{
  "details": "string",
  "message": "Unauthorized: Invalid or missing credentials.",
  "statusCode": 401
}
{
  "details": "string",
  "message": "Forbidden: Insufficient permissions or tier access.",
  "statusCode": 403
}
{
  "details": "string",
  "message": "Not Found: The requested resource could not be found.",
  "statusCode": 404
}
{
  "details": "string",
  "message": "Conflict - The provided alias is already taken by another user. Please choose a different alias.",
  "statusCode": 409
}
{
  "details": "string",
  "message": "Unprocessable Entity: Invalid request structure or data.",
  "statusCode": 422
}
{
  "details": "string",
  "message": "Too Many Requests: Rate limit or quota exceeded.",
  "statusCode": 429
}
{
  "details": "string",
  "message": "Internal Server Error: An unexpected error occurred.",
  "statusCode": 500
}