Get Usage Statistics
curl --request GET \
--url https://api.spidra.io/api/usage-stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.spidra.io/api/usage-stats"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.spidra.io/api/usage-stats', 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.spidra.io/api/usage-stats",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.spidra.io/api/usage-stats"
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))
}HttpResponse<String> response = Unirest.get("https://api.spidra.io/api/usage-stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/usage-stats")
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_body{
"status": "success",
"data": [
{
"label": "Dec 12",
"date": "2025-12-12",
"tokens": 3500,
"requests": 15,
"crawls": 2,
"captchas": 3,
"latency": 4200,
"credits": 20
}
]
}{
"status": "error",
"message": "Invalid or missing range"
}{
"status": "error",
"message": "Access token invalid or expired"
}Account
Get Usage Statistics
Retrieve time-series usage data for your account, including requests, tokens, crawls, and credit consumption over a chosen period.
GET
/
usage-stats
Get Usage Statistics
curl --request GET \
--url https://api.spidra.io/api/usage-stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.spidra.io/api/usage-stats"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.spidra.io/api/usage-stats', 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.spidra.io/api/usage-stats",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.spidra.io/api/usage-stats"
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))
}HttpResponse<String> response = Unirest.get("https://api.spidra.io/api/usage-stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/usage-stats")
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_body{
"status": "success",
"data": [
{
"label": "Dec 12",
"date": "2025-12-12",
"tokens": 3500,
"requests": 15,
"crawls": 2,
"captchas": 3,
"latency": 4200,
"credits": 20
}
]
}{
"status": "error",
"message": "Invalid or missing range"
}{
"status": "error",
"message": "Access token invalid or expired"
}This endpoint returns aggregated usage metrics for your account over a selected time window. Use it to build usage dashboards, monitor credit burn rate, or understand how your workloads are distributed across days and weeks.
Time Ranges
Pass therange query parameter to select the window you want:
| Value | Description |
|---|---|
7d | Last 7 days, one data point per day |
30d | Last 30 days, one data point per day |
weekly | Last 7 weeks, one data point per week |
# Last 7 days
curl "https://api.spidra.io/api/usage-stats?range=7d" \
-H "Authorization: Bearer YOUR_API_KEY"
# Last 30 days
curl "https://api.spidra.io/api/usage-stats?range=30d" \
-H "Authorization: Bearer YOUR_API_KEY"
# Weekly summary (last 7 weeks)
curl "https://api.spidra.io/api/usage-stats?range=weekly" \
-H "Authorization: Bearer YOUR_API_KEY"
import requests
# Last 7 days
response = requests.get(
"https://api.spidra.io/api/usage-stats",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"range": "7d"}
)
# Last 30 days
response = requests.get(
"https://api.spidra.io/api/usage-stats",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"range": "30d"}
)
# Weekly summary (last 7 weeks)
response = requests.get(
"https://api.spidra.io/api/usage-stats",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"range": "weekly"}
)
// Last 7 days
const response = await fetch(
"https://api.spidra.io/api/usage-stats?range=7d",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
// Last 30 days
const response = await fetch(
"https://api.spidra.io/api/usage-stats?range=30d",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
// Weekly summary (last 7 weeks)
const response = await fetch(
"https://api.spidra.io/api/usage-stats?range=weekly",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
Response Fields
Each item in thedata array represents one time period.
| Field | Type | Description |
|---|---|---|
label | string | Display label for this period, suitable for chart axes. For example: "Mon", "Dec 12", or "Week 50" |
date | string | The date or date range this data point covers |
requests | number | Number of scrape requests made in this period |
crawls | number | Number of crawl jobs started in this period |
tokens | number | Total AI tokens consumed (input and output combined) |
captchas | number | Number of CAPTCHAs solved in this period |
latency | number | Average response latency in milliseconds |
credits | number | Credits consumed in this period |
Example Response
{
"status": "success",
"data": [
{
"label": "Dec 11",
"date": "2025-12-11",
"requests": 42,
"crawls": 3,
"tokens": 58400,
"captchas": 6,
"latency": 4100,
"credits": 89
},
{
"label": "Dec 12",
"date": "2025-12-12",
"requests": 15,
"crawls": 2,
"tokens": 21700,
"captchas": 1,
"latency": 3900,
"credits": 32
}
]
}
Errors
If you omit therange parameter or pass an unsupported value, the API returns a 400 error:
{
"status": "error",
"message": "Invalid or missing range"
}
For a full explanation of what each metric means and how to read your usage data, see the Usage and Analytics guide.
Authorizations
BearerAuthApiKeyAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Time range: '7d' (last 7 days), '30d' (last 30 days), or 'weekly' (last 7 weeks)
Available options:
7d, 30d, weekly Was this page helpful?

