Skip to main content

Firecrawl Java Agent Quickstart

Canonical quickstart for external agents. Generated from SDK source (firecrawl-java) and the v2 OpenAPI spec. Method names and parameters match the SDK public API.

Install

Maven:
Gradle:

Authenticate

Builder options: apiKey (falls back to FIRECRAWL_API_KEY env var or firecrawl.apiKey system property), apiUrl (default "https://api.firecrawl.dev"), timeoutMs (default 300000), maxRetries (default 3), backoffFactor (default 0.5). Shortcut: FirecrawlClient.fromEnv().

When To Use What

  • search: use when you start with a query and need discovery.
  • scrape: use when you already have a URL and want page content.
  • interact: use when the page needs clicks, forms, or post-scrape browser actions. Requires a scrape job ID.

Why use it

Discover relevant pages from a query, then pick URLs to scrape or interact with. Constrain results to a site with site: in the query.

Preferred SDK method

client.search(query) or client.search(query, options)SearchData

Example

Results are in results.getWeb(), results.getNews(), results.getImages().

Parameters

Scrape

Why use it

Get structured content from a URL in one or more formats.

Preferred SDK method

client.scrape(url) or client.scrape(url, options)Document

Example

Parameters

Interact

Why use it

Execute code in the browser session tied to a prior scrape. The Java SDK supports code-based interactions only (no prompt parameter).

Preferred SDK method

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

Example

Parameters

Stop the session with client.stopInteractiveBrowser(jobId). All methods have *Async variants returning CompletableFuture.

Notes

  • Deprecated aliases: scrapeExecuteinteract, deleteScrapeBrowserstopInteractiveBrowser.
  • The Java SDK exposes code-based interactions only — no prompt parameter on interact (unlike Node.js, Python, and Rust SDKs).
  • Uses camelCase parameter names matching the API wire format.
  • SearchData results are accessed via getWeb(), getNews(), getImages().

Source Of Truth

  • firecrawl/apps/java-sdk/build.gradle.kts
  • firecrawl/apps/java-sdk/src/main/java/com/firecrawl/client/FirecrawlClient.java
  • firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/ScrapeOptions.java
  • firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/SearchOptions.java
  • firecrawl-docs/api-reference/v2-openapi.json