fetch
Fetch any URL and convert it to clean Markdown for AI processing. Supports HTML, PDF, JSON, and SPA data extraction with advanced features.
Instructions
Fetch a URL and convert to clean markdown for LLM consumption.
Content conversion (automatic by Content-Type):
HTML → clean markdown (boilerplate removed, links preserved)
PDF → markdown with headings and table detection (requires pdf feature)
JSON/plain text → passthrough
SPA data auto-extracted (NEXT_DATA, NUXT, APOLLO_STATE, etc.)
Network features:
HTTP/2 multiplexing, HTTP/3 (QUIC) with 0-RTT
TLS 1.3, Brotli/Zstd/Gzip decompression
Realistic browser fingerprints (Chrome/Firefox/Safari)
Browser cookie injection (Brave/Chrome/Firefox/Safari)
Diff mode (diff: true):
Compares current content against the previous snapshot for this URL
Returns only the changed sections (token-efficient for monitoring tasks)
First fetch caches the page; subsequent fetches return semantic diffs
Unchanged content returns a 5-token confirmation instead of full body
Focus mode (focus: query):
Keeps only sections relevant to the query (BM25 scoring)
Replaces dropped sections with '[N sections omitted]' markers
Diff markers are always preserved regardless of relevance
Token budget (max_tokens: N):
Structure-aware truncation preserving headings, code, and tables
Priority: title > code/tables > headings (30% cap) > body > blockquotes
Returns: Markdown-converted body with timing info (or diff when diff: true).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | ||
| cookies | No | ||
| diff | Yes | When true, return only changed content vs the previous snapshot. On first fetch the page is cached and full content is returned. On subsequent fetches only the semantic diff is returned, saving tokens for monitoring or change-detection workflows. | |
| focus | No | Natural-language query to focus extraction on relevant sections. When set, uses BM25 scoring to keep only the sections most relevant to the query, replacing omitted sections with count markers. Dramatically reduces token count for large documents when you know what you're looking for. | |
| headers | Yes | ||
| max_tokens | No | Maximum token budget for the returned content. When set, performs structure-aware truncation that preserves headings, code blocks, and tables before trimming body text. Uses priority scoring: title/summary first, then code/tables, then headings (capped at 30% of budget), then body text. | |
| session | No | Named session for cookie persistence across calls. When set, nab uses an isolated per-session cookie jar so that `Set-Cookie` response headers from one call are automatically included on the next call with the same session name. Use this to maintain authenticated state across multiple `fetch` calls after a `login`. Session names: 1-64 chars, alphanumeric + hyphens + underscores. Sessions are created implicitly on first use and live for the process lifetime. Absent = stateless global client (no change). | |
| url | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Markdown-converted body content | |
| content_type | No | Response Content-Type header | |
| has_diff | Yes | True when diff mode was requested and content changed since last snapshot | |
| status | Yes | HTTP status code | |
| timing_ms | Yes | Round-trip time in milliseconds | |
| url | Yes | The fetched URL |