Andamio LogoAndamio
Andamio API/User/API Usage

Get User Daily API Usage

UserAPI Usage

This endpoint retrieves aggregated daily API usage data for the authenticated user, allowing filtering by date range, API key, endpoint, HTTP method, and API version.

POST
/user/usage/daily
Authorization<token>

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

In: header

Daily Usage Request Body - Contains filters for date range and a list of API key names.

api_key_names?array<string>
end_datestring
start_datestring

Response Body

curl -X POST "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/user/usage/daily" \
  -H "Content-Type: application/json" \
  -d '{
    "end_date": "2023-01-31",
    "start_date": "2023-01-01"
  }'
const body = JSON.stringify({
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
})

fetch("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/user/usage/daily", {
  body
})
package main

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

func main() {
  url := "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/user/usage/daily"
  body := strings.NewReader(`{
    "end_date": "2023-01-31",
    "start_date": "2023-01-01"
  }`)
  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/user/usage/daily"
body = {
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
}
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("""{
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
}""");
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/user/usage/daily"))
  .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("""
{
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.PostAsync("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/user/usage/daily", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
  "user_usages": [
    {
      "api_key_name": "MyFirstKey",
      "usage_Data": [
        {
          "api_key_name": "MyFirstKey",
          "api_versions": [
            "[\"v1\"]"
          ],
          "authentication_methods": [
            "[\"API_KEY\"]"
          ],
          "date": "2023-01-01",
          "endpoints": [
            "[\"/v1/data\"]"
          ],
          "http_methods": [
            "[\"GET\"]"
          ],
          "tier_id": 1,
          "tier_name": "Free",
          "total_error_count": 50,
          "total_requests": 1000
        }
      ]
    }
  ]
}
{
  "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": "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
}