Tutorials

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

Practical steps to move your scraping workflow from Apify to AlterLab, keeping code changes minimal and costs predictable.

3 min read
9 views

TL;DR

To migrate from Apify to AlterLab, install the AlterLab SDK, replace your Apify client with alterlab.Client using your AlterLab API key, and keep the same scrape calls. The response format is similar, so minimal code changes are needed.

Why migrate?

Apify’s actor marketplace and compute unit billing can make costs unpredictable for simple scraping tasks. AlterLab offers a pay‑as‑you‑go model with no subscription, so you only pay for the requests you make.

Prerequisites

  • An AlterLab account (free at free sign-up)
  • Your AlterLab API key from the dashboard
  • About five minutes to update your code

Step 1: Install the AlterLab SDK

You can use the REST API directly, but the Python SDK mirrors the Apify client pattern.

Bash
pip install alterlab

See the Getting started guide for other language options.

Step 2: Replace your API calls

Below is a side‑by‑side comparison of a basic scrape request.

Python
# Apify (before migration)
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("actor_id").call(run_input={"url": "https://example.com"})
# Fetch results from the run's default dataset
Python
# AlterLab (after migration)
import alterlab

client = alterlab.Client("YOUR_ALTERLAB_API_KEY")
response = client.scrape("https://example.com")
print(response.text)  # Same HTML, pay‑as‑you‑go pricing

The AlterLab scrape method returns an object with text, html, and json attributes, similar to Apify’s dataset items.

Step 3: Handle response format differences

Apify returns data through a dataset that you must iterate over. AlterLab returns the scraped content directly in the response object.

  • If you need JSON output, add formats=['json'] to the scrape call.
  • For raw HTML, use response.html (same as Apify’s HTML field).
  • Metadata such as status code and headers are available via response.status_code and response.headers.

Step 4: Update your error handling

AlterLab uses standard HTTP status codes:

  • 200: Success
  • 429: Rate limit – retry after the Retry-After header
  • 500‑503: Temporary issues – exponential backoff works as before

Replace any Apify‑specific error checks with generic HTTP status handling. Retry logic from your existing Apify code can be reused unchanged.

Cost comparison

For a typical workload of 10,000 requests per month:

$0.0002Per Request (AlterLab)
$0Monthly Minimum
NeverBalance Expiry
  • AlterLab: 10,000 × $0.0002 = $2.00, no monthly fee, balance never expires.
  • Apify: Compute unit pricing varies; a similar volume often incurs a monthly subscription plus usage fees, making the total higher and less predictable.

See the full breakdown on the AlterLab pricing page.

Common issues and fixes

  • Missing API key: Double‑check that you placed the AlterLab key in your environment variable or config file.
  • Unexpected response format: Ensure you are accessing response.text or response.json() as needed; AlterLab does not wrap data in a dataset layer.
  • Rate limit headers: AlterLab sends Retry-After seconds; adjust your backoff logic to read this header.
  • Proxy authentication: AlterLab handles proxy rotation automatically; remove any manual proxy settings from your Apify code.

You're done

Your migration is complete. Run your test suite to confirm everything works, then deploy. For more details, see the detailed Apify comparison and the AlterLab documentation.

AlterLab // Web Data, Simplified.

Share

Was this article helpful?

Frequently Asked Questions

Typically under an hour. Most existing code stays the same; you only update the API key and replace the client library.
Yes. AlterLab uses a compatible REST API and similar response structure, so only the client initialization and calls need adjusting.
AlterLab charges $0.0002 per request with no monthly minimum and no balance expiry, unlike Apify's compute unit and subscription model.