Skip to main content
The Firecrawl JavaScript SDK provides a typed interface for scraping, crawling, and extracting structured data from websites. It supports both ESM and CommonJS, and automatically handles polling for async operations.

Installation

Quick Start

Authentication

Get your API key from firecrawl.dev and set it as an environment variable or pass it directly:

Scraping

Basic Scrape

Scrape a single URL and get content in various formats:

Structured Data Extraction

Extract structured data using Zod schemas:

Extract with Prompt (No Schema)

Additional Formats

Actions (Interact Before Scraping)

Perform actions before extracting content:

Crawling

Basic Crawl (Auto-Wait)

Crawl a website and automatically wait for completion:

Async Crawl (Manual Polling)

Start a crawl and poll manually:

Cancel a Crawl

Advanced Crawl Options

Real-Time Updates with Watcher

Watch crawl progress in real-time:

Agent

Use the AI agent to autonomously gather data from the web:

Agent with Schema

Agent with URLs

Focus the agent on specific pages:

Model Selection

Map

Generate a list of all URLs on a website:
Search the web and optionally scrape results:

Search with Content Scraping

Batch Scraping

Scrape multiple URLs in parallel:

Async Batch Scrape

Batch Scrape with Real-Time Updates

Extract (Deprecated)

The Extract endpoint is deprecated. Use the Agent feature instead for better performance and reliability.

v1 Compatibility

Legacy v1 API is available under app.v1:

Error Handling

The SDK throws errors for API failures:

Configuration

TypeScript Support

The SDK is written in TypeScript and provides full type definitions:

Requirements

  • Node.js 22.0.0 or later

Resources