Skip to main content

Installation

The official Java SDK is maintained in the Firecrawl monorepo at apps/java-sdk. To install the Firecrawl Java SDK, add the dependency from Maven Central:
Requires Java 11 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 FirecrawlClient.builder().apiKey(...)
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 with JsonFormat 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:

Async Support

Async variants are built in and return CompletableFuture.

Browser

The Java SDK includes Browser Sandbox helpers.

Create a Session

Execute Code

List & Close Sessions

Configuration

FirecrawlClient.builder() supports the following options:

Error Handling

The SDK throws runtime exceptions under com.firecrawl.errors.