Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions agent-source-of-truth/elixir.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Canonical Firecrawl Elixir source of truth for agents. Generated from SDK source
Add to `mix.exs`:

```elixir
{:firecrawl, "~> 1.0.0"}
{:firecrawl, "~> 1.9"}
```

## Authenticate
Expand All @@ -23,6 +23,14 @@ config :firecrawl, api_key: System.get_env("FIRECRAWL_API_KEY")
{:ok, res} = Firecrawl.search_and_scrape([query: "site:docs.firecrawl.dev webhook retries"], api_key: "fc-your-api-key")
```

All functions accept an optional trailing keyword list (`opts`) that supports:

- `:api_key` — override the API key for this call.
- `:base_url` — override the default base URL (`https://api.firecrawl.dev/v2`), useful for self-hosted instances.
- Any other keys are passed through to the underlying Req HTTP client (for example, `:receive_timeout`, `:retry`).

A nil or empty API key is allowed: `scrape`, `search`, and `interact` fall back to a keyless free tier that is rate-limited per IP.

## When To Use What

- `search`: use when you start with a query and need discovery.
Expand Down Expand Up @@ -58,6 +66,9 @@ Use search to discover relevant pages from a query, then pick URLs to scrape or
country: "US",
ignore_invalid_urls: true,
timeout: 60000,
include_domains: ["docs.firecrawl.dev", "firecrawl.dev"],
exclude_domains: ["example.com"],
highlights: true,
scrape_options: [
formats: [
"markdown",
Expand Down Expand Up @@ -121,6 +132,18 @@ Use search to discover relevant pages from a query, then pick URLs to scrape or
- Type: integer
- Use when: you need a request timeout in milliseconds.

- `exclude_domains`
- Type: list of strings
- Use when: you want to exclude specific domains from search results.

- `include_domains`
- Type: list of strings
- Use when: you want to restrict search results to specific domains.

- `highlights`
- Type: boolean
- Use when: you want query-relevant highlights returned with each result.

- `enterprise`
- Type: list of strings
- Use when: you need enterprise search controls.
Expand Down Expand Up @@ -180,7 +203,10 @@ Use scrape when you already have a URL and want structured content in one or mor
min_age: 1,
store_in_cache: true,
profile: [name: "docs-session", save_changes: true],
zero_data_retention: false
zero_data_retention: false,
lockdown: false,
redact_pii: true,
audit_metadata: [username: "admin@example.com"]
)
```

Expand Down Expand Up @@ -302,6 +328,19 @@ Use scrape when you already have a URL and want structured content in one or mor
- Type: boolean
- Use when: you want zero data retention for this scrape.

- `audit_metadata`
- Type: keyword list (keys: `username: :string`, required)
- Use when: you need SIEM logging attribution.

- `lockdown`
- Type: boolean
- Use when: you want to serve only cached results (no live fetch).

- `redact_pii`
- Type: boolean
- Use when: you want PII redaction applied to the scraped content.
- JSON key: `redactPII`

## Interact

### Why use it
Expand Down Expand Up @@ -367,8 +406,11 @@ Use interact when a page requires browser actions or code execution after a scra

## Notes

- The Elixir client is OpenAPI-shaped; function names and parameter keys are generated from the spec.
- The Elixir client is auto-generated from the OpenAPI spec (the line 1 comment in the source confirms this).
- Each public function has a bang (`!`) variant that raises on error instead of returning `{:error, _}`.
- Parameters are validated at call time using NimbleOptions.
- Snake_case Elixir keys are automatically converted to camelCase JSON keys.
- The SDK auto-injects `"origin": "elixir-sdk@1.9.1"` in every request body.
- This SDK exposes code-based interactions only (no `prompt` parameter on `interact_with_scrape_browser_session`).

## Source Of Truth
Expand Down
76 changes: 70 additions & 6 deletions agent-source-of-truth/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Maven:
<dependency>
<groupId>com.firecrawl</groupId>
<artifactId>firecrawl-java</artifactId>
<version>1.2.0</version>
<version>1.12.1</version>
</dependency>
```

Gradle:

```gradle
implementation("com.firecrawl:firecrawl-java:1.2.0")
implementation("com.firecrawl:firecrawl-java:1.12.1")
```

## Authenticate
Expand All @@ -33,6 +33,24 @@ FirecrawlClient client = FirecrawlClient.builder()
.build();
```

### Builder options

- `apiKey(String)` — API key for authentication. Falls back to `FIRECRAWL_API_KEY` env var, then `firecrawl.apiKey` system property. Null is allowed (keyless free tier).
- `apiUrl(String)` — Base URL for the Firecrawl API. Default `"https://api.firecrawl.dev"`, falls back to `FIRECRAWL_API_URL` env var.
- `timeoutMs(long)` — HTTP request timeout in milliseconds (default 300000 / 5 min).
- `maxRetries(int)` — Auto-retry count for transient failures (default 3).
- `backoffFactor(double)` — Exponential backoff factor in seconds (default 0.5).
- `asyncExecutor(Executor)` — Executor for async methods (default `ForkJoinPool.commonPool()`).
- `httpClient(OkHttpClient)` — Pre-configured OkHttp client (ignores `timeoutMs` when provided).

### Factory method

`FirecrawlClient.fromEnv()` — Creates a client using environment-based configuration (`FIRECRAWL_API_KEY`, `FIRECRAWL_API_URL`). Equivalent to `FirecrawlClient.builder().build()` with no explicit arguments.

```java
FirecrawlClient client = FirecrawlClient.fromEnv();
```

## When To Use What

- `search`: use when you start with a query and need discovery.
Expand Down Expand Up @@ -83,6 +101,9 @@ SearchOptions options = SearchOptions.builder()
.location("San Francisco,California,United States")
.ignoreInvalidURLs(true)
.timeout(60000)
.includeDomains(List.of("docs.firecrawl.dev", "firecrawl.dev"))
.excludeDomains(List.of("example.com"))
.highlights(true)
.scrapeOptions(
ScrapeOptions.builder()
.formats(List.of(
Expand Down Expand Up @@ -144,6 +165,18 @@ SearchData results = client.search("site:docs.firecrawl.dev crawl webhooks", opt
- Type: Integer
- Use when: you need a request timeout in milliseconds.

- `options.includeDomains`
- Type: `List<String>`
- Use when: you want to restrict results to specific domains.

- `options.excludeDomains`
- Type: `List<String>`
- Use when: you want to exclude specific domains.

- `options.highlights`
- Type: Boolean
- Use when: you want query-relevant highlights in the results (defaults to true).

- `options.scrapeOptions`
- Type: `ScrapeOptions`
- Use when: you want to scrape each search result (see Scrape parameters for fields).
Expand Down Expand Up @@ -181,6 +214,9 @@ Document doc = client.scrape(
```java
import com.firecrawl.models.ScrapeOptions;
import com.firecrawl.models.JsonFormat;
import com.firecrawl.models.HighlightsFormat;
import com.firecrawl.models.QuestionFormat;
import com.firecrawl.models.AuditMetadata;

List<Map<String, Object>> actions = List.of(
Map.of("type", "click", "selector", "#accept"),
Expand All @@ -198,6 +234,8 @@ ScrapeOptions options = ScrapeOptions.builder()
"markdown",
"links",
JsonFormat.builder().prompt("Extract plan names and prices.").build(),
QuestionFormat.builder().question("What are the pricing tiers?").build(),
HighlightsFormat.builder().query("pricing").build(),
Map.of("type", "screenshot", "fullPage", true, "quality", 80)
))
.onlyMainContent(true)
Expand All @@ -210,6 +248,9 @@ ScrapeOptions options = ScrapeOptions.builder()
.proxy("auto")
.maxAge(86400000L)
.storeInCache(true)
.lockdown(true)
.redactPII(true)
.auditMetadata(AuditMetadata.builder().username("agent-user").build())
.build();

Document doc = client.scrape("https://example.com/pricing", options);
Expand Down Expand Up @@ -244,6 +285,9 @@ Document doc = client.scrape("https://example.com/pricing", options);
- `modes`, `schema`, `prompt`, `tag`: change tracking options for `type: "changeTracking"`
- `fullPage`, `quality`, `viewport`: screenshot options for `type: "screenshot"`
- `selectors`: array of `{selector, attribute}` for `type: "attributes"`
- Format object types:
- `QuestionFormat.builder().question("...").build()` — question-answer extraction
- `HighlightsFormat.builder().query("...").build()` — relevant source-text extraction

- `options.headers`
- Type: `Map<String, String>`
Expand Down Expand Up @@ -323,6 +367,18 @@ Document doc = client.scrape("https://example.com/pricing", options);
- Type: Boolean
- Use when: you want Firecrawl to cache the result.

- `options.lockdown`
- Type: Boolean
- Use when: you want to serve only cached results (no live fetch).

- `options.redactPII`
- Type: Boolean
- Use when: you want PII redaction applied to the scraped content.

- `options.auditMetadata`
- Type: `AuditMetadata` (has `username: String`)
- Use when: you need SIEM logging attribution for the scrape request.

- `options.integration`
- Type: String
- Use when: the API expects an integration identifier on the request.
Expand All @@ -336,9 +392,11 @@ Use interact when a page requires browser actions or code execution after a scra
### Preferred SDK methods

- `client.interact(jobId, code)` — uses default language `node` and API default execution timeout
- `client.interact(jobId, code, language, timeout)` — `timeout` is seconds (1300), or null to omit and use the API default (30 seconds)
- `client.interact(jobId, code, language, timeout)` — `timeout` is seconds (1-300), or null to omit and use the API default (30 seconds)
- `client.interact(jobId, code, language, timeout, origin)` — optional `origin` string is sent only when non-null (request attribution)

Async variants: each overload has a corresponding `interactAsync(...)` that returns `CompletableFuture<BrowserExecuteResponse>`.

### Simple Example

```java
Expand Down Expand Up @@ -369,6 +427,8 @@ End the scrape-bound browser session when finished.

**Preferred SDK method:** `client.stopInteractiveBrowser(jobId)`

Async variant: `client.stopInteractiveBrowserAsync(jobId)` returns `CompletableFuture<BrowserDeleteResponse>`.

```java
import com.firecrawl.models.BrowserDeleteResponse;

Expand All @@ -380,7 +440,7 @@ BrowserDeleteResponse stopped = client.stopInteractiveBrowser("<scrapeJobId>");
- `isSuccess()`: boolean
- `getStdout()`, `getStderr()`, `getResult()`, `getError()`: String (may be null)
- `getExitCode()`: Integer (may be null)
- `getKilled()`: Boolean (may be null) true when execution was stopped due to timeout
- `getKilled()`: Boolean (may be null) -- true when execution was stopped due to timeout

### Stop response (`BrowserDeleteResponse`)

Expand All @@ -407,16 +467,17 @@ BrowserDeleteResponse stopped = client.stopInteractiveBrowser("<scrapeJobId>");

- `timeout`
- Type: Integer
- Use when: you need an execution timeout in seconds (1300). Null omits the field and uses the API default.
- Use when: you need an execution timeout in seconds (1-300). Null omits the field and uses the API default.

- `origin`
- Type: String
- Use when: you need an optional origin label on the request. Prefer omitting unless your integration requires it.

## Notes

- Deprecated aliases: `scrapeExecute` `interact`, `deleteScrapeBrowser` `stopInteractiveBrowser` (and the corresponding `*Async` helpers).
- Deprecated aliases: `scrapeExecute` -> `interact`, `deleteScrapeBrowser` -> `stopInteractiveBrowser` (and the corresponding `*Async` helpers).
- The Java SDK exposes code-based interactions only: there is no `prompt` parameter on `interact` (unlike some other language SDKs).
- Builder supports `fromEnv()` for environment-based configuration without explicit arguments.

## Source Of Truth

Expand All @@ -430,4 +491,7 @@ BrowserDeleteResponse stopped = client.stopInteractiveBrowser("<scrapeJobId>");
- `firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/Document.java`
- `firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/BrowserExecuteResponse.java`
- `firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/BrowserDeleteResponse.java`
- `firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/AuditMetadata.java`
- `firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/HighlightsFormat.java`
- `firecrawl/apps/java-sdk/src/main/java/com/firecrawl/models/QuestionFormat.java`
- `firecrawl-docs/api-reference/v2-openapi.json`
Loading