Tutorials

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

A practical, copy-paste ready guide to migrate from ZenRows to AlterLab, focusing on pay-as-you-go pricing and minimal code changes.

3 min read
5 views

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

Try it free

TL;DR

To migrate from ZenRows to AlterLab, install the AlterLab SDK, replace your ZenRows client with alterlab.Client, update your API key, and keep the same request structure. The response format is nearly identical, so most of your scraping code remains unchanged.

Why migrate?

ZenRows uses a flat-rate subscription model where credits reset monthly, which can lead to wasted spend if you don’t use your full quota. AlterLab offers a pure pay‑as‑you-go model: you pay only for the requests you make, your balance never expires, and there are no monthly minimums. Both APIs are capable — this guide is for developers prioritizing pay-as-you-go pricing and no subscription requirements.

Prerequisites

  • An AlterLab account (sign up free at [/signup])
  • Your AlterLab API key (found in the dashboard)
  • About 5 minutes to install the SDK and swap a few lines of code

Step 1: Install the AlterLab SDK

If you were using the ZenRows Python package, replace it with the AlterLab SDK. The install command is the same style.

Bash
pip install alterlab

For full setup details, see the Getting started guide.

Step 2: Replace your API calls

ZenRows and AlterLab share a similar REST API shape. Below is a direct before‑and‑after comparison.

Python
# ZenRows (before migration)
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
response = client.get("https://example.com", params={"js_render": true})
html = response.text
Python
# AlterLab (after migration)
import alterlab

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

If you prefer to call the REST endpoint directly, the URL pattern is also compatible:

  • ZenRows: https://api.zenrows.com/v1/?apikey=KEY&url=URL&js_render=true
  • AlterLab: https://api.alterlab.io/v1/?apikey=KEY&url=URL&js_render=true

Step 3: Handle response format differences

AlterLab returns a response object that mirrors ZenRows in the most common fields:

  • response.text – the raw HTML (or selected format)
  • response.status_code – HTTP status
  • response.headers – response headers

The only notable difference is that AlterLab nests error details under response.error when status_code >= 400, whereas ZenRows includes them directly in the JSON body. For successful scrapes, you can treat the objects interchangeably.

Step 4: Update your error handling

Adjust any try/except blocks to check for AlterLab’s error structure.

Python
try:
    response = client.scrape(url)
    if response.status_code != 200:
        raise Exception(f"AlterLab error: {response.error}")
    process(response.text)
except Exception as e:
    # retry logic or alerting
    logger.error(f"Scrape failed: {e}")

Both libraries use standard HTTP status codes (429 for rate limiting, 5xx for server issues), so existing retry logic based on status codes works unchanged.

Cost comparison

To illustrate the financial impact, consider 10,000 scraping requests per month.

$0.0002Per Request (AlterLab)
$0Monthly Minimum
NeverBalance Expiry
  • AlterLab: 10,000 × $0.0002 = $2.00 per month. No subscription, no minimum spend, and unused balance carries over indefinitely.
  • ZenRows: Their lowest flat‑rate plan is $49/month for 10,000 requests (≈ $0.0049/request). If you use fewer than 10,000 requests, you still pay the full $49; unused requests do not roll over.

See the latest pricing on the AlterLab pricing page for volume discounts and tier details.

Common issues and fixes

  • Missing js_render flag – AlterLab uses the same parameter name as ZenRows (js_render=true). If you previously used render_js, rename it.
  • API key environment variable – Rename ZENROWS_API_KEY to ALTERLAB_API_KEY in your .env or CI secrets.
  • Response encoding – AlterLab always returns UTF‑8 decoded text; if you relied on response.content for binary data, use response.raw_content instead.
  • Rate‑limit headers – AlterLab sends X-RateLimit-Remaining and X-RateLimit-Reset (same as ZenRows), so your throttling code needs no change.

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, visit the full 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, only the client initialization and API key need updating.
Yes—AlterLab uses the same REST API format and similar response structure, so you only need to swap the client import and endpoint.
AlterLab charges $0.0002 per request with no subscription and no balance expiry, whereas ZenRows' flat-rate plan starts at $49/month for 10,000 requests (~$0.0049/request).