Skip to main content

Firecrawl Java Agent Quickstart

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

Install

Maven:
Gradle:
Requires Java 11+.

Authenticate

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 code execution in a post-scrape browser session. 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:, for example site:docs.firecrawl.dev crawl webhooks.

Preferred SDK method

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

Example

Parameters

Scrape

Why use it

Fetch structured content from a URL in one or more formats. Use when you already have the URL.

Preferred SDK method

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

Example

Parameters

Format helper types:
  • JsonFormat.builder().prompt("...").schema(Map.of(...)).build() — JSON extraction.
  • QuestionFormat.builder().question("...").build() — question-answer extraction.
  • HighlightsFormat.builder().query("...").build() — relevant source-text extraction.

Interact

Why use it

Execute code in the browser session tied to a scrape job. Use for Playwright-style page manipulation after a scrape creates a session.

Preferred SDK method

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

Example

Parameters

The Java SDK exposes code-based interactions only. There is no prompt parameter (unlike the JS and Python SDKs). Stop session: client.stopInteractiveBrowser(jobId) ends the browser session.

Notes

  • Deprecated aliases: scrapeExecuteinteract; deleteScrapeBrowserstopInteractiveBrowser.
  • Every sync method has an async variant returning CompletableFuture<T> (e.g. scrapeAsync, searchAsync, interactAsync).
  • All option classes use the builder pattern: ScrapeOptions.builder()...build().
  • ScrapeOptions supports toBuilder() for cloning and modifying.
  • The client supports a keyless free tier (rate-limited per IP) when no API key is provided.

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/apps/java-sdk/src/main/java/com/firecrawl/models/SearchData.java
  • firecrawl-docs/api-reference/v2-openapi.json