Firecrawl Java Agent Quickstart
Canonical quickstart for external agents integrating Firecrawl with Java. Generated from SDK source and OpenAPI spec.Install
Maven:Authenticate
FIRECRAWL_API_KEY environment variable:
When To Use What
- search: Start with a query, discover relevant URLs, and get their content in one call.
- scrape: You already have a URL and want its page content as markdown, HTML, JSON, or other formats.
- interact: The page needs clicks, form fills, or post-scrape browser actions on a live session.
Search
Why use it
Search the web for a query and get scraped content from the top results. Combines discovery and content extraction in one call.Preferred SDK method
client.search(query) or client.search(query, options)
Example
Parameters
All fields onSearchOptions are nullable and default to null (API defaults apply).
Response fields:
results.getWeb(), results.getNews(), results.getImages() each return List<Map<String, Object>>.
Scrape
Why use it
Get the content of a single URL as markdown, HTML, JSON, screenshots, or other formats.Preferred SDK method
client.scrape(url) or client.scrape(url, options)
Example
Parameters
All fields onScrapeOptions are nullable and default to null (API defaults apply).
Async variant:
client.scrapeAsync(url, options) returns CompletableFuture<Document>.
Interact
Why use it
Control a live browser session tied to a scrape job. Execute code in the browser sandbox to click buttons, fill forms, navigate, and extract dynamic content.Preferred SDK method
client.interact(jobId, code) or client.interact(jobId, code, language, timeout)
Example
Parameters
Stop the session when done:
client.interactAsync(...) and client.stopInteractiveBrowserAsync(...) return CompletableFuture.
Notes
- Parameter names use camelCase (e.g.
onlyMainContent,includeTags,scrapeOptions). - All option classes use the builder pattern:
ScrapeOptions.builder().field(value).build(). - The Java
interactmethod requirescode— it does not support apromptparameter. Use thecodeparameter with JavaScript to control the browser. includeDomainsandexcludeDomainson search are mutually exclusive.- Deprecated aliases (do not use in new code):
scrapeExecute(...)→ useinteract(...)deleteScrapeBrowser(...)→ usestopInteractiveBrowser(...)
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

