Expand AI logo
DocsDocs
Glow Active
API Reference
Login

Documentation

Get Started

OverviewWhy ExpandQuickstartWays to Use Expand

Agent Quickstarts

OverviewExpand SkillClaude CodeCursorCodexOpenCodeSkill-Based AgentsOther MCP Clients

Fetch

OverviewHow Fetch WorksOutput ModelInclude OptionsBrowser BehaviorHighlightsPlayground & ReplayBatched Fetch

Reference

API ReferenceCLI CommandsMCP Tools & ResourcesTypeScript SDK

Account & Billing

Pricing & UsageTiersFAQ

Machine-Readable Docs

start.mdllms.txtllms-full.txtDocs as Markdown
Browse docs

Get Started

OverviewWhy ExpandQuickstartWays to Use Expand

Agent Quickstarts

OverviewExpand SkillClaude CodeCursorCodexOpenCodeSkill-Based AgentsOther MCP Clients

Fetch

OverviewHow Fetch WorksOutput ModelInclude OptionsBrowser BehaviorHighlightsPlayground & ReplayBatched Fetch

Reference

API ReferenceCLI CommandsMCP Tools & ResourcesTypeScript SDK

Account & Billing

Pricing & UsageTiersFAQ

Machine-Readable Docs

start.mdllms.txtllms-full.txtDocs as Markdown

Overview

Fetch renders live pages and returns agent-ready Markdown, State JSON, evidence, and replayable snapshots.

Fetch renders live web pages and returns agent-ready Markdown, structured state, citations, and replayable snapshots. Start with the main content, then ask for more when the task needs it.

More answers, fewer tokens. Fetch separates signal from noise before your agent sees the page. It returns the main working document first, preserves structured state and spatial layout when they matter, and keeps deeper evidence reachable by reference instead of flooding the context window.

Less context does not mean throwing data away. Fetch preserves the page, then gives the agent the right entry point.

HTML-to-Markdown is not enough anymore. Fetch keeps the tables, icons, layout, hidden JSON, citations, and replay links that ordinary Markdown drops.

One request

Send a URL, get back agent-ready context. The canonical call is POST /v1/fetch:

curl https://api.expand.ai/v1/fetch \
  -H

"x-expand-api-key:
$EXPAND_API_KEY
"
\
-H "Content-Type: application/json" \
-d '{"url":"https://news.ycombinator.com"}'

Need a key and a first run? Start with the Quickstart.

What comes back

Fetch gives agents the page as a working document, not a screenshot of the DOM and not a lossy scrape. One request returns layers an agent can read in order:

Frontmatter
Main Markdown
Spatial Markdown for tables, grids, icons, and layout
State JSON when useful
Appendix references
snapshotId
citations / Playground link

The default is Markdown first, structured state when useful, and references to more when the agent needs depth.

Quickstart

Run one Fetch and inspect the output.

How Fetch Works

Learn the mental model behind the output layers.

Output Model

Map product layers to exact response fields.

Read the Fetch section

How Fetch Works

Understand Main Markdown, State JSON, Appendix, snapshots, citations, and progressive disclosure.

Output Model

See response fields, frontmatter, metadata, JSON Mode, snapshot IDs, and references.

Include Options

Choose Markdown, State JSON, appendix, metadata, screenshots, HTML, response data, and more.

Browser Behavior

Understand JavaScript rendering, scrolling, screenshots, timeouts, and page limitations.

Highlights

Ask focused questions over captured evidence without fetching the same page again.

Playground & Replay

What Fetch preserves

Fetch turns one page into layers instead of one flattened stream. Each layer links to where it is defined in full.

LayerWhat it gives the agentGo deeper
FrontmatterPage metadata, URL, title, snapshot ID, and request context before the document body.Output Model
Main MarkdownThe high-signal working document your agent should read first.How Fetch Works
Spatial Markdown

When the origin fails

Not every URL can be fetched. The domain may not resolve, the certificate may be broken, nothing may be listening, or the origin may answer with a 404. Those are the origin's failures, not Expand's, and Fetch reports them as such.

A non-2xx status means Expand failed. A 200 means Expand did its job, and the body reports what the origin did.

POST /v1/fetch/json returns a typed FetchOriginError instead of a document when the origin was never reached:

{
  "_tag": "FetchOriginError",
  "url": "https://checkout.deadstartup.example/pricing",
  "kind": "dns",
  "upstreamError": "net::ERR_NAME_NOT_RESOLVED",
  "retryable": false
}

When the origin did answer with an error status, the captured content still comes back — error pages are often the answer you needed — with the outcome attached beside it:

{
  "meta": { "url": "https://site.example/removed-page", "title": "Page not found" },
  "markdown": "# Page not found\n\n…",
  "json": [],
  "originError": {






POST /v1/fetch answers in Markdown, so the same facts ride the x-expand-origin-error, x-expand-origin-error-detail, and x-expand-origin-error-retryable response headers; when no document exists, the body is a short Markdown error document an agent can read directly.

kind is one of dns, tls, connectionRefused, connectionReset, connectionClosed, addressUnreachable, emptyResponse, connectionTimeout, or http. Trust retryable: it is derived from the exact Chromium network code, so transient resets, closes, empty responses, DNS timeouts, and connection timeouts report true. Unreachable origins are not billed; captured error pages are. See Error Handling for the full taxonomy and Pricing & Usage for billing by outcome.

Ways to call Fetch

The API, SDKs, CLI, MCP, and agents all call the same Fetch. Pick the one that fits your stack; the output model is the same.

PathWhere to start
APIAPI Reference
TypeScript SDKTypeScript SDK
Python SDKComing soon
CLI

When to use Fetch

Use Fetch for agent research, docs ingestion, product and pricing pages, dashboard-like pages, JavaScript-rendered content, and any workflow where source evidence matters.

A simpler path may be enough for already-clean Markdown or a known API that exposes exactly the data you need. Browser automation is the better tool when the primary task is operating a site, filling forms, or completing a multi-step workflow.

Next steps

  • Quickstart: run one Fetch.
  • Why Expand: understand what Fetch preserves beyond plain Markdown.
  • How Fetch Works: learn the mental model.
  • API Reference: use exact endpoint schemas.
PreviousOther MCP Clients
NextHow Fetch Works

On This Page

One requestWhat comes backRead the Fetch sectionWhat Fetch preservesWhen the origin failsWays to call FetchWhen to use FetchNext steps

Inspect what Fetch saw, debug citations, and share replayable evidence links.

Batched Fetch

Fetch many URLs asynchronously and poll for results.

Layout-aware Markdown for tables, grids, icons, pricing pages, dashboards, and UI-heavy pages.
How Fetch Works
State JSONStructured app and network state, included when it helps answer questions Markdown cannot.How Fetch Works
AppendixSecondary regions, navigation, sidebars, and links without flooding the main document.Include Options
Evidence & ReplayCitations, source IDs, snapshotId, Playground links, and replayable captures.Playground & Replay
"
_tag
"
:
"FetchOriginError"
,
"url": "https://site.example/removed-page",
"kind": "http",
"originStatusCode": 404,
"retryable": false
}
}
CLI Commands
MCPMCP Tools & Resources
AgentsAgent Quickstarts