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

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

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.

4 min read
6 views

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

Try it free

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.

Prerequisites

Before starting, ensure you have the following:

  • An AlterLab account (create one for free at alterlab.io/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
pip install alterlab

For a more comprehensive setup, refer to our Getting started guide.

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
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
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.0002Per Request (AlterLab)
$0Monthly Minimum
NeverBalance Expiry

For a full breakdown of costs per tier, visit AlterLab 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.

Share

Was this article helpful?

Frequently Asked Questions

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.
While the SDKs differ slightly, the core request-response flow is nearly identical. Your existing URL targets and data parsing logic remain unchanged.
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.