Skip to main content

Installation

The official Go SDK is maintained in the Firecrawl monorepo at apps/go-sdk. To install the Firecrawl Go SDK, run:
Requires Go 1.23 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 with option.WithAPIKey(...)
Here is a quick example using the current SDK API surface:

Scraping a URL

To scrape a single URL, use the Scrape method.

JSON Extraction

Extract structured JSON using JsonOptions via the Scrape endpoint:

Crawling a Website

To crawl a website and wait for completion, use Crawl.

Start a Crawl

Start a job without waiting using StartCrawl.

Checking Crawl Status

Check crawl progress with GetCrawlStatus.

Cancelling a Crawl

Cancel a running crawl with CancelCrawl.

Mapping a Website

Discover links on a site using Map.

Searching the Web

Search with optional search settings using Search.

Batch Scraping

Scrape multiple URLs in parallel using BatchScrape.

Agent

Run an AI-powered agent with Agent.
With a JSON schema for structured output:

Usage & Metrics

Check concurrency and remaining credits:

Browser

The Go SDK includes Browser Sandbox helpers.

Create a Session

Execute Code

Scrape-Bound Interactive Session

Use a scrape job ID to run follow-up browser code in the same replayed context:
  • Interact(...) runs code in the scrape-bound browser session (and initializes it on first use).
  • StopInteractiveBrowser(...) explicitly stops the interactive session when you are done.

List & Close Sessions

Configuration

firecrawl.NewClient() accepts functional options:

Custom HTTP Client

You can pass a pre-configured *http.Client to control transport settings, proxy configuration, TLS settings, and more. When provided, the WithTimeout setting is ignored in favor of the client’s own configuration.

Context Support

All methods accept a context.Context as the first argument for cancellation and deadline control:

Error Handling

The SDK uses typed errors under the firecrawl package.

Retry Logic

The SDK automatically retries transient failures:
  • Retried: 408, 409, 5xx errors, and connection failures
  • Not retried: 401, 429, and other 4xx errors
  • Backoff: Exponential backoff with configurable factor

Pointer Helpers

The SDK provides convenience functions for optional pointer fields:
Are you an AI agent that needs a Firecrawl API key? See firecrawl.dev/agent-onboarding/SKILL.md for automated onboarding instructions.