Skip to main content

Firecrawl Java Agent Quickstart

This file is the canonical quickstart for external agents integrating with Firecrawl via the Java SDK. It is generated from SDK source and the OpenAPI spec.

Install

Maven:
Gradle:
Requires Java 11+.

Authenticate

Builder options:

When To Use What

  • search: Use when you start with a query and need to discover relevant pages across the web.
  • scrape: Use when you already have a URL and want to extract page content (markdown, HTML, structured data, etc.).
  • interact: Use when the page needs clicks, form fills, or post-scrape browser actions via code execution.

Why use it

Search finds relevant web pages for a query. Optionally scrapes each result in the same call via scrapeOptions.

Preferred SDK method

Example

Parameters

All SearchOptions fields are nullable, set via builder. Returns: SearchData with getWeb(), getNews(), getImages() lists. Async: client.searchAsync(query, options) returns CompletableFuture<SearchData>.

Scrape

Why use it

Scrape extracts content from a single URL in any format: markdown, HTML, structured JSON, screenshots, and more.

Preferred SDK method

Example

Parameters

All ScrapeOptions fields are nullable, set via builder. Returns: Document with getMarkdown(), getHtml(), getRawHtml(), getJson(), getSummary(), getMetadata(), getLinks(), getImages(), getScreenshot(), getAudio(), getVideo(), getActions(), getWarning(), getChangeTracking(), getBranding(), getProduct(), getMenu(), getPages(), getBlocks(). Async: client.scrapeAsync(url, options) returns CompletableFuture<Document>.

Interact

Why use it

Interact lets you execute code in a browser session that was started by a scrape. Use it for post-scrape actions like clicking buttons, filling forms, or extracting dynamic content.

Preferred SDK method

Example

Parameters

Returns: BrowserExecuteResponse with isSuccess(), getStdout(), getResult(), getStderr(), getExitCode(), isKilled(), getError(). Related: client.stopInteractiveBrowser(jobId) ends the browser session. Async: client.interactAsync(jobId, code, ...) returns CompletableFuture<BrowserExecuteResponse>.

Notes

  • All parameter names use camelCase (e.g. onlyMainContent, skipTlsVerification).
  • The Java SDK’s interact method takes code as a required parameter. The prompt parameter (natural-language browser instructions) is not yet available in the Java SDK — use the Node.js or Python SDK for prompt-based interaction.
  • Deprecated aliases (use the preferred names instead):
    • scrapeExecute()interact()
    • deleteScrapeBrowser()stopInteractiveBrowser()
    • searchGitHub() → deprecated (sunset 2026-11-03)
  • Every method has a corresponding *Async variant returning CompletableFuture.

Source Of Truth

  • firecrawl/apps/java-sdk/src/main/java/com/firecrawl/client/FirecrawlClient.java
  • firecrawl-docs/api-reference/v2-openapi.json