How to Migrate from ScraperBox to AlterLab: Step-by-Step Guide (2026)
Tutorials

How to Migrate from ScraperBox to AlterLab: Step-by-Step Guide (2026)

Learn how to switch from ScraperBox to AlterLab in under an hour with pay-as-you-go pricing, no subscriptions, and minimal code changes.

4 min read
10 views

AlterLab handles this automaticallyscrape any URL with one API call. No infrastructure required.

Try it free

Both APIs are capable — this guide is for developers prioritizing pay-as-you-go pricing and no subscription requirements.

TL;DR

To migrate from ScraperBox to AlterLab, sign up for a free AlterLab account, install the AlterLab Python SDK, replace your ScraperBox client calls with alterlab.Client, and update your API key. The response format is largely unchanged, so most of your existing code works without modification.

Why migrate?

ScraperBox uses monthly subscription plans with separate pricing for JavaScript rendering add-ons, which can increase costs unpredictably. AlterLab eliminates subscriptions, charges a flat pay-as-you-go rate, and includes JavaScript rendering in the base price, giving you predictable costs and no wasted balance.

Prerequisites

  • An AlterLab account (create one for free at /signup)
  • Your AlterLab API key (found in the dashboard)
  • About 5 minutes of time

Step 1: Install the AlterLab SDK

If you prefer using the official Python SDK, install it with pip. You can also call the REST API directly, but the SDK simplifies authentication and retries.

Bash
pip install alterlab

For more details, see the Getting started guide.

Step 2: Replace your API calls

Below is a side‑by‑side comparison of a typical ScraperBox request and the equivalent AlterLab call. The only changes are the import, client initialization, and the API key.

Python
# ScraperBox (before migration)
import requests

TOKEN = "YOUR_SCRAPERBOX_TOKEN"
url = "https://example.com"

response = requests.get(
    "https://api.scraperbox.com/scrape",
    params={"token": TOKEN, "url": url, "use_browser": True}
)
html = response.text
Python
# AlterLab (after migration)
import alterlab

client = alterlab.Client("YOUR_ALTERLAB_API_KEY")
response = client.scrape("https://example.com", use_browser=True)
html = response.text  # Same data, pay-as-you-go pricing

If you are using the raw REST endpoint, replace the base URL and token name:

Python
import requests

ALTERLAB_TOKEN = "YOUR_ALTERLAB_API_KEY"
url = "https://example.com"

response = requests.get(
    "https://api.alterlab.io/v1/scrape",
    params={"token": ALTERLAB_TOKEN, "url": url, "use_browser": True}
)
html = response.text

Step 3: Handle response format differences

AlterLab returns a JSON object with the same top‑level fields as ScraperBox: text (or html), status_code, and headers. The only difference is that AlterLab nests error details under an error key when status_code is not 200, whereas ScraperBox returned a plain error body. Check response.status_code before accessing response.text.

Python
if response.status_code == 200:
    html = response.text
else:
    # AlterLab returns structured error info
    print(f"Error {response.status_code}: {response.json().get('error')}")

Step 4: Update your error handling

Both services use HTTP status codes to signal problems. AlterLab uses 429 for rate limiting and 402 for insufficient balance. Your existing retry logic based on status codes will work unchanged; just ensure you treat 402 as a signal to top up your balance rather than an authentication error.

Python
import time
import alterlab

client = alterlab.Client("YOUR_ALTERLAB_API_KEY")
max_retries = 3
for attempt in range(max_retries):
    response = client.scrape("https://example.com")
    if response.status_code == 200:
        break
    if response.status_code == 429:
        time.sleep(2 ** attempt)  # exponential backoff
    elif response.status_code == 402:
        raise Exception("Insufficient AlterLab balance")
    else:
        raise Exception(f"Request failed: {response.status_code}")

Cost comparison

Consider a scenario of 10,000 requests per month with JavaScript rendering enabled.

$0.0002Per Request (AlterLab)
$0Monthly Minimum
NeverBalance Expiry
  • AlterLab: 10,000 × $0.0002 = $2.00 per month, no subscription, balance never expires.
  • ScraperBox (based on public pricing): $20 monthly subscription + $0.001 per request for JavaScript rendering = $20 + (10,000 × $0.001) = $30 per month.

See the full breakdown on the AlterLab pricing page.

Common issues and fixes

  • Missing use_browser parameter: AlterLab defaults to false. Add use_browser=True for sites that require JavaScript.
  • API key environment variable: If you stored your ScraperBox token in SCRAPERBOX_TOKEN, rename it to ALTERLAB_API_KEY or update your code to read the new variable.
  • Response encoding: AlterLab always returns UTF‑8 text. If you relied on ScraperBox’s automatic encoding detection, explicitly decode with response.text.encode('utf-8') if needed.
  • Rate limit headers: AlterLab sends X-RateLimit-Remaining and X-RateLimit-Reset. Adjust any logic that scraped these headers from ScraperBox.

You're done

Your migration is complete. Run your test suite to confirm everything works, then deploy. For more advanced features like scheduling, webhooks, or Cortex AI extraction, refer to the documentation. If you hit any snags, hit reply if you have questions.

AlterLab // Web Data, Simplified.

Share

Was this article helpful?

Frequently Asked Questions

Typically under an hour. Most existing code stays the same; you only need to install the AlterLab SDK, swap the API key, and update the client call.
Yes. AlterLab uses the same REST API structure and returns a similar response format, so the Python SDK migration is straightforward with minimal changes.
AlterLab charges $0.0002 per request with no monthly minimum and no balance expiry, while ScraperBox requires a subscription plus separate fees for JavaScript rendering add-ons.