Skip to content

Java API Reference

Convert markdown links to numbered citations.

[Example](https://example.com) becomes Example[1] with [1]: <https://example.com> in the reference list. Images ![alt](url) are preserved unchanged.

Signature:

public static CitationResult generateCitations(String markdown)

Example:

var result = generateCitations("value");

Parameters:

Name Type Required Description
markdown String Yes The markdown

Returns: CitationResult


Create a new crawl engine with the given configuration.

If config is null, uses CrawlConfig.default(). Returns an error if the configuration is invalid.

Signature:

public static CrawlEngineHandle createEngine(CrawlConfig config) throws CrawlError

Example:

var result = createEngine(new CrawlConfig());

Parameters:

Name Type Required Description
config Optional<CrawlConfig> No The configuration options

Returns: CrawlEngineHandle

Errors: Throws CrawlErrorException.


Scrape a single URL, returning extracted page data.

Signature:

public static ScrapeResult scrape(CrawlEngineHandle engine, String url) throws CrawlError

Example:

var result = scrape(new CrawlEngineHandle(), "value");

Parameters:

Name Type Required Description
engine CrawlEngineHandle Yes The crawl engine handle
url String Yes The URL to fetch

Returns: ScrapeResult

Errors: Throws CrawlErrorException.


Crawl a website starting from url, following links up to the configured depth.

Signature:

public static CrawlResult crawl(CrawlEngineHandle engine, String url) throws CrawlError

Example:

var result = crawl(new CrawlEngineHandle(), "value");

Parameters:

Name Type Required Description
engine CrawlEngineHandle Yes The crawl engine handle
url String Yes The URL to fetch

Returns: CrawlResult

Errors: Throws CrawlErrorException.


Discover all pages on a website by following links and sitemaps.

Signature:

public static MapResult mapUrls(CrawlEngineHandle engine, String url) throws CrawlError

Example:

var result = mapUrls(new CrawlEngineHandle(), "value");

Parameters:

Name Type Required Description
engine CrawlEngineHandle Yes The crawl engine handle
url String Yes The URL to fetch

Returns: MapResult

Errors: Throws CrawlErrorException.


Execute browser actions on a single page.

Signature:

public static InteractionResult interact(CrawlEngineHandle engine, String url, List<PageAction> actions) throws CrawlError

Example:

var result = interact(new CrawlEngineHandle(), "value", List.of());

Parameters:

Name Type Required Description
engine CrawlEngineHandle Yes The crawl engine handle
url String Yes The URL to fetch
actions List<PageAction> Yes The actions

Returns: InteractionResult

Errors: Throws CrawlErrorException.


Scrape multiple URLs concurrently.

Signature:

public static BatchScrapeResults batchScrape(CrawlEngineHandle engine, List<String> urls) throws CrawlError

Example:

var result = batchScrape(new CrawlEngineHandle(), List.of());

Parameters:

Name Type Required Description
engine CrawlEngineHandle Yes The crawl engine handle
urls List<String> Yes The urls

Returns: BatchScrapeResults

Errors: Throws CrawlErrorException.


Crawl multiple seed URLs concurrently, each following links to configured depth.

Signature:

public static BatchCrawlResults batchCrawl(CrawlEngineHandle engine, List<String> urls) throws CrawlError

Example:

var result = batchCrawl(new CrawlEngineHandle(), List.of());

Parameters:

Name Type Required Description
engine CrawlEngineHandle Yes The crawl engine handle
urls List<String> Yes The urls

Returns: BatchCrawlResults

Errors: Throws CrawlErrorException.


Result from a single page action execution.

Field Type Default Description
actionIndex long Zero-based index of the action in the sequence.
actionType String The type of action that was executed.
success boolean Whether the action completed successfully.
data Optional<Object> null Action-specific return data (screenshot bytes, JS return value, scraped HTML).
error Optional<String> null Error message if the action failed.

Article metadata extracted from article:* Open Graph tags.

Field Type Default Description
publishedTime Optional<String> null The article publication time.
modifiedTime Optional<String> null The article modification time.
author Optional<String> null The article author.
section Optional<String> null The article section.
tags List<String> Collections.emptyList() The article tags.

Result from a single URL in a batch crawl operation.

Field Type Default Description
url String The seed URL that was crawled.
result Optional<CrawlResult> null The crawl result, if successful.
error Optional<String> null The error message, if the crawl failed.

Aggregate result of a batch crawl, exposing per-URL results plus precomputed counts.

The counts are derived once at construction so every binding language can read them as plain integer fields without re-iterating the results vector.

Field Type Default Description
results List<BatchCrawlResult> Collections.emptyList() Per-URL crawl results, in the order seed URLs were submitted.
totalCount long Total number of seed URLs in the batch (equal to results.len()).
completedCount long Number of seed URLs whose crawl succeeded (error is null).
failedCount long Number of seed URLs whose crawl failed (error is Some).

Request to begin a multi-URL streaming crawl.

Wraps a set of seed URLs for delivery through the streaming-adapter binding surface. Required as a struct because alef’s streaming adapter requires a named request type — primitives are not supported.

Field Type Default Description
urls List<String> Collections.emptyList() The seed URLs to crawl. Each URL is followed independently up to the engine’s configured depth.

Result from a single URL in a batch scrape operation.

Field Type Default Description
url String The URL that was scraped.
result Optional<ScrapeResult> null The scrape result, if successful.
error Optional<String> null The error message, if the scrape failed.

Aggregate result of a batch scrape, exposing per-URL results plus precomputed counts.

The counts are derived once at construction so every binding language can read them as plain integer fields without re-iterating the results vector.

Field Type Default Description
results List<BatchScrapeResult> Collections.emptyList() Per-URL scrape results, in the order URLs were submitted.
totalCount long Total number of URLs in the batch (equal to results.len()).
completedCount long Number of URLs whose scrape succeeded (error is null).
failedCount long Number of URLs whose scrape failed (error is Some).

Browser fallback configuration.

Field Type Default Description
mode BrowserMode BrowserMode.AUTO When to use the headless browser fallback.
backend BrowserBackend BrowserBackend.CHROMIUMOXIDE Browser backend used to render JavaScript-heavy pages.
endpoint Optional<String> null CDP WebSocket endpoint for connecting to an external browser instance.
timeout Duration 30000ms Timeout for browser page load and rendering (in milliseconds when serialized).
wait BrowserWait BrowserWait.NETWORK_IDLE Wait strategy after browser navigation.
waitSelector Optional<String> null CSS selector to wait for when wait is Selector.
extraWait Optional<Duration> null Extra time to wait after the wait condition is met.
proxy Optional<ProxyConfig> null Proxy for browser fetches. Overrides CrawlConfig.proxy when set. Native backend supports http/https only (no SOCKS5).
blockUrlPatterns List<String> Collections.emptyList() URL patterns to block before the network request fires. Supports * wildcards. Useful for skipping ads/analytics/large images. Honored by BrowserBackend.Native; chromiumoxide ignores this field today.
evalScript Optional<String> null JavaScript snippet evaluated after navigation completes. Scraping captures the native backend result in ScrapeResult.browser.eval_result. Interactions run this script before page actions on both browser backends but do not include the script result in InteractionResult.
robotsUserAgent Optional<String> null User-agent used when fetching robots.txt. Defaults to BrowserConfig.user_agent (or crawlberg’s default) if unset. Native only.
captureNetworkEvents boolean false Capture the full network event stream into the result. Default false (only the document event is captured). Native only.
sessionAffinity boolean true Enable session affinity: reuse chromiumoxide Pages for same-domain requests so cookies + fingerprint + solved challenges persist. Default: true. When false, each request gets a fresh Page.

Signature:

public static BrowserConfig defaultOptions()

Example:

var result = BrowserConfig.defaultOptions();

Returns: BrowserConfig


Browser-specific extras populated when the native browser backend was used.

Available on ScrapeResult.browser when BrowserBackend.Native handled the request.

Field Type Default Description
evalResult Optional<Object> null Return value of BrowserConfig.eval_script, if provided.
networkEvents List<ResponseMeta> Collections.emptyList() Network events captured during page navigation (only populated when BrowserConfig.capture_network_events is true).
cookies List<CookieInfo> Collections.emptyList() All non-expired cookies present in the browser’s cookie jar after navigation completes (includes both prior cookies and server Set-Cookie).

A single numbered reference in a citation list — produced by the citation extractor when content uses inline [N]-style markers.

Field Type Default Description
index long 1-based reference number as it appears in the source text.
url String Resolved absolute URL for this reference.
text String Human-readable anchor text or title for the reference.

Result of citation conversion.

Field Type Default Description
content String Markdown with links replaced by numbered citations.
references List<CitationReference> Collections.emptyList() Numbered reference list: (index, url, text).

Content extraction and conversion configuration.

Controls how HTML is converted to the output format. Uses html-to-markdown-rs as the conversion engine for all formats (markdown, plain text, djot).

Field Type Default Description
outputFormat String "markdown" Output format: "markdown" (default), "plain", "djot".
preprocessingPreset String "standard" Preprocessing aggressiveness: "minimal", "standard" (default), "aggressive". - Minimal: only scripts/styles removed. - Standard: also removes nav, nav-hinted headers/footers/asides, forms. - Aggressive: removes all footers/asides unconditionally.
removeNavigation boolean true Remove navigation elements (nav, breadcrumbs, menus). Default: true.
removeForms boolean true Remove form elements. Default: true.
stripTags List<String> Collections.emptyList() HTML tag names to strip (render children only, remove the tag wrapper). Default: \["noscript"\].
preserveTags List<String> Collections.emptyList() HTML tag names to preserve as raw HTML in output.
excludeSelectors List<String> Collections.emptyList() CSS selectors for elements to exclude entirely (element + all content). Unlike strip_tags (which removes the wrapper but keeps children), excluded elements and all descendants are dropped. Supports CSS selectors: .class, #id, \[attribute\], compound selectors. Example: \[".cookie-banner", "#ad-container", "\[role='complementary'\]"\]
skipImages boolean false Skip image elements in output. Default: false.
maxDepth Optional<Long> null Max DOM traversal depth. Prevents stack overflow on deeply nested HTML.
wrap boolean false Enable line wrapping. Default: false.
wrapWidth long 80 Wrap width when wrap is enabled. Default: 80.
includeDocumentStructure boolean true Include document structure tree in output. Default: true.

Signature:

public static ContentConfig defaultOptions()

Example:

var result = ContentConfig.defaultOptions();

Returns: ContentConfig


Information about an HTTP cookie received from a response.

Field Type Default Description
name String The cookie name.
value String The cookie value.
domain Optional<String> null The cookie domain, if specified.
path Optional<String> null The cookie path, if specified.

Configuration for crawl, scrape, and map operations.

Field Type Default Description
maxDepth Optional<Long> null Maximum crawl depth (number of link hops from the start URL).
maxPages Optional<Long> null Maximum number of pages to crawl.
maxLinksPerPage Optional<Long> null Maximum links enqueued from a single page. Defaults to 10000. Bounds the work one hostile or pathological page can create; links past the cap are dropped and a warning is logged.
maxConcurrent Optional<Long> null Maximum number of concurrent requests.
respectRobotsTxt boolean false Whether to respect robots.txt directives.
softHttpErrors boolean false When true, HTTP-level error responses (404 NotFound, 403 Forbidden, WAF blocks) are surfaced as ScrapeResult records with the matching status_code rather than raised as CrawlError. Default false preserves the historical throw-on-error contract for direct fetches. Independently of this flag, 404s reached at the end of a redirect chain are always surfaced softly — the user opted into redirect-following, so receiving a 404 there is part of the normal flow rather than an unexpected error.
userAgent Optional<String> null Custom user-agent string.
stayOnDomain boolean false Whether to restrict crawling to the same domain.
allowSubdomains boolean false Whether to allow subdomains when stay_on_domain is true.
includePaths List<String> Collections.emptyList() Regex patterns for paths to include during crawling.
excludePaths List<String> Collections.emptyList() Regex patterns for paths to exclude during crawling.
customHeaders Map<String, String> Collections.emptyMap() Custom HTTP headers to send with each request.
requestTimeout Duration 30000ms Timeout for individual HTTP requests (in milliseconds when serialized).
rateLimitMs Optional<Long> null Per-domain rate limit in milliseconds. When set, enforces a minimum delay between requests to the same domain. Defaults to 200ms when null.
maxRedirects long 10 Maximum number of redirects to follow.
retryCount long 0 Number of retry attempts for failed requests.
retryCodes List<Short> Collections.emptyList() HTTP status codes that should trigger a retry.
cookiesEnabled boolean false Whether to enable cookie handling.
auth Optional<AuthConfig> null Authentication configuration.
maxBodySize Optional<Long> null Maximum response body size in bytes.
removeTags List<String> Collections.emptyList() CSS selectors for tags to remove from HTML before processing.
content ContentConfig Content extraction and conversion configuration.
mapLimit Optional<Long> null Maximum number of URLs to return from a map operation.
mapSearch Optional<String> null Search filter for map results (case-insensitive substring match on URLs).
downloadAssets boolean false Whether to download assets (CSS, JS, images, etc.) from the page.
assetTypes List<AssetCategory> Collections.emptyList() Filter for asset categories to download.
maxAssetSize Optional<Long> null Maximum size in bytes for individual asset downloads.
browser BrowserConfig Browser configuration.
proxy Optional<ProxyConfig> null Proxy configuration for HTTP requests.
userAgents List<String> Collections.emptyList() List of user-agent strings for rotation. If non-empty, overrides user_agent.
captureScreenshot boolean false Whether to capture a screenshot when using the browser. Only supported by scrape() with BrowserBackend.Chromiumoxide and BrowserMode.Always or Stealth. A screenshot is 100–500 KB of PNG per page, so crawl() does not carry screenshots in CrawlPageResult/CrawlResult at all — a multi-thousand-page crawl holding one per page in memory is not a safe default. Setting this with any other configuration (a different backend, BrowserMode.Auto/Never, or during crawl()) has no effect and logs a warning rather than silently doing nothing.
followDocumentUrls boolean false Re-enqueue discovered LinkType.Document URLs into the crawl frontier so the crawl follows links from document pages (PDFs, etc.) as it would from HTML pages. Default: false (documents terminate at materialisation).
documentUrlDepth Optional<Integer> null Maximum document-depth (from the seed URL through document links only) when follow_document_urls is true. null means inherit max_depth. Independent of max_depth: a document URL is enqueued only if BOTH the outer max_depth and (if set) document_url_depth permit it.
downloadDocuments boolean true Whether to download non-HTML documents (PDF, DOCX, images, code, etc.) instead of skipping them. Defaults to true — unlike download_assets and capture_screenshot, which default to false.
documentMaxSize Optional<Long> 52428800 Maximum size in bytes for document downloads. Defaults to 50 MB.
documentMimeTypes List<String> Collections.emptyList() Allowlist of MIME types to download. If empty, uses built-in defaults.
documentOutputDir Optional<String> null Directory to stream downloaded document bytes into instead of holding them in memory on DownloadedDocument.content. When set, content is left empty and DownloadedDocument.content_path is populated with <dir>/<content_hash>.<ext>. null (default) preserves today’s in-memory-only behavior. Has no effect on wasm32, which has no filesystem — use document_content_encoding there instead.
documentContentEncoding Optional<DocumentContentEncoding> null Opt-in encoding that duplicates DownloadedDocument.content into a serializable field for language bindings that need the bytes in-memory (content itself is alef(skip)ed). null (default) means no encoding is produced. Independent of document_output_dir — set both to get a file on disk and an in-memory copy.
warcOutput Optional<String> null Path to write WARC output. If null, WARC output is disabled.
browserProfile Optional<String> null Named browser profile for persistent sessions (cookies, localStorage). Chromiumoxide backend only. The native backend runs an in-process JavaScript engine with no Chrome process and therefore no profile directory, so this is ignored there and logs a warning. It is also ignored — with a warning — when a shared browser pool is in use (the pool launches before any per-crawl config exists) or when connecting to an external CDP endpoint whose process crawlberg does not own.
saveBrowserProfile boolean false Whether to save changes back to the browser profile on exit.
ssrf SsrfPolicy SSRF policy for outbound network requests. Default: deny private networks, allow http/https only, max 5 redirects. deny_private, allowlist and max_redirects are exposed to all language bindings. scheme_allowlist stays Rust-only — see SsrfPolicy. wasm32 (including Node.js): deny_private does not stop hostname-based requests. There is no DNS resolution on this target, so only a literal IP host is checked against the policy — a domain name is always permitted, regardless of deny_private. Under Node, where fetch enforces no CORS, this means a service embedding the wasm binding can be driven to internal hosts by domain name even with deny_private = true. Enforce egress restrictions at the network layer for that deployment target; do not rely on this field. See crawlberg.net.validate_url.
ssrfDenyPrivateExplicit Optional<Boolean> null Pins SsrfPolicy.deny_private to a caller-chosen value, bypassing the CRAWLBERG_ALLOW_PRIVATE_NETWORK operator override entirely for this config. ssrf.deny_private is a plain, always-serialized bool: several alef-generated bindings construct SsrfPolicy.default() (hardcoding deny_private: true) whenever their caller never touches SSRF settings at all, so true on that field alone cannot distinguish “the caller wants private networks denied” from “the binding’s own structural default landed on true”. The environment variable exists precisely to resolve that ambiguity in the common case by treating any true as inconclusive and deferring to the operator. Set this field when that default-deferral is wrong for your call — e.g. a test that must prove deny_private: true still denies even while the operator has set CRAWLBERG_ALLOW_PRIVATE_NETWORK suite-wide for every other call. null (default) preserves today’s behavior: the environment variable may still flip ssrf.deny_private to false. Some(value) pins ssrf.deny_private to value and the environment variable is not consulted for this config.

Signature:

public static CrawlConfig defaultOptions()

Example:

var result = CrawlConfig.defaultOptions();

Returns: CrawlConfig

Validate the configuration, returning an error if any values are invalid.

Signature:

public void validate() throws CrawlError

Example:

instance.validate();

Returns: No return value.

Errors: Throws CrawlErrorException.


Opaque handle to a configured crawl engine.

Constructed via create_engine with an optional CrawlConfig. Default implementations for all pluggable components are used internally.


The result of crawling a single page during a crawl operation.

Field Type Default Description
url String The original URL of the page.
normalizedUrl String The normalized URL of the page.
statusCode short The HTTP status code of the response.
contentType String The Content-Type header value.
html String The HTML body of the response.
bodySize long The size of the response body in bytes.
metadata PageMetadata Extracted metadata from the page.
links List<LinkInfo> Collections.emptyList() Links found on the page.
images List<ImageInfo> Collections.emptyList() Images found on the page.
feeds List<FeedInfo> Collections.emptyList() Feed links found on the page.
jsonLd List<JsonLdEntry> Collections.emptyList() JSON-LD entries found on the page.
depth long The depth of this page from the start URL.
stayedOnDomain boolean Whether this page is on the same domain as the start URL.
wasSkipped boolean Whether this page was skipped (binary or PDF content).
isPdf boolean Whether the content is a PDF.
detectedCharset Optional<String> null The detected character set encoding.
markdown Optional<MarkdownResult> null Markdown conversion of the page content.
extractedData Optional<Object> null Structured data extracted by LLM. Populated when extraction is configured.
extractionMeta Optional<ExtractionMeta> null Metadata about the LLM extraction pass (cost, tokens, model).
downloadedDocument Optional<DownloadedDocument> null Downloaded non-HTML document (PDF, DOCX, image, code, etc.).
browserUsed boolean Whether the browser fallback was used to fetch this page.

The result of a multi-page crawl operation.

Field Type Default Description
pages List<CrawlPageResult> Collections.emptyList() The list of crawled pages.
finalUrl String The final URL after following redirects.
redirectCount long The number of redirects followed.
wasSkipped boolean Whether any page was skipped during crawling.
error Optional<String> null An error message, if the crawl encountered an issue.
cookies List<CookieInfo> Collections.emptyList() Cookies collected during the crawl.
stayedOnDomain boolean Whether all crawled pages stayed on the same domain as the start URL.
browserUsed boolean Whether the browser fallback was used for any page in this crawl.

Returns the count of unique normalized URLs encountered during crawling.

Computed from pages (not the deprecated normalized_urls field) so it is correct across every binding that reconstructs CrawlResult from pages alone. In streaming mode pages is empty, so this returns 0 on the opaque-handle (C/Go/C#/Zig/Dart) path where it previously counted streamed pages — a known, accepted cost of making the other ten binding families correct.

Signature:

public long uniqueNormalizedUrls()

Example:

var result = instance.uniqueNormalizedUrls();

Returns: long


Request to begin a single-URL streaming crawl.

Wraps a single seed URL for delivery through the streaming-adapter binding surface. Required as a struct because alef’s streaming adapter requires a named request type — primitives are not supported.

Field Type Default Description
url String The seed URL to crawl.

A downloaded asset from a page.

Field Type Default Description
url String The original URL of the asset.
contentHash String The SHA-256 content hash of the asset.
mimeType Optional<String> null The MIME type from the Content-Type header.
size long The size of the asset in bytes.
assetCategory AssetCategory AssetCategory.IMAGE The category of the asset.
htmlTag Optional<String> null The HTML tag that referenced this asset (e.g., “link”, “script”, “img”).

A downloaded non-HTML document (PDF, DOCX, image, code file, etc.).

When the crawler encounters non-HTML content and download_documents is enabled, it downloads the raw bytes and populates this struct instead of skipping the resource.

Field Type Default Description
url String The URL the document was fetched from.
mimeType String The MIME type from the Content-Type header.
size long Size of the document in bytes.
filename Optional<String> null Filename extracted from Content-Disposition or URL path.
contentHash String SHA-256 hex digest of the content.
headers Map<String, String> Collections.emptyMap() Selected response headers.
truncated boolean True when content (or the file at content_path) was truncated to document_max_size; size still reports the original, untruncated length.
contentPath Optional<String> null Filesystem path the document was streamed to when document_output_dir was set. content is empty in memory when this is populated.
contentBase64 Optional<String> null Base64-encoded copy of content, populated only when document_content_encoding was set to Base64.

Metadata about an LLM extraction pass.

Field Type Default Description
cost Optional<Double> null Estimated cost of the LLM call in USD.
promptTokens Optional<Long> null Number of prompt (input) tokens consumed.
completionTokens Optional<Long> null Number of completion (output) tokens generated.
model Optional<String> null The model identifier used for extraction.
chunksProcessed long Number of content chunks sent to the LLM.

Information about a favicon or icon link.

Field Type Default Description
url String The icon URL.
rel String The rel attribute (e.g., “icon”, “apple-touch-icon”).
sizes Optional<String> null The sizes attribute, if present.
mimeType Optional<String> null The MIME type, if present.

Information about a feed link found on a page.

Field Type Default Description
url String The feed URL.
title Optional<String> null The feed title, if present.
feedType FeedType FeedType.RSS The type of feed.

A heading element extracted from the page.

Field Type Default Description
level byte The heading level (1-6).
text String The heading text content.

An hreflang alternate link entry.

Field Type Default Description
lang String The language code (e.g., “en”, “fr”, “x-default”).
url String The URL for this language variant.

Information about an image found on a page.

Field Type Default Description
url String The image URL.
alt Optional<String> null The alt text, if present.
width Optional<Integer> null The width attribute, if present and parseable.
height Optional<Integer> null The height attribute, if present and parseable.
source ImageSource ImageSource.IMG The source of the image reference.

Result of executing a sequence of page interaction actions.

Field Type Default Description
actionResults List<ActionResult> Collections.emptyList() Results from each executed action.
finalHtml String Final page HTML after all actions completed.
finalUrl String Final page URL (may have changed due to navigation).
screenshotBase64 Optional<String> null Base64-encoded PNG screenshot taken after all actions. Populated only when a PageAction.Screenshot action actually ran, so callers that never request a screenshot do not pay the encoding cost.

A JSON-LD structured data entry found on a page.

Field Type Default Description
schemaType String The @type value from the JSON-LD object.
name Optional<String> null The name value, if present.
raw String The raw JSON-LD string.

Information about a link found on a page.

Field Type Default Description
url String The resolved URL of the link.
text String The visible text of the link.
linkType LinkType LinkType.INTERNAL The classification of the link.
rel Optional<String> null The rel attribute value, if present.
nofollow boolean Whether the link has rel="nofollow".

The result of a map operation, containing discovered URLs.

Field Type Default Description
urls List<SitemapUrl> Collections.emptyList() The list of discovered URLs.

Rich markdown conversion result from HTML processing.

Field Type Default Description
content String Converted markdown text.
documentStructure Optional<Object> null Structured document tree with semantic nodes.
tables List<Object> Collections.emptyList() Extracted tables with structured cell data.
warnings List<String> Collections.emptyList() Non-fatal processing warnings.
citations boolean Whether citation conversion was applied and produced at least one reference. true when the markdown contained inline links that were converted to numbered citation references. The converted content (with \[N\] markers) is available in content; the full reference list is accessible via generate_citations if needed separately.
fitContent Optional<String> null Content-filtered markdown optimized for LLM consumption.

Metadata extracted from an HTML page’s <meta> tags and <title> element.

Field Type Default Description
title Optional<String> null The page title from the <title> element.
description Optional<String> null The meta description.
canonicalUrl Optional<String> null The canonical URL from <link rel="canonical">.
keywords Optional<String> null Keywords from <meta name="keywords">.
author Optional<String> null Author from <meta name="author">.
viewport Optional<String> null Viewport content from <meta name="viewport">.
themeColor Optional<String> null Theme color from <meta name="theme-color">.
generator Optional<String> null Generator from <meta name="generator">.
robots Optional<String> null Robots content from <meta name="robots">.
htmlLang Optional<String> null The lang attribute from the <html> element.
htmlDir Optional<String> null The dir attribute from the <html> element.
ogTitle Optional<String> null Open Graph title.
ogType Optional<String> null Open Graph type.
ogImage Optional<String> null Open Graph image URL.
ogDescription Optional<String> null Open Graph description.
ogUrl Optional<String> null Open Graph URL.
ogSiteName Optional<String> null Open Graph site name.
ogLocale Optional<String> null Open Graph locale.
ogVideo Optional<String> null Open Graph video URL.
ogAudio Optional<String> null Open Graph audio URL.
ogLocaleAlternates Optional<List<String>> Collections.emptyList() Open Graph locale alternates.
twitterCard Optional<String> null Twitter card type.
twitterTitle Optional<String> null Twitter title.
twitterDescription Optional<String> null Twitter description.
twitterImage Optional<String> null Twitter image URL.
twitterSite Optional<String> null Twitter site handle.
twitterCreator Optional<String> null Twitter creator handle.
dcTitle Optional<String> null Dublin Core title.
dcCreator Optional<String> null Dublin Core creator.
dcSubject Optional<String> null Dublin Core subject.
dcDescription Optional<String> null Dublin Core description.
dcPublisher Optional<String> null Dublin Core publisher.
dcDate Optional<String> null Dublin Core date.
dcType Optional<String> null Dublin Core type.
dcFormat Optional<String> null Dublin Core format.
dcIdentifier Optional<String> null Dublin Core identifier.
dcLanguage Optional<String> null Dublin Core language.
dcRights Optional<String> null Dublin Core rights.
article Optional<ArticleMetadata> null Article metadata from article:* Open Graph tags.
hreflangs Optional<List<HreflangEntry>> Collections.emptyList() Hreflang alternate links.
favicons Optional<List<FaviconInfo>> Collections.emptyList() Favicon and icon links.
headings Optional<List<HeadingInfo>> Collections.emptyList() Heading elements (h1-h6).
wordCount Optional<Long> null Computed word count of the page body text.

Proxy configuration for HTTP requests.

Field Type Default Description
url String Proxy URL (e.g. “http://proxy:8080", “socks5://proxy:1080”).
username Optional<String> null Optional username for proxy authentication.
password Optional<String> null Optional password for proxy authentication.

Response metadata extracted from HTTP headers.

Field Type Default Description
etag Optional<String> null The ETag header value.
lastModified Optional<String> null The Last-Modified header value.
cacheControl Optional<String> null The Cache-Control header value.
server Optional<String> null The Server header value.
xPoweredBy Optional<String> null The X-Powered-By header value.
contentLanguage Optional<String> null The Content-Language header value.
contentEncoding Optional<String> null The Content-Encoding header value.

The result of a single-page scrape operation.

Field Type Default Description
statusCode short The HTTP status code of the response.
finalUrl String The final URL after following all redirects.
contentType String The Content-Type header value.
html String The HTML body of the response.
bodySize long The size of the response body in bytes.
metadata PageMetadata Extracted metadata from the page.
links List<LinkInfo> Collections.emptyList() Links found on the page.
images List<ImageInfo> Collections.emptyList() Images found on the page.
feeds List<FeedInfo> Collections.emptyList() Feed links found on the page.
jsonLd List<JsonLdEntry> Collections.emptyList() JSON-LD entries found on the page.
isAllowed boolean Whether the URL is allowed by robots.txt.
crawlDelay Optional<Long> null The crawl delay from robots.txt, in seconds.
noindexDetected boolean Whether a noindex directive was detected.
nofollowDetected boolean Whether a nofollow directive was detected.
xRobotsTag Optional<String> null The X-Robots-Tag header value, if present.
isPdf boolean Whether the content is a PDF.
wasSkipped boolean Whether the page was skipped (binary or PDF content).
detectedCharset Optional<String> null The detected character set encoding.
authHeaderSent boolean Whether an authentication header was sent with the request.
responseMeta Optional<ResponseMeta> null Response metadata extracted from HTTP headers.
assets List<DownloadedAsset> Collections.emptyList() Downloaded assets from the page.
jsRenderHint boolean Whether the page content suggests JavaScript rendering is needed.
browserUsed boolean Whether the browser fallback was used to fetch this page.
markdown Optional<MarkdownResult> null Markdown conversion of the page content.
extractedData Optional<Object> null Structured data extracted by LLM. Populated when extraction is configured.
extractionMeta Optional<ExtractionMeta> null Metadata about the LLM extraction pass (cost, tokens, model).
screenshotBase64 Optional<String> null Base64-encoded PNG screenshot of the page. Populated only when CrawlConfig.capture_screenshot was enabled for this request, so callers that never requested a screenshot do not pay the encoding cost.
downloadedDocument Optional<DownloadedDocument> null Downloaded non-HTML document (PDF, DOCX, image, code, etc.).
browser Optional<BrowserExtras> null Browser-specific extras (eval result, network events, cookies). Only populated when BrowserBackend.Native was used for this request.

A URL entry from a sitemap.

Field Type Default Description
url String The URL.
lastmod Optional<String> null The last modification date, if present.
changefreq Optional<String> null The change frequency, if present.
priority Optional<String> null The priority, if present.

SSRF policy configuration.

Field Type Default Description
denyPrivate boolean true If true, reject URLs that resolve to private/metadata IP ranges.
allowlist List<HostMatcher> Collections.emptyList() Hostnames and IP ranges permitted regardless of deny_private. The allowlist is an override of deny_private, not an intersection with it. Precedence, in order: 1. deny_private == false permits everything; the allowlist is not consulted. 2. A hostname matching an Exact or Suffix entry is permitted immediately, before DNS resolution — so the deny-list is never applied to it. This trusts the host string: a name that resolves into private space is still permitted. 3. A literal or resolved IP inside a Cidr entry is permitted even though it is in the default deny-list. 4. Otherwise the default deny-list decides. An empty allowlist therefore denies nothing by itself — it simply leaves deny_private and the deny-list in sole control.
maxRedirects byte 5 Maximum number of HTTP redirects to follow during validation.

Signature:

public static SsrfPolicy defaultOptions()

Example:

var result = SsrfPolicy.defaultOptions();

Returns: SsrfPolicy

Create a policy from environment variables.

On native platforms, reads CRAWLBERG_ALLOW_PRIVATE_NETWORK — if set to “1” or “true” (case-insensitive), sets deny_private = false. Otherwise, defaults to deny_private = true.

On wasm32 targets (browser/Node.js), environment variables are not accessible to the compiled module. Defaults to deny_private = false because:

  • Outbound requests in a browser go through the fetch API, which enforces its own network policies.
  • Rust-side SSRF checking is unenforceable and redundant in a wasm32 context.
  • For testing and localhost access, the host’s network sandbox is the enforcing boundary.

Node.js caveat: deny_private (whatever its value) has no effect on hostname-based requests under wasm32. There is no DNS resolution on this target, so validate_url only ever checks a literal IP host; a domain name falls straight through to Ok(()). In a browser this is covered by same-origin/CORS. Node’s fetch enforces no CORS, so a Node service embedding this wasm module can be driven to internal hosts by domain name even though deny_private = true. Do not rely on this policy to stop that in Node — enforce egress restrictions (network policy, firewall, proxy allowlist) outside the process.

Signature:

public static SsrfPolicy fromEnv()

Example:

var result = SsrfPolicy.fromEnv();

Returns: SsrfPolicy


When to use the headless browser fallback.

Value Description
AUTO Automatically detect when JS rendering is needed and fall back to browser.
ALWAYS Always use the browser for every request.
NEVER Never use the browser fallback.
STEALTH Always use the browser with all stealth surfaces enabled. Behaves like Always for escalation purposes (every request is routed through the browser tier), but additionally enables: - browser JavaScript stealth patches - native-backend TLS fingerprint spoofing - stealth-aware default user-agent when no explicit UA is set - 1920×1080 viewport override Use this instead of setting the now-removed BrowserConfig.stealth boolean field.

Wait strategy for browser page rendering.

Value Description
NETWORK_IDLE Wait until network activity is idle.
SELECTOR Wait for a specific CSS selector to appear in the DOM.
FIXED Wait for a fixed duration after navigation.

Browser backend used for JavaScript rendering.

Value Description
CHROMIUMOXIDE Existing Chromium/CDP backend powered by chromiumoxide.
NATIVE Crawlberg-owned native browser backend derived from Obscura.

Opt-in encoding applied to a downloaded document’s bytes for callers who need the content available in a serializable field rather than reading it from disk.

null (the CrawlConfig.document_content_encoding default) produces neither — unlike screenshots, base64-encoding a document by default would duplicate an already up-to-document_max_size buffer (50 MB default) in memory per document.

Value Description
BASE64 Populate DownloadedDocument.content_base64 with a base64-encoded copy.

Authentication configuration.

Value Description
BASIC HTTP Basic authentication. — Fields: username: String, password: String
BEARER Bearer token authentication. — Fields: token: String
HEADER Custom authentication header. — Fields: name: String, value: String

The classification of a link.

Value Description
INTERNAL A link to the same domain.
EXTERNAL A link to a different domain.
ANCHOR A fragment-only link (e.g., #section).
DOCUMENT A link to a downloadable document (PDF, DOC, etc.).

The source of an image reference.

Value Description
IMG An <img> tag.
PICTURE_SOURCE A <source> tag inside <picture>.
OG_IMAGE An og:image meta tag.
TWITTER_IMAGE A twitter:image meta tag.

The type of a feed (RSS, Atom, or JSON Feed).

Value Description
RSS RSS feed.
ATOM Atom feed.
JSON_FEED JSON Feed.

The category of a downloaded asset.

Value Description
DOCUMENT A document file (PDF, DOC, etc.).
IMAGE An image file.
AUDIO An audio file.
VIDEO A video file.
FONT A font file.
STYLESHEET A CSS stylesheet.
SCRIPT A JavaScript file.
ARCHIVE An archive file (ZIP, TAR, etc.).
DATA A data file (JSON, XML, CSV, etc.).
OTHER An unrecognized asset type.

An event emitted during a streaming crawl operation.

Not available on wasm32 targets — streaming requires native concurrency primitives (tokio channels, JoinSet) that are not supported on wasm32.

Delivered to bindings through each target’s native streaming idiom.

Value Description
PAGE A single page has been crawled. — Fields: result: CrawlPageResult
ERROR An error occurred while crawling a URL. — Fields: url: String, error: String
COMPLETE The crawl has completed. — Fields: pagesCrawled: long

A single page interaction action.

Actions are serialized with a type tag using camelCase naming, except ExecuteJs which is explicitly renamed to "executeJs".

Value Description
CLICK Click on an element matching the given CSS selector. — Fields: selector: String
TYPE_TEXT Type text into an element matching the given CSS selector. — Fields: selector: String, text: String
PRESS Press a keyboard key (e.g. “Enter”, “Tab”, “Escape”). — Fields: key: String
SCROLL Scroll the page or a specific element. — Fields: direction: ScrollDirection, selector: String, amount: long
WAIT Wait for a duration or for an element to appear. — Fields: milliseconds: long, selector: String
SCREENSHOT Take a screenshot of the current page. — Fields: fullPage: boolean
EXECUTE_JS Execute arbitrary JavaScript in the page context. Safety: The script runs with full page privileges in the browser context. Only execute scripts from trusted sources. — Fields: script: String
SCRAPE Scrape the current page HTML.

Direction for a scroll action.

Value Description
UP Scroll upward.
DOWN Scroll downward.

Hostname/IP allowlist matcher for SSRF policy.

Serializes as an internally-tagged object so each variant is distinguishable on the wire and round-trips losslessly:

{"type": "exact", "value": "api.example.com"}
{"type": "suffix", "value": ".example.com"}
{"type": "cidr", "value": "10.0.0.0/8"}

A bare JSON string is still accepted on deserialization and resolves to Exact, preserving configs written against the previous untagged representation.

Exact: HostMatcher.Exact

Value Description
EXACT Exact hostname match (case-insensitive). — Fields: value: String
SUFFIX Suffix match: “.xberg.io” matches “api.xberg.io” and “xberg.io”. — Fields: value: String
CIDR CIDR match: “10.0.0.0/8” matches IP addresses in that range. — Fields: value: String

Errors that can occur during crawling, scraping, or mapping operations.

Variant Description
NOT_FOUND The requested page was not found (HTTP 404).
UNAUTHORIZED The request was unauthorized (HTTP 401).
FORBIDDEN The request was forbidden (HTTP 403).
WAF_BLOCKED The request was blocked by a WAF or bot protection (HTTP 403 with WAF indicators). vendor is the lowercase identifier of the detected WAF (e.g. “cloudflare”, “datadome”). When the engine cannot identify the vendor, it uses “unknown”. message is the freeform description for logs and human readers. The stable error tag remains forbidden: waf/blocked: MESSAGE so existing log-grep patterns and cross-language bindings continue to work; vendor is surfaced separately for structured consumers.
TIMEOUT The request timed out.
RATE_LIMITED The request was rate-limited (HTTP 429).
SERVER_ERROR A server error occurred (HTTP 5xx).
BAD_GATEWAY A bad gateway error occurred (HTTP 502).
GONE The resource is permanently gone (HTTP 410).
CONNECTION A connection error occurred.
DNS A DNS resolution error occurred.
SSL An SSL/TLS error occurred.
DATA_LOSS Data was lost or truncated during transfer.
BROWSER_ERROR The browser failed to launch, connect, or navigate.
BROWSER_TIMEOUT The browser page load or rendering timed out.
INVALID_CONFIG The provided configuration is invalid.
UNSUPPORTED The requested capability is not supported by the active backend or build.
SSRF_POLICY_VIOLATION A URL was rejected by SSRF policy (private IP, metadata, disallowed scheme, etc).
OTHER An unclassified error occurred.

SSRF validation error.

Variant Description
DENIED_BY_POLICY URL denied by SSRF policy: private IP, metadata IP, etc.
NOT_ON_ALLOWLIST Host not on allowlist when an allowlist is configured.
INVALID_CIDR Allowlist entry is not a parseable CIDR block.
DNS_RESOLUTION_FAILED DNS resolution failed for hostname.
INVALID_URL Invalid URL format.
DISALLOWED_SCHEME URL scheme not in allowlist (e.g., ftp:// when only http/https allowed).
TOO_MANY_REDIRECTS Too many HTTP redirects encountered during validation.