curl --request GET \
--url https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start": "2025-01-01T00:00:00Z",
"end": "2025-01-31T23:59:59Z",
"group_by": [
"<string>"
],
"resolution": "day"
}
'import requests
url = "https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage"
payload = {
"start": "2025-01-01T00:00:00Z",
"end": "2025-01-31T23:59:59Z",
"group_by": ["<string>"],
"resolution": "day"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start: '2025-01-01T00:00:00Z',
end: '2025-01-31T23:59:59Z',
group_by: ['<string>'],
resolution: 'day'
})
};
fetch('https://api-v2.requesty.ai/v1/manage/apikey/{id}/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-v2.requesty.ai/v1/manage/apikey/{id}/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'start' => '2025-01-01T00:00:00Z',
'end' => '2025-01-31T23:59:59Z',
'group_by' => [
'<string>'
],
'resolution' => 'day'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage"
payload := strings.NewReader("{\n \"start\": \"2025-01-01T00:00:00Z\",\n \"end\": \"2025-01-31T23:59:59Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"resolution\": \"day\"\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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-v2.requesty.ai/v1/manage/apikey/{id}/usage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start\": \"2025-01-01T00:00:00Z\",\n \"end\": \"2025-01-31T23:59:59Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"resolution\": \"day\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start\": \"2025-01-01T00:00:00Z\",\n \"end\": \"2025-01-31T23:59:59Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"resolution\": \"day\"\n}"
response = http.request(request)
puts response.read_body{
"usage": {}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}Get API Key Usage
Get usage statistics for a specific API key within a date range
curl --request GET \
--url https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start": "2025-01-01T00:00:00Z",
"end": "2025-01-31T23:59:59Z",
"group_by": [
"<string>"
],
"resolution": "day"
}
'import requests
url = "https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage"
payload = {
"start": "2025-01-01T00:00:00Z",
"end": "2025-01-31T23:59:59Z",
"group_by": ["<string>"],
"resolution": "day"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start: '2025-01-01T00:00:00Z',
end: '2025-01-31T23:59:59Z',
group_by: ['<string>'],
resolution: 'day'
})
};
fetch('https://api-v2.requesty.ai/v1/manage/apikey/{id}/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-v2.requesty.ai/v1/manage/apikey/{id}/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'start' => '2025-01-01T00:00:00Z',
'end' => '2025-01-31T23:59:59Z',
'group_by' => [
'<string>'
],
'resolution' => 'day'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage"
payload := strings.NewReader("{\n \"start\": \"2025-01-01T00:00:00Z\",\n \"end\": \"2025-01-31T23:59:59Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"resolution\": \"day\"\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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-v2.requesty.ai/v1/manage/apikey/{id}/usage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start\": \"2025-01-01T00:00:00Z\",\n \"end\": \"2025-01-31T23:59:59Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"resolution\": \"day\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.requesty.ai/v1/manage/apikey/{id}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start\": \"2025-01-01T00:00:00Z\",\n \"end\": \"2025-01-31T23:59:59Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"resolution\": \"day\"\n}"
response = http.request(request)
puts response.read_body{
"usage": {}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}group_by fields: group_name, group_id, member_id, member_email, user_id, api_key_id, model_requested, model_used, provider_used, is_byok, origin_title, extra.<field_name>, api_key_label.<label_key>, and group_label.<label_key>.Authorizations
API key for authentication
Path Parameters
Body
Start date in RFC3339 format (e.g., 2025-01-01T00:00:00Z). Required. The date range cannot exceed 100 days from start to end.
"2025-01-01T00:00:00Z"
End date in RFC3339 format (e.g., 2025-01-31T23:59:59Z). Optional. Defaults to 24 hours from start if not specified. Must be after start date. The date range cannot exceed 100 days.
"2025-01-31T23:59:59Z"
Fields to group by: group_name, group_id, member_id, member_email, user_id, api_key_id, model_requested, model_used, provider_used, is_byok, origin_title, extra.<field_name>, api_key_label.<label_key>, or group_label.<label_key>. Rows missing a requested label are grouped under "Unknown".
Time resolution for aggregation
hour, day, month Response
Successfully retrieved usage data
Map of period (string) to usage entry
Show child attributes
Show child attributes
Was this page helpful?