Skip to main content

Firecrawl Java Agent Quickstart

Canonical quickstart for external agents integrating with Firecrawl via the Java SDK. Generated from SDK source and the OpenAPI spec.

Install

Gradle (Kotlin DSL):
Maven:
Requires Java 11+.

Authenticate

Or use the FIRECRAWL_API_KEY environment variable:
Builder options:

When To Use What

  • search: Start with a query and discover relevant pages. Returns URLs, titles, descriptions, and optionally scraped content.
  • scrape: You already have a URL and want structured page content — markdown, HTML, screenshots, JSON extraction, etc.
  • interact: The page needs post-scrape browser actions — clicking, typing, or executing code in a live browser session.

Why use it

Discover web pages matching a query. Optionally scrape each result for full content in one call.

Preferred SDK method

client.search(query, options)

Example

Parameters

SearchOptions.builder() fields: Results are accessed via results.getWeb(), results.getNews(), results.getImages(). Each entry is a Map<String, Object>.

Scrape

Why use it

Extract structured content from a single URL — markdown, HTML, screenshots, JSON extraction, audio, video, and more.

Preferred SDK method

client.scrape(url, options)

Example

Parameters

ScrapeOptions.builder() fields:

Interact

Why use it

Continue interacting with a live browser session after scraping. Execute code in the browser to click buttons, fill forms, navigate, and extract dynamic content.

Preferred SDK method

client.interact(jobId, code) or client.interact(jobId, code, language, timeout)

Example

Parameters

Call client.stopInteractiveBrowser(jobId) to end the browser session when done. Every sync method has an async variant returning CompletableFuture: interactAsync(...), scrapeAsync(...), searchAsync(...).

Notes

  • Builder pattern: FirecrawlClient, ScrapeOptions, SearchOptions, and LocationConfig all use Builder classes. Construct via .builder()...build().
  • camelCase parameters: All options use camelCase (e.g. onlyMainContent, includeTags).
  • List<Object> for polymorphic fields: formats, sources, and categories accept both strings and structured config objects.
  • Search results are generic Maps: SearchData.getWeb() returns List<Map<String, Object>> rather than typed model objects. Cast or use Jackson to deserialize individual results.
  • No prompt for interact: Unlike the Node.js and Python SDKs, the Java SDK’s interact method only supports code, not natural-language prompt.
  • Deprecated aliases: scrapeExecute -> interact, deleteScrapeBrowser -> stopInteractiveBrowser.

Source Of Truth

  • SDK source: firecrawl/apps/java-sdk/src/main/java/com/firecrawl/client/FirecrawlClient.java
  • OpenAPI spec: firecrawl-docs/api-reference/v2-openapi.json