const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.context.dev/v1/org/usage/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.context.dev/v1/org/usage/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/org/usage/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/org/usage/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/org/usage/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request GET \
--url https://api.context.dev/v1/org/usage/history \
--header 'Authorization: Bearer <token>'{
"data": [
{
"start": "2026-09-29T00:00:00.000Z",
"credits_used": 1250,
"request_count": 830,
"groups": [
{
"value": "/v1/web/scrape",
"credits_used": 1000,
"request_count": 500
},
{
"value": "/v1/brand/retrieve",
"credits_used": 250,
"request_count": 330
}
]
},
{
"start": "2026-09-30T00:00:00.000Z",
"credits_used": 0,
"request_count": 0,
"groups": []
}
],
"total_credits_used": 1250,
"total_request_count": 830,
"interval": "day",
"from": "2026-09-29T00:00:00.000Z",
"to": "2026-09-30T23:59:59.999Z",
"key_metadata": {
"credits_consumed": 0,
"credits_remaining": 41250
},
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91"
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}Retrieve usage history
Retrieve credits and requests over time, bucketed by hour, day, or month. History is kept for one year.
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.context.dev/v1/org/usage/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.context.dev/v1/org/usage/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/org/usage/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/org/usage/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/org/usage/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request GET \
--url https://api.context.dev/v1/org/usage/history \
--header 'Authorization: Bearer <token>'{
"data": [
{
"start": "2026-09-29T00:00:00.000Z",
"credits_used": 1250,
"request_count": 830,
"groups": [
{
"value": "/v1/web/scrape",
"credits_used": 1000,
"request_count": 500
},
{
"value": "/v1/brand/retrieve",
"credits_used": 250,
"request_count": 330
}
]
},
{
"start": "2026-09-30T00:00:00.000Z",
"credits_used": 0,
"request_count": 0,
"groups": []
}
],
"total_credits_used": 1250,
"total_request_count": 830,
"interval": "day",
"from": "2026-09-29T00:00:00.000Z",
"to": "2026-09-30T23:59:59.999Z",
"key_metadata": {
"credits_consumed": 0,
"credits_remaining": 41250
},
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91"
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"required_permission": "logs:read",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}logs:read permission. See the guide for examples and usage.Authorizations
Send Authorization: Bearer <API_KEY>. Keys have full access unless restricted to scopes.
Query Parameters
Start of the range, as an ISO 8601 timestamp. Defaults to 24 hours before to for hour, 30 days for day, and 366 days for month.
"2026-09-01T00:00:00Z"
End of the range, as an ISO 8601 timestamp. Defaults to now.
"2026-10-01T00:00:00Z"
Bucket size. hour covers up to 7 days; day and month cover up to 366 days. Buckets start on UTC boundaries.
hour, day, month Split each bucket by endpoint path, API key, or HTTP status code.
path, key_id, status_code Response
Usage over time
One bucket per interval, oldest first. Intervals without usage are included with zero totals.
Show child attributes
Show child attributes
Credits charged across the range.
Requests made across the range.
Bucket size used.
hour, day, month Start of the range.
End of the range.
Unique ID of this request, also in X-Request-Id. Include it when contacting support.
"3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91"
Credits this request used and your remaining balance.
Show child attributes
Show child attributes
Was this page helpful?