
How to Migrate from ScraperAPI to AlterLab: Step-by-Step Guide (2026)
Learn how to migrate from ScraperAPI to AlterLab in under an hour. This guide covers SDK installation, code changes, and cost comparison for pay-as-you-go scraping.
May 16, 2026
The primary drivers for developers migrating from ScraperAPI to AlterLab are the removal of monthly subscription fees and the elimination of credit expiry. ScraperAPI requires a $49 monthly minimum spend, and unused credits disappear at the end of each billing cycle. AlterLab moves this to a pure pay-as-you-go model where your balance never expires.
Both APIs are capable tools for web data extraction. This guide is for developers prioritizing pay-as-you-go pricing and no subscription requirements. For a deep dive into feature differences, read our detailed ScraperAPI comparison.
Prerequisites
You only need three things to complete this migration:
- An AlterLab account. Sign up for free here.
- Your AlterLab API key from the dashboard.
- Access to your existing scraping codebase.
The migration typically takes 5 to 10 minutes for simple scripts and under an hour for complex production pipelines.
Step 1: Install the AlterLab SDK
If you currently use the ScraperAPI Python library, you can switch to the AlterLab SDK. This handles proxy rotation, retries, and browser rendering automatically. For more installation options, see our Getting started guide.
pip install alterlabIf you prefer using the REST API directly via requests or curl, the transition is even simpler as the endpoint structure is almost identical.
Step 2: Replace your API calls
AlterLab's Python SDK is designed to be familiar. You initialize a client with your API key and call the scrape method.
Compare the before and after examples below.
import scraperapi
# Initializing ScraperAPI
client = scraperapi.ScraperAPIClient('YOUR_SCRAPER_API_KEY')
# Performing a scrape
response = client.get(url='https://example.com', render=True)
# Accessing content
print(response.text)import alterlab
# Initializing AlterLab
client = alterlab.Client("YOUR_ALTERLAB_API_KEY")
# Performing a scrape
# min_tier=3 enables JavaScript rendering
response = client.scrape("https://example.com", min_tier=3)
# Accessing content
print(response.text)Parameter Mapping
When migrating, you may need to map specific ScraperAPI flags to AlterLab parameters.
- JavaScript Rendering: In ScraperAPI, you use
render=true. In AlterLab, usemin_tier=3. Tiers 3 through 5 use headless browsers. - Country Targeting: ScraperAPI uses
country_code=us. AlterLab usescountry='us'. - Premium Proxies: ScraperAPI uses
premium=true. AlterLab handles this via tiers. Usemin_tier=2for residential proxies ormin_tier=5for advanced anti-bot bypass including CAPTCHA solving.
Step 3: Handle response format differences
The core content of the response remains the same. If you are scraping HTML, response.text gives you the raw source. However, if you are using JSON output, there is a slight structural difference in the return object.
AlterLab allows you to request multiple formats in a single request, such as JSON and Markdown.
# AlterLab can return structured data directly
response = client.scrape(
"https://example.com/product",
formats=["json", "markdown"]
)
# Accessing specific formats
data = response.json()
markdown_content = data.get("markdown")ScraperAPI typically returns the raw HTML body. AlterLab provides a cleaner data structure, especially when using Cortex AI to extract specific fields without CSS selectors.
Step 4: Update your error handling
ScraperAPI and AlterLab both use standard HTTP status codes.
- 200: Success.
- 403: Invalid API key or exhausted balance.
- 429: Rate limit exceeded.
- 500: Remote server error or scraping failure.
The AlterLab SDK includes an internal circuit breaker and automatic retry logic for 429 and 500 errors. You can usually remove manual retry loops from your ScraperAPI implementation.
try:
response = client.scrape("https://target-site.com")
response.raise_for_status()
except Exception as e:
print(f"Scrape failed: {e}")Cost Comparison
ScraperAPI uses a monthly subscription model. If you do not use your credits, they expire. If you need more credits, you must upgrade to a higher monthly tier.
AlterLab uses a flat rate per request. You pay for what you use. If you scrape 100 pages this month and 10,000 next month, your costs scale exactly with your usage. There are no monthly fees to keep your account active.
For a full breakdown of request costs across different tiers, visit AlterLab pricing.
Common issues and fixes
1. JavaScript not loading
If your ScraperAPI code used render=true and the page isn't loading correctly in AlterLab, ensure you are using min_tier=3 or higher. Tier 1 and Tier 2 are for static HTML (curl-based) and do not execute JavaScript.
2. API Key environment variables
Ensure you update your .env or CI/CD secrets. Developers often replace the library but forget to update the SCRAPERAPI_KEY environment variable to ALTERLAB_API_KEY.
3. Header handling
ScraperAPI often requires custom headers to be passed as headers={...}. AlterLab does the same, but it automatically manages User-Agents and browser headers by default to maximize success rates. You can usually remove your custom User-Agent strings.
You're done
Migrating to AlterLab gives you more control over your scraping costs without sacrificing technical capabilities. You now have access to features like Cron-based scheduling, change monitoring, and AI-powered extraction.
If you have specific edge cases or need help with a large-scale migration, check the full documentation or reach out to our engineering team.
AlterLab // Web Data, Simplified.
Was this article helpful?
Frequently Asked Questions
Related Articles
Popular Posts
Recommended
Newsletter
Scraping insights and API tips. No spam.
Recommended Reading

Selenium Bot Detection: Why You Get Flagged and How to Fix It

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

How to Scrape Indeed: Complete Guide for 2026

How to Scrape Cloudflare-Protected Sites in 2026
Stay in the Loop
Get scraping insights, API tips, and platform updates. No spam — we only send when we have something worth reading.


