```yaml
product: AlterLab
title: "Node.js & TypeScript SDK — npm install alterlab | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/integrations/node-sdk
```

[Integrations](https://alterlab.io/integrations)/Node.js SDK

TypeScript • ESM + CJS • Async/await

# Web scraping for Node & TypeScript

Official TypeScript SDK with full type safety. Automatic website compatibility, batch scraping, and clean markdown output in your Node.js projects.

[Get API key — free](https://alterlab.io/dashboard)[View on npm](https://www.npmjs.com/package/alterlab)

```
npm install alterlab
```

## TypeScript

Full IntelliSense and type checking included.

```
import { AlterLabClient } from 'alterlab';

const client = new AlterLabClient({
  apiKey: process.env.ALTERLAB_API_KEY!,
});

async function scrapeProduct(url: string): Promise<string> {
  const result = await client.scrape(url, {
    formats: ['markdown'],
    // tier: 4  // uncomment for bot-protected sites
  });

  console.log(`Credits used: ${result.creditsUsed}`);
  return result.markdown ?? '';
}

const markdown = await scrapeProduct('https://example.com/product');
```

## CommonJS / require

Works in existing Node.js projects without ESM migration.

```
const { AlterLabClient } = require('alterlab');

const client = new AlterLabClient({
  apiKey: process.env.ALTERLAB_API_KEY,
});

async function main() {
  const result = await client.scrape('https://example.com');
  console.log(result.markdown);
}

main();
```

## Batch scraping

Scrape up to 50 URLs in parallel with one call.

```
const urls = [
  'https://example.com/page-1',
  'https://example.com/page-2',
  'https://example.com/page-3',
];

const results = await client.batchScrape(urls, {
  formats: ['markdown'],
});

results.forEach((result, i) => {
  console.log(`Page ${i + 1}: ${result.markdown?.slice(0, 100)}`);
});
```

## What's included

Full TypeScript types — works with tsc, ts-node, Bun

ESM and CommonJS — import or require

Async/await native — no callbacks

Automatic retry with backoff on rate limits

Automatic website compatibility — all 5 tiers accessible

Batch scraping — up to 50 URLs in parallel

## Start scraping in Node.js

Free credits on signup. No subscription. Balance never expires.

[Get API key](https://alterlab.io/dashboard)[View docs](https://alterlab.io/docs)