Tutorials

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

Learn how to migrate from Crawlbase to AlterLab in under 60 minutes. Follow this technical guide to unify your JS/HTML requests and switch to pay-as-you-go pricing.

5 min read
60 views

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

Try it free

TL;DR: To migrate from Crawlbase to AlterLab, install the alterlab SDK, replace your Crawlbase API endpoint/token with the AlterLab client, and use a single API key for both standard HTML and JavaScript-rendered pages.

Both APIs are capable — this guide is for developers prioritizing pay-as-you-go pricing and no subscription requirements.

Why migrate?

The primary driver for migrating from Crawlbase to AlterLab is the complexity of managing different token types. In Crawlbase, you must manage separate tokens for standard HTML scraping and JavaScript-heavy rendering. This lack of a unified SDK often leads to fragmented codebases and complicated logic to decide which token to use for a specific URL.

AlterLab unifies these into a single request. Whether you need a simple GET request or a heavy-duty browser-based scrape to bypass Cloudflare, you use the same client and the same balance. For a deeper technical breakdown of these differences, see our detailed Crawlbase comparison.

Prerequisites

Before starting, ensure you have:

  1. An AlterLab account (you can sign up for free here).
  2. Your AlterLab API key from the dashboard.
  3. Python 3.8+ or Node.js installed.

The migration typically takes less than 15 minutes for most production environments.

Step 1: Install the AlterLab SDK

While you can use requests or axios to hit our REST endpoint, we recommend using our official SDK for better type hinting and error handling.

Bash
pip install alterlab

If you are using Node.js, run:

Bash
npm install @alterlab/sdk

For more details on environment setup, check our getting started guide.

Step 2: Replace your API calls

The logic remains the same: you provide a URL, and AlterLab returns the content. The major difference is how you handle JavaScript rendering. In Crawlbase, you change the endpoint or the token. In AlterLab, you simply pass a parameter.

Here is how your code looks before and after the migration.

Python
# Crawlbase implementation
import requests

CRAWLBASE_TOKEN = "your_crawlbase_token"
url_to_scrape = "https://example.com"

# For standard HTML
res = requests.get(f"https://api.crawlbase.com/?token={CRAWLBASE_TOKEN}&url={url_to_scrape}")

# For JS rendering (requires a different endpoint or token logic)
js_res = requests.get(f"https://api.crawlbase.com/render?token={CRAWLBASE_TOKEN}&url={url_to_scrape}")
Python
# AlterLab implementation
import alterlab

client = alterlab.Client("YOUR_ALTERLAB_API_KEY")

# Standard scrape
response = client.scrape("https://example.com")

# JS rendering (just add the parameter)
js_response = client.scrape("https://example.com", js_render=True)

print(response.text)

Step 3: Handle response format differences

AlterLab returns a standard response object. If you were previously parsing raw HTML from Crawlbase, your logic will work without modification.

If you use our Cortex AI feature to extract structured data, the transition is even simpler. Instead of parsing regex patterns from the HTML, you can pass a schema directly:

Python
# Move from regex parsing to structured extraction
response = client.scrape(
    "https://example.com/product",
    extract={
        "price": "string",
        "availability": "boolean"
    }
)
print(response.json()['price'])

Step 4: Update your error handling

Crawlbase uses specific HTTP status codes for its service. AlterLab follows standard REST patterns. Most importantly, AlterLab provides clear error messages in the response body if a scrape fails due to a timeout or a blocked request.

Ensure your retry logic accounts for the following:

  • 429 Too Many Requests: You have hit your-per-second rate limit. Implement exponential backoff.
  • 402 Payment Required: Your balance is empty.

Cost comparison

One of the most common reasons for migrating is the shift from subscription-based models to a pure usage-based model. With AlterLab, you don'1t pay for "unused"-capacity-heavy tiers. You pay for what you use.

$0.0002Per Request (AlterLab)
$0Monthly Minimum
NeverBalance Expiry

You can view our full-scale pricing breakdown at our pricing page.

Common issues and fixes

  • Missing JS Content: If you migrate a task and notice the content is missing elements, ensure you added js_render=True to your request.
  • Timeout errors: Some heavy-duty sites require more time. Use the timeout parameter in the scrape method to give the headless browser more time to execute scripts.
  • Authentication: Ensure your .env file is updated. Many developers forget to swap the old CRAWLBASE_TOKEN variable for the new ALTERLAB_API_KEY.

You're done

Your migration is complete. Your code is now more concise, your API keys are unified, and you are no longer tied to monthly minimums.

If you run into issues during the transition, check our API documentation or hit reply to our support email.


FAQ

Q: How long does it take to migrate from Crawlbase to AlterLab? A: Most developers complete the swap in under 30 minutes. Since the request logic is almost identical, you only need to update your API client and your authentication keys.

Q: Will my existing Crawlbase code work with AlterLab? A: If you use requests in Python or fetch in JavaScript, yes. You just need to change the base URL and the parameter names. If you use their specific SDK, you will need to switch to the AlterLab SDK.

Q: How does AlterLab pricing compare to Crawlbase? A: AlterLab offers a pay-as-you-go model starting at $0.0002 per request. Unlike Crawlbase, there are no monthly subscription minimums and your balance never expires.

Share

Was this article helpful?

Frequently Asked Questions

Most developers complete the migration in under 30 minutes. Since both services use RESTful principles, you only need to swap your endpoint and API key.
Yes, if you are using raw HTTP requests. If you use a specific client library, you will need to swap it for the AlterLab SDK, but the logic remains identical.
AlterLab uses a pure pay-as-you-go model with no monthly minimums. Unlike Crawlbase, your balance never expires and you don's need separate credits for JavaScript rendering.