Skip to main content

Firecrawl Java Agent Quickstart

Canonical quickstart for external agents. Generated from SDK source (com.firecrawl:firecrawl-java) and the OpenAPI spec. Use this file to get an agent calling Firecrawl correctly in one pass.

Install

Gradle:
Maven:

Authenticate

Builder options: No API key is required for scrape, search, and interact — they fall back to a keyless free tier (rate-limited per IP).

When To Use What

  • search: Start with a text query and need to discover relevant URLs and content across the web.
  • scrape: Already have a URL and want page content (markdown, HTML, structured JSON, screenshots, etc.).
  • interact: The page needs clicks, form fills, or post-scrape browser actions — run code against the live browser session.

Why use it

Search the web and optionally scrape each result. Returns categorized results (web, news, images) with optional content scraping.

Preferred SDK method

Example

Async variant: client.searchAsync(query, options) returns CompletableFuture<SearchData>.

Parameters

All fields on SearchOptions are nullable/optional, set via the builder. Return type: SearchData with .getWeb(), .getNews(), .getImages() returning List<Map<String, Object>>.

Scrape

Why use it

Fetch a single URL and extract content in various formats: markdown, HTML, structured JSON, screenshots, audio, video, and more. Handles JavaScript rendering, ad blocking, proxies, and caching.

Preferred SDK method

Example

Async variant: client.scrapeAsync(url, options) returns CompletableFuture<Document>.

Parameters

All fields on ScrapeOptions are nullable/optional, set via the builder.

Interact

Why use it

Execute code against the live browser session from a previous scrape. Use it to click buttons, fill forms, navigate, or extract dynamic content that only appears after user interaction.

Preferred SDK method

Example

Async variants: client.interactAsync(...) returns CompletableFuture<BrowserExecuteResponse>.

Parameters

Stop the session when done:

Notes

  • All parameter names use camelCase (e.g. onlyMainContent, skipTlsVerification), matching Java conventions.
  • Options use the builder pattern: ScrapeOptions.builder().field(value).build().
  • The Java SDK’s interact only accepts code, not prompt. Use code with JavaScript, Python, or Bash to drive the browser.
  • Deprecated aliases (use the preferred names above):
    • scrapeExecuteinteract
    • deleteScrapeBrowserstopInteractiveBrowser

Source Of Truth

  • 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