Skip to main content

Installation

The official .NET SDK is maintained in the Firecrawl monorepo at apps/dot-net-sdk. To install the Firecrawl .NET SDK, add the NuGet package:
Requires .NET 8.0 or later.

Usage

  1. Get an API key from firecrawl.dev
  2. Set the API key as an environment variable named FIRECRAWL_API_KEY, or pass it to the FirecrawlClient constructor
Here is a quick example using the current SDK API surface:

Scraping a URL

To scrape a single URL, use the ScrapeAsync method.

JSON Extraction

Extract structured JSON with JsonFormat via the scrape endpoint:

Crawling a Website

To crawl a website and wait for completion, use CrawlAsync. This method handles polling and pagination automatically.

Start a Crawl

Start a job without waiting using StartCrawlAsync.

Checking Crawl Status

Check crawl progress with GetCrawlStatusAsync.

Cancelling a Crawl

Cancel a running crawl with CancelCrawlAsync.

Mapping a Website

Discover links on a site using MapAsync.

Searching the Web

Search with optional search settings using SearchAsync.

Batch Scraping

Scrape multiple URLs in parallel using BatchScrapeAsync. This method handles polling and pagination automatically.

Batch Scrape with Idempotency Key

To ensure duplicate requests are not processed, pass an IdempotencyKey:

Usage & Metrics

Check concurrency and remaining credits:

Async Support

All methods in the .NET SDK are async by default and return Task<T>. They support CancellationToken for cooperative cancellation.

Configuration

The FirecrawlClient constructor supports the following options:

Custom HTTP Client

You can pass a pre-configured HttpClient to control connection pooling, proxies, message handlers, and any other HttpClient feature. When provided, the timeout setting is ignored in favor of the client’s own configuration.

Environment Variable Configuration

The SDK resolves configuration from environment variables when constructor parameters are omitted:

Error Handling

The SDK throws specific exceptions under Firecrawl.Exceptions.
The exception hierarchy: Transient failures (408, 409, 502, and other 5xx errors) are retried automatically with exponential backoff before an exception is thrown.
Are you an AI agent that needs a Firecrawl API key? See firecrawl.dev/agent-onboarding/SKILL.md for automated onboarding instructions.