```yaml
product: AlterLab
title: "How to Migrate from ScraperAPI to AlterLab: Step-by-Step Guide (2026)"
category: Tutorials
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
last_updated: 2026-05-16
canonical_facts:
  - "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."
source_url: https://alterlab.io/blog/how-to-migrate-from-scraperapi-to-alterlab-step-by-step-guide-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](/vs/scraperapi).

## Prerequisites

You only need three things to complete this migration:
1. An AlterLab account. [Sign up for free here](/signup).
2. Your AlterLab API key from the dashboard.
3. 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.

1. **Install SDK** — 
2. **Replace API calls** — 
3. **Update API key** — 
4. **Test and deploy** — 

## 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](/docs/quickstart/installation).

```bash title="Terminal — Install AlterLab"
pip install alterlab
```

If 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.

```python title="before_scraperapi.py"
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)
```

```python title="after_alterlab.py" {3-7}
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, use `min_tier=3`. Tiers 3 through 5 use headless browsers.
*   **Country Targeting**: ScraperAPI uses `country_code=us`. AlterLab uses `country='us'`.
*   **Premium Proxies**: ScraperAPI uses `premium=true`. AlterLab handles this via tiers. Use `min_tier=2` for residential proxies or `min_tier=5` for 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.

```python title="response_handling.py"
# 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.

```python title="error_handling.py"
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.

- **$0.0002** — Per Request (AlterLab)
- **$0** — Monthly Minimum
- **Never** — Balance Expiry

For a full breakdown of request costs across different tiers, visit [AlterLab pricing](/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.

## Frequently Asked Questions

### How long does it take to migrate from ScraperAPI to AlterLab?

Most migrations take under an hour. The SDKs follow similar patterns, so you only need to update your client initialization, API key, and response attribute names.

### Will my existing ScraperAPI code work with AlterLab?

You will need to replace the client library, but the logic remains identical. AlterLab provides a similar REST API and Python SDK that maps directly to ScraperAPI's functionality.

### How does AlterLab pricing compare to ScraperAPI?

AlterLab uses a pay-as-you-go model starting at $0.0002 per request with no monthly minimums. Unlike ScraperAPI, your balance never expires and there is no $49 monthly subscription requirement.

## Related

- [Lowe's Data API: Extract Structured JSON in 2026](<https://alterlab.io/blog/lowe-s-data-api-extract-structured-json-in-2026>)
- [How to Migrate from Scrapfly to AlterLab: Step-by-Step Guide \(2026\)](<https://alterlab.io/blog/how-to-migrate-from-scrapfly-to-alterlab-step-by-step-guide-2026>)
- [Scaling Web Scraping Pipelines for High-Volume Data](<https://alterlab.io/blog/scaling-web-scraping-pipelines-for-high-volume-data>)