Usage
Returns usage totals for a date range or for all time.
GET /v1/usageQuery Parameters
date_from
string
No
First day to include, as YYYY-MM-DD
date_to
string
No
Last day to include, as YYYY-MM-DD
Both days are included in the range.
Days are calendar days in UTC.
Omit both parameters to get totals for all time.
Send only one for an open range. For example,
date_fromalone counts from that day onward.
curl "https://scrape.iproyal.com/v1/usage?date_from=2026-09-01&date_to=2026-09-30" \
-H "Authorization: Bearer $WEB_SCRAPER_API_TOKEN"<?php
$query = http_build_query(['date_from' => '2026-09-01', 'date_to' => '2026-09-30']);
$ch = curl_init('https://scrape.iproyal.com/v1/usage?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('WEB_SCRAPER_API_TOKEN'),
],
]);
$usage = json_decode(curl_exec($ch), true);
$successRate = $usage['total'] > 0 ? $usage['successful'] / $usage['total'] : 0;
printf("%d requests, %.1f%% successful, %d credits used\n", $usage['total'], $successRate * 100, $usage['credits']);import os
import requests
response = requests.get(
"https://scrape.iproyal.com/v1/usage",
headers={"Authorization": f"Bearer {os.environ['WEB_SCRAPER_API_TOKEN']}"},
params={"date_from": "2026-09-01", "date_to": "2026-09-30"},
timeout=30,
)
response.raise_for_status()
usage = response.json()
success_rate = usage["successful"] / usage["total"] if usage["total"] else 0
print(f"{usage['total']} requests, {success_rate:.1%} successful, {usage['credits']} credits used")Response
{
"date_from": "2026-09-01",
"date_to": "2026-09-30",
"total": 1580,
"successful": 1492,
"failed": 88,
"credits": 1492,
"latency": 6840,
"by_request_type": {
"page": 1210,
"serp": 320,
"image": 50
},
"by_status": {
"success": 1492,
"bot_blocked": 61,
"no_data_extracted": 9,
"target_unavailable": 12,
"upstream_unavailable": 6
}
}date_from
string or null
The start day you sent. null if you did not send one.
date_to
string or null
The end day you sent. null if you did not send one.
total
integer
Requests in the range
successful
integer
Requests that delivered content
failed
integer
total minus successful
credits
integer
Credits used. Failed requests are refunded, so this usually equals successful.
latency
integer
Average processing time per request, in milliseconds
by_request_type
object
Requests per type: page for universal, serp for google, and image
by_status
object
Requests per status. See the table below.
Types and statuses with no requests are left out of by_request_type and by_status. To get the success rate, divide successful by total.
Request Statuses
success
The content was delivered, including target pages that answered 404 or 410
200
Yes
bot_blocked
The target website's anti-bot protection blocked the request
422 blocked
No
no_data_extracted
parse was on, but no structured data was found
422 no_data_extracted
No
not_found
No image was found at the URL
404 not_found
No
target_unavailable
The target website was down or did not respond
502 upstream_unavailable
No
rate_limited
The service was at full capacity
503 capacity_exceeded
No
upstream_unavailable
The request could not be completed on IPRoyal's side
502 upstream_unavailable
No
What Is Counted
Usage counts requests that reached the scraping stage. Requests rejected up front are not counted. This covers validation, authentication, balance, and concurrency limit errors.
A finished request appears in usage after a few seconds.
Errors
HTTP Status
error.code
When
400
invalid_request
A date is not a valid YYYY-MM-DD day, or date_from is later than date_to
401
invalid_token
The token is missing or not recognized
403
account_suspended or account_disabled
Your account cannot make requests
502
upstream_unavailable
Usage data is temporarily unavailable. Retry later.
Last updated
Was this helpful?