```yaml
product: AlterLab
title: "How to Migrate from Scrapfly to AlterLab: Step-by-Step Guide (2026)"
category: Tutorials
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
last_updated: 2026-07-13
canonical_facts:
  - Learn how to migrate from Scrapfly to AlterLab in under an hour. Switch to pay-as-you-go pricing with this practical guide for Python and REST API users.
source_url: https://alterlab.io/blog/how-to-migrate-from-scrapfly-to-alterlab-step-by-step-guide-2026
```

## TL;DR
To migrate from Scrapfly to AlterLab, install the `alterlab` Python SDK, replace the `ScrapflyClient` with `alterlab.Client`, and update your API key in your environment variables. Because both services use similar REST API structures, your existing scraping logic and URL targets require zero modification.

## Why migrate?
Many developers find Scrapfly's credit-based subscription plans restrictive, particularly as credits are consumed at different rates depending on the tier used. This often leads to overpaying for unused credits or running out of balance mid-project.

AlterLab solves this by removing the subscription requirement entirely. You pay only for what you use, your balance never expires, and there are no monthly minimums. Both APIs are capable, but this guide is for developers prioritizing pay-as-you-go pricing and no subscription requirements. For a deeper dive, see our [detailed Scrapfly comparison](/vs/scrapfly).

## Prerequisites
Before starting, ensure you have the following:
*   An AlterLab account (create one for [free at alterlab.io/signup](/signup))
*   Your AlterLab API key from the dashboard
*   5 minutes of development time

## Step 1: Install the AlterLab SDK
If you are using Python, you can use our lightweight SDK. If you prefer raw HTTP requests, you can use the REST API directly via `curl` or `requests`.

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

For a more comprehensive setup, refer to our [Getting started guide](/docs/quickstart/installation).

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

## Step 2: Replace your API calls
The transition is a straightforward swap of the client initialization and the scrape method. AlterLab simplifies the request process by removing the need for a separate configuration object for basic scrapes.

### Python SDK Migration
Compare the two implementations below. Note how the `ScrapeConfig` is replaced by direct parameters in the `scrape` method.

```python title="before_scrapfly.py"
from scrapfly import ScrapflyClient, ScrapeConfig

client = ScrapflyClient("SF_API_KEY")
config = ScrapeConfig(
    url="https://example.com",
    asp=True,
    render_js=True
)
response = client.scrape(config)
print(response.content)
```

```python title="after_alterlab.py" {4-6}
import alterlab

client = alterlab.Client("ALTERLAB_API_KEY")
# Use min_tier=3 for JavaScript rendering (equivalent to render_js=True)
response = client.scrape("https://example.com", min_tier=3)
print(response.text)
```

### REST API Migration
If you are using `curl` or a generic HTTP client, you only need to change the endpoint and the parameter names.

**Scrapfly Endpoint:**
`https://api.scrapfly.io/scrape?key=KEY&url=URL&asp=true`

**AlterLab Endpoint:**
`https://api.alterlab.io/scrape?api_key=KEY&url=URL`

## Step 3: Handle response format differences
Both services return the page content, but the object attributes differ slightly.

*   **Scrapfly**: Uses `.content` for the HTML body.
*   **AlterLab**: Uses `.text` for the HTML body.

If you are using AlterLab's **Formats** feature, you can request `json`, `markdown`, or `text` directly in the API call, which eliminates the need for manual cleaning in your post-processing pipeline.

## Step 4: Update your error handling
AlterLab uses standard HTTP status codes. If you have a retry loop based on Scrapfly's specific error codes, update them to handle standard 4xx and 5xx responses.

Common status codes to monitor:
*   `401`: Invalid API key.
*   `402`: Insufficient balance.
*   `429`: Rate limit reached.

## Cost comparison
The primary driver for this migration is the billing model. Scrapfly requires a monthly commitment to maintain certain tiers. AlterLab removes the monthly overhead.

Example: 10,000 standard requests.

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

For a full breakdown of costs per tier, visit [AlterLab pricing](/pricing).

## Common issues and fixes
*   **JS Rendering not working**: If a page requires JavaScript, ensure you set `min_tier=3`. This tells the engine to skip basic curl and go straight to a headless browser.
*   **Timeout errors**: If you are scraping heavy pages, increase your client timeout. AlterLab's automatic escalation can take a few extra seconds to find the optimal proxy.
*   **Response encoding**: AlterLab returns UTF-8 by default. If you see encoding issues, ensure your environment is set to handle UTF-8 strings.

## You're done
Your migration is complete. You can now run your scrapers without worrying about monthly credit expiration or tiered consumption rates.

For more advanced features like **Cortex AI** for structured data extraction or **Webhooks** for push notifications, check our documentation.

Hit reply if you have questions.

AlterLab // Web Data, Simplified.

## Frequently Asked Questions

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

Most developers complete the migration in under 30 minutes. Since the REST API patterns are similar, you only need to update your API key and client initialization.

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

While the SDKs differ slightly, the core request-response flow is nearly identical. Your existing URL targets and data parsing logic remain unchanged.

### How does AlterLab pricing compare to Scrapfly?

AlterLab uses a pure pay-as-you-go model starting at $0.0002 per request with no monthly subscriptions, whereas Scrapfly uses credit-based plans that expire.

## Related

- [Weekly Product Roundup: SDK Drift Fix, CI Unblocking, Session Security & WAF Improvements](<https://alterlab.io/blog/weekly-product-roundup-sdk-drift-fix-ci-unblocking-session-security-waf-improvements>)
- [Understanding MCP Servers: Connecting AI to the Real-Time Web](<https://alterlab.io/blog/understanding-mcp-servers-connecting-ai-to-the-real-time-web>)
- [Building a RAG Pipeline with Live Web Data](<https://alterlab.io/blog/building-a-rag-pipeline-with-live-web-data>)