Get Customer Usage
curl --request GET \
--url https://api.limitguard.ai/v1/usage \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.limitguard.ai/v1/usage"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.limitguard.ai/v1/usage', 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.limitguard.ai/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-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.limitguard.ai/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-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.get("https://api.limitguard.ai/v1/usage")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitguard.ai/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"period": "<string>",
"period_start": "2023-11-07T05:31:56Z",
"period_end": "2023-11-07T05:31:56Z",
"tier": "<string>",
"quota": {
"limit": 1,
"used": 1,
"remaining": 1,
"percent_used": 50
},
"calls": {
"total": 1,
"by_endpoint": {},
"by_status": {}
},
"performance": {
"avg_response_time_ms": 1,
"p95_response_time_ms": 1,
"cache_hit_rate": 50
},
"cost": {
"total_usd": 1,
"by_endpoint": {}
},
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}API Reference
Get Customer Usage
Return customer usage analytics for the authenticated API key.
Includes quota tracking, call statistics, performance metrics, and cost breakdown. Requires API key authentication.
Args: period: Time period for usage aggregation (default: current_month) api_key: Validated API key from require_api_key dependency
Returns: CustomerUsageResponse with complete usage data
GET
/
v1
/
usage
Get Customer Usage
curl --request GET \
--url https://api.limitguard.ai/v1/usage \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.limitguard.ai/v1/usage"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.limitguard.ai/v1/usage', 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.limitguard.ai/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-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.limitguard.ai/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-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.get("https://api.limitguard.ai/v1/usage")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitguard.ai/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"period": "<string>",
"period_start": "2023-11-07T05:31:56Z",
"period_end": "2023-11-07T05:31:56Z",
"tier": "<string>",
"quota": {
"limit": 1,
"used": 1,
"remaining": 1,
"percent_used": 50
},
"calls": {
"total": 1,
"by_endpoint": {},
"by_status": {}
},
"performance": {
"avg_response_time_ms": 1,
"p95_response_time_ms": 1,
"cache_hit_rate": 50
},
"cost": {
"total_usd": 1,
"by_endpoint": {}
},
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Query Parameters
Time period for usage aggregation.
Available options:
current_month, previous_month, last_7_days, last_30_days Response
Successful Response
Complete usage response for customer dashboard (DYN-273).
Usage period
Period start timestamp
Period end timestamp
Customer pricing tier
Quota information
Show child attributes
Show child attributes
Call statistics
Show child attributes
Show child attributes
Performance metrics
Show child attributes
Show child attributes
Cost breakdown
Show child attributes
Show child attributes
Request tracking ID