Firecrawl Java Agent Quickstart
This file is the canonical quickstart for external agents integrating Firecrawl via the Java SDK. It is generated from SDK source and OpenAPI spec.Install
Gradle:Authenticate
FIRECRAWL_API_KEY):
apiKey (String), apiUrl (String, default "https://api.firecrawl.dev"), timeoutMs (long, default 300000), maxRetries (int, default 3), backoffFactor (double, default 0.5), asyncExecutor (Executor), httpClient (OkHttpClient).
When To Use What
search: Use when you start with a query and need to discover relevant URLs and their content. Returns results from web, news, and image sources.scrape: Use when you already have a specific URL and want its page content in markdown, HTML, JSON, or other formats.interact: Use when the page needs post-scrape browser actions like clicking, typing, scrolling, or executing code in a live browser session.
Search
Why use it
Search the web for a query and optionally scrape the results. Returns categorized results from web, news, and image sources with optional content extraction.Preferred SDK method
Example
Parameters
AllSearchOptions fields are null by default (omitted from the request body). Use the builder pattern.
Return type
SearchData with: getWeb(), getNews(), getImages(). Each returns List<Map<String, Object>>.
Scrape
Why use it
Scrape a single URL and get its content in one or more formats. Supports browser automation, LLM extraction, screenshots, and more.Preferred SDK method
Example
Parameters
AllScrapeOptions fields are null by default (omitted from the request body). Use the builder pattern.
Format objects
Interact
Why use it
Execute code in a live browser session tied to a scrape job. Use for post-scrape interactions like clicking buttons, filling forms, or running scripts.Preferred SDK method
Example
Parameters
Use
client.stopInteractiveBrowser(jobId) to end the browser session.
Async variants
All three methods haveAsync variants returning CompletableFuture<T>:
Notes
- Naming style: All parameters use camelCase. Options use the builder pattern.
- Deprecated aliases:
scrapeExecute()is deprecated in favor ofinteract().deleteScrapeBrowser()is deprecated in favor ofstopInteractiveBrowser(). - No
promptsupport: Unlike JS/Python/Rust, the Java SDKinteract()method only acceptscode, not natural-languageprompt. Use thecodeparameter with"bash"language for agent-browser CLI commands. - Null handling: All option fields use
@JsonInclude(NON_NULL), sonullfields are omitted from the request body.
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

