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:Authenticate
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.
Search
Why use it
Discover relevant pages from a query, then pick URLs to scrape or interact with. Constrain results to a site withsite: in the query.
Preferred SDK method
client.search(query) or client.search(query, options) → SearchData
Example
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 (noprompt 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:
scrapeExecute→interact,deleteScrapeBrowser→stopInteractiveBrowser. - The Java SDK exposes code-based interactions only — no
promptparameter oninteract(unlike Node.js, Python, and Rust SDKs). - Uses camelCase parameter names matching the API wire format.
SearchDataresults are accessed viagetWeb(),getNews(),getImages().
Source Of Truth
firecrawl/apps/java-sdk/build.gradle.ktsfirecrawl/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-docs/api-reference/v2-openapi.json

