Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Usage History

Returns your individual requests, newest first.

GET /v1/usage/history

Query Parameters

Parameter
Type
Required
Description

limit

integer

No

Items per page, from 1 to 100. Defaults to 100.

offset

integer

No

Number of items to skip. Defaults to 0.

The cURL example reads one page. The other examples read every page and remove duplicates.

curl "https://scrape.iproyal.com/v1/usage/history?limit=100&offset=0" \
  -H "Authorization: Bearer $WEB_SCRAPER_API_TOKEN"
<?php

const LIMIT = 100;

$seen = [];
$offset = 0;

do {
    $query = http_build_query(['limit' => LIMIT, 'offset' => $offset]);
    $ch = curl_init('https://scrape.iproyal.com/v1/usage/history?' . $query);

    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('WEB_SCRAPER_API_TOKEN'),
        ],
    ]);

    $page = json_decode(curl_exec($ch), true);

    foreach ($page['items'] as $item) {
        if (!isset($seen[$item['job_id']])) {
            $seen[$item['job_id']] = true;
            echo $item['created_at'] . ' ' . $item['status'] . ' ' . $item['target'] . PHP_EOL;
        }
    }

    $offset += LIMIT;
} while ($page['count'] === LIMIT);

Response

{
  "count": 2,
  "total": 1580,
  "items": [
    {
      "request_type": "page",
      "status": "success",
      "status_code": 200,
      "target": "https://example.com/products/42",
      "geo_location": "de",
      "job_id": "84e647f3-c72f-479b-9285-5c5903cad2dc",
      "credit_deducted": true,
      "credits": 1,
      "created_at": "2026-10-06 09:15:02"
    },
    {
      "request_type": "serp",
      "status": "bot_blocked",
      "status_code": 422,
      "target": "running shoes",
      "geo_location": "",
      "job_id": "7e842747-2a53-440d-aaac-de648bae1c5e",
      "credit_deducted": false,
      "credits": 0,
      "created_at": "2026-10-06 09:14:40"
    }
  ]
}
Field
Type
Description

count

integer

Items on this page

total

integer

All requests on your account, for all time

items

array

Requests, newest first

Each item has these fields:

Field
Type
Description

request_type

string

page for universal, serp for google, or image

status

string

The outcome. Usage lists every status.

status_code

integer

For success, the HTTP status the target website returned. Otherwise, the HTTP status IPRoyal returned to you.

target

string

The URL, or the search keywords for serp

geo_location

string

The country code you sent. Empty if you did not send one.

job_id

string

The job_id from the Scraping response

credit_deducted

boolean

Whether the request was charged

credits

integer

Credits charged for the request: 1 or 0

created_at

string

When the request started, in UTC, as YYYY-MM-DD HH:MM:SS

Pagination

Increase offset by limit until count is less than limit.

New requests appear at the top of the list. If you page while you are scraping, an item can show up on two pages. Remove duplicates by job_id.

Retention and Freshness

Usage History keeps requests from the last 12 months. total counts all requests, including older ones that are no longer listed.

A finished request appears in the history after a few seconds. Only requests that reached the scraping stage are listed. Requests rejected up front never appear and are never charged.

Errors

HTTP Status

error.code

When

400

invalid_request

limit is outside 1 to 100, or offset is negative

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?