Firecrawl Java Agent Quickstart
This is the canonical quickstart for external agents integrating with Firecrawl using the official Java SDK. Generated from SDK source and OpenAPI spec.Install
Maven:Authenticate
A convenience factory
FirecrawlClient.fromEnv() reads the API key from the FIRECRAWL_API_KEY env var or firecrawl.apiKey system property.
When To Use What
search— Use when you start with a query and need to discover relevant pages. Returns search results grouped by source type, optionally with scraped content.scrape— Use when you already have a URL and want its content. Returns markdown, HTML, structured data, screenshots, or other formats.interact— Use when the page needs post-scrape browser actions like clicking, filling forms, or executing code in the browser sandbox.
Search
Why use it
Search the web and optionally scrape each result in one call. Start here when you have a question or topic but not a specific URL.Preferred SDK method
Example
Parameters
All fields onSearchOptions are nullable and optional.
An async variant is available:
client.searchAsync(query, options) returns CompletableFuture<SearchData>.
Scrape
Why use it
Fetch and extract content from a single URL. Use when you have a specific page to read.Preferred SDK method
Example
Parameters
All fields onScrapeOptions are nullable and optional.
An async variant is available:
client.scrapeAsync(url, options) returns CompletableFuture<Document>.
Interact
Why use it
Execute code in the browser sandbox associated with a scrape job. Use after a scrape to click buttons, fill forms, navigate, or extract additional data.Preferred SDK method
Example
Parameters
Async variants are available:
client.interactAsync(...) returns CompletableFuture<BrowserExecuteResponse>.
Related method
BrowserDeleteResponse.
Notes
- Naming style: All parameters use camelCase.
- Builder pattern:
ScrapeOptionsandSearchOptionsuse builder pattern (ScrapeOptions.builder()...build()). - Deprecated aliases:
scrapeExecute()→ useinteract()instead.deleteScrapeBrowser()→ usestopInteractiveBrowser()instead.
- Async methods: Every sync method has an async counterpart suffixed with
Asyncthat returnsCompletableFuture<T>. - Interact limitations: The Java SDK’s
interactmethod requirescodeas a string parameter. Unlike the JS and Python SDKs, it does not support apromptparameter for natural-language browser instructions.
Source Of Truth
firecrawl/apps/java-sdk/src/main/java/com/firecrawl/client/FirecrawlClient.javafirecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/ScrapeOptions.javafirecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/SearchOptions.javafirecrawl/apps/java-sdk/build.gradle.ktsfirecrawl-docs/api-reference/v2-openapi.json

