Rayobyte Documentation
  • Web Scraper API
    • Getting Started
    • Features
      • Proxy Geolocation
      • JavaScript Rendering
      • Custom Headers and Cookies
    • Billing & Usage
      • How We Charge You
      • Statistics
    • Reference
      • Response Codes
      • Timeout Settings
Powered by GitBook
On this page
  • 1. Get Your Credit Balance
  • 2. Get Daily Usage Statistics
  • Support
  1. Web Scraper API
  2. Billing & Usage

Statistics

Keeping track of your API credits ensures you're always prepared for your scraping tasks without interruptions. Rayobyte’s API provides two straightforward endpoints to check your current balance and review daily usage stats. Let’s dive into how to use them!


1. Get Your Credit Balance

This endpoint provides an instant overview of how many credits you have remaining in your account.

API Call Examples

curl 'https://api.scraping.rayobyte.com/balance?token=<API-KEY>'
const axios = require('axios');

// Define the API URL and parameters
const url = 'https://api.scraping.rayobyte.com/balance';
const params = { token: '<API-KEY>' };

// Make the GET request
axios.get(url, { params })
    .then(response => {
        console.log("Response:", response.data);
    })
    .catch(error => {
        if (error.response) {
            console.error(`Error: ${error.response.status} - ${error.response.data}`);
        } else {
            console.error(`Error: ${error.message}`);
        }
    });
https://api.scraping.rayobyte.com/balance?token=<API-KEY>
import requests

# Define the API URL and token
url = "https://api.scraping.rayobyte.com/balance"
params = {
    "token": "<API-KEY>"
}

try:
    # Make the GET request
    response = requests.get(url, params=params)
    response.raise_for_status()  # Raise HTTPError for bad responses (4xx and 5xx)
    print("Response:", response.json())
except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err} - {response.text}")
except requests.exceptions.RequestException as err:
    print(f"Error occurred: {err}")

Output Example

{
  "status": "SUCCESS",
  "date": "Fri, 01 May 2020 00:00:00 GMT",
  "token": "abcdef-0123-4567-89ab-cdef01234567",
  "credits": 120
}

What It Means

  • status: Indicates if the request succeeded.

  • date: Timestamp of the API response.

  • token: Your account’s unique identifier.

  • credits: Your remaining API credits.


2. Get Daily Usage Statistics

Want to see how you're doing? The stats endpoint provides a breakdown of your credit usage over a specified time period. You can customize the report by setting the type parameter to one of the following values:

  • daily: Retrieves usage data for each day.

  • weekly: Retrieves usage data for each week.

  • monthly: Retrieves usage data for each month.

API Call Example:

curl 'https://api.scrapingrobot.com/stats?token=<API-KEY>&type=daily'
const axios = require('axios');

// Define the API URL and parameters
const url = 'https://api.scraping.rayobyte.com/stats';
const params = { 
    token: '<API-KEY>', 
    type: 'daily' 
};

// Make the GET request
axios.get(url, { params })
    .then(response => {
        console.log("Response:", response.data);
    })
    .catch(error => {
        if (error.response) {
            console.error(`Error: ${error.response.status} - ${error.response.data}`);
        } else {
            console.error(`Error: ${error.message}`);
        }
    });
https://api.scrapingrobot.com/stats?token=<API-KEY>&type=daily
import requests

# Define the API URL and token
url = "https://api.scraping.rayobyte.com/stats"
params = {
    "token": "<API-KEY>",
    "type": "daily"
}

try:
    # Make the GET request
    response = requests.get(url, params=params)
    response.raise_for_status()  # Raise HTTPError for bad responses (4xx and 5xx)
    print("Response:", response.json())
except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err} - {response.text}")
except requests.exceptions.RequestException as err:
    print(f"Error occurred: {err}")

Output Example

{
  "status": "SUCCESS",                      
  "date": "Fri, 01 May 2024 00:00:00 GMT",  
  "token": "abcdef-0123-4567-89ab-cdef01234567",                 
  "result": {                               
    "Sat May 09 2024": 0,
    "Fri May 08 2024": 3,
    "Thu May 07 2024": 0,
    "Wed May 06 2024": 144,
    "Tue May 05 2024": 12,
    "Mon May 04 2024": 43,
    "Sun May 03 2024": 1
  }
}

Support

PreviousHow We Charge YouNextReference

Last updated 5 months ago

Need help or have questions about these calls? Reach out via our . We're here to help!

support portal