Andamio LogoAndamio
Andamio API/API Key

Request a New API Key

API Key

This endpoint generates and returns a new API key for the authenticated user. The new key can be used for subsequent API requests.

POST
/apikey/request
Authorization<token>

Bearer token for authentication. Type "Bearer" followed by a space and JWT token. Example: "Bearer YOUR_JWT_TOKEN"

In: header

API Key Request Body - Contains details for the new API key, such as its name and expiration duration.

api_key_namestring
Length3 <= length <= 100
expires_in_days?integer
Range1 <= value

Response Body

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

fetch("https://andamio-api-308006323670.us-central1.run.app/api/v1/apikey/request", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://andamio-api-308006323670.us-central1.run.app/api/v1/apikey/request"
  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-308006323670.us-central1.run.app/api/v1/apikey/request"
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-308006323670.us-central1.run.app/api/v1/apikey/request"))
  .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-308006323670.us-central1.run.app/api/v1/apikey/request", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
  "api_key": "ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "created_at": "2025-08-31T23:59:59Z",
  "expires_at": "2026-08-31T23:59:59Z",
  "expires_in_days": 365,
  "is_active": true,
  "name": "MyFirstKey"
}
{
  "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": "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
}