Usage of an API key
curl --request GET \
--url https://api.deapi.ai/api/v2/keys/{id}/usage \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.deapi.ai/api/v2/keys/{id}/usage"
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Accept: '<accept>', Authorization: 'Bearer <token>'}};
fetch('https://api.deapi.ai/api/v2/keys/{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.deapi.ai/api/v2/keys/{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_HTTPHEADER => [
"Accept: <accept>",
"Authorization: Bearer <token>"
],
]);
$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.deapi.ai/api/v2/keys/{id}/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Accept", "<accept>")
req.Header.Add("Authorization", "Bearer <token>")
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.deapi.ai/api/v2/keys/{id}/usage")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/keys/{id}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"from": "2026-09-15T00:00:00+00:00",
"to": "2026-09-22T00:00:00+00:00",
"group_by": "day",
"currency": "USD",
"totals": {
"cost": 12.345678,
"requests": 830,
"errors": 4
},
"groups": [
{
"cost": 12.345678,
"requests": 830,
"errors": 4,
"key": "2026-09-21",
"name": "<string>"
}
]
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123,
"code": "missing_key"
}{
"message": "This API key does not have permission to access this endpoint.",
"code": "insufficient_permissions"
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123,
"code": "missing_key"
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123,
"code": "missing_key"
}{
"message": "Too Many Attempts."
}API Keys
Get Key Usage
Like GET /api/v2/key/usage, for any key of the account. Needs an ADMIN key.
GET
/
api
/
v2
/
keys
/
{id}
/
usage
Usage of an API key
curl --request GET \
--url https://api.deapi.ai/api/v2/keys/{id}/usage \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.deapi.ai/api/v2/keys/{id}/usage"
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Accept: '<accept>', Authorization: 'Bearer <token>'}};
fetch('https://api.deapi.ai/api/v2/keys/{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.deapi.ai/api/v2/keys/{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_HTTPHEADER => [
"Accept: <accept>",
"Authorization: Bearer <token>"
],
]);
$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.deapi.ai/api/v2/keys/{id}/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Accept", "<accept>")
req.Header.Add("Authorization", "Bearer <token>")
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.deapi.ai/api/v2/keys/{id}/usage")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/keys/{id}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"from": "2026-09-15T00:00:00+00:00",
"to": "2026-09-22T00:00:00+00:00",
"group_by": "day",
"currency": "USD",
"totals": {
"cost": 12.345678,
"requests": 830,
"errors": 4
},
"groups": [
{
"cost": 12.345678,
"requests": 830,
"errors": 4,
"key": "2026-09-21",
"name": "<string>"
}
]
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123,
"code": "missing_key"
}{
"message": "This API key does not have permission to access this endpoint.",
"code": "insufficient_permissions"
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123,
"code": "missing_key"
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123,
"code": "missing_key"
}{
"message": "Too Many Attempts."
}Requires an ADMIN key. An API key gets
403 with code: insufficient_permissions — see API Keys.Authorizations
Sanctum personal access token, sent as Authorization: Bearer <token>. The token is opaque — it carries no claims and no embedded expiry, so do not attempt to decode it. Issue and revoke tokens from your account dashboard.
Headers
Available options:
application/json Path Parameters
Query Parameters
Start of the range, UTC, inclusive. Default: 7 days before to. Cannot be older than the data retention (90 days).
Example:
"2026-09-15T00:00:00Z"
End of the range, UTC, exclusive. Default: now. An hourly breakdown covers at most 31 days.
Example:
"2026-09-22T00:00:00Z"
Available options:
day, hour, type, model Response
The report.
Show child attributes
Show child attributes
Was this page helpful?