Installation#
The official Go SDK is maintained in the Firecrawl monorepo at apps/go-sdk.
To install the Firecrawl Go SDK, run:
Usage#
- Get an API key from firecrawl.dev
- Set the API key as an environment variable named
FIRECRAWL_API_KEY, or pass it withoption.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:
| Option | Type | Default | Description |
|---|---|---|---|
option.WithAPIKey | string | FIRECRAWL_API_KEY env var | Your Firecrawl API key |
option.WithAPIURL | string | https://api.firecrawl.dev (or FIRECRAWL_API_URL) | API base URL |
option.WithTimeout | time.Duration | 5 * time.Minute | HTTP client timeout |
option.WithMaxRetries | int | 3 | Automatic retries for transient failures |
option.WithBackoffFactor | float64 | 0.5 | Exponential backoff factor in seconds |
option.WithHTTPClient | *http.Client | Built from timeout | Pre-configured HTTP client instance |
option.WithHeader | string, string | — | Add an extra header to all requests |
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.

