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 SDKPython 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 SDKPython SDK

Account & Billing

Pricing & UsageTiersFAQ

Machine-Readable Docs

start.mdllms.txtllms-full.txtDocs as Markdown

CLI Commands

Reference for the expandai CLI: fetch pages, search snapshots, manage local auth, and install agent integrations.

Reference for the expandai CLI: fetch pages, search existing snapshots, manage local auth, and install agent integrations. Every command, argument, and flag below is documented exactly as the CLI exposes it.

Need the CLI? Start with Quickstart, then come back here for the full command reference. The expandai package is not published yet, so treat install instructions as provisional and get the current install method from Quickstart. Once expandai is on your PATH, the commands here are the complete surface.

Most common

expandai fetch https://news.ycombinator.com
expandai fetch


https://example.com
--format
json
expandai fetch https://example.com --search "authentication"
expandai login
expandai whoami

Jump to: Fetch · Highlights · Auth · Agent setup · Cleanup

Command index

Commands are grouped by job. Each one is copyable as written.

JobCommandWhat it does
Fetchexpandai fetch <url>Fetch a page, print agent-ready Markdown.
Fetchexpandai fetch <url> --format jsonFetch a page, print structured JSON.
Highlights

Config is set through environment variables (EXPAND_API_KEY, EXPAND_API_URL) and the local config file under XDG_CONFIG_HOME. See Auth and configuration.

Batched Fetch has no CLI command today. Start and poll batched runs through the API or SDKs. See Batched Fetch.

Fetch content

expandai fetch <url>

Fetch a rendered web page and print agent-ready Markdown.

expandai fetch <url>
expandai fetch https://news.ycombinator.com
ArgumentRequiredDescription
urlYesURL to fetch. Common bare hosts may be normalized to https://...; localhost URLs are supported. Flag-like or otherwise invalid URLs are rejected.
OptionValuesDefaultDescription
--formattext, jsontextControls CLI output format.
--searchstring

Output. Default text output prints Markdown to stdout. --format json prints structured Fetch output. With --search, text mode prints Highlights snippets instead of the full page.

The CLI does not expose Include Options through an --include flag today, and --format accepts only text or json, not markdown.

Related: Fetch Overview · Output Model · Include Options · API Reference

expandai fetch <url> --format json

Fetch a page and print structured JSON instead of text Markdown.

expandai fetch https://example.com --format json

JSON output is what you want when a script needs fields — metadata, Markdown, and State JSON when present — rather than terminal Markdown. State JSON is usually included in the main content; large state may be returned by reference instead.

This is not equivalent to every API Include Options combination. The CLI does not expose the nested include controls that the API offers; for that level of control, call the API directly. See Include Options.

Highlights

--search and expandai search both return Highlights — the most relevant snippets of a page for a query. text/json Both accept --max-results (1–50, default 5) and --min-score (0–1, default 0.6).

expandai fetch <url> --search <query>

Fetch a page and return the most relevant Highlights snippets for a query.

expandai fetch https://example.com --search "pricing"

This performs a new Fetch, then runs the query against the captured page. It uses inline Fetch JSON Mode with search in the request payload — not the snapshot-search endpoint — so it always recaptures the URL.

Text output includes source and score headers plus an auditable citation link for each snippet. JSON output follows the API result shape. Default corpus behavior is covered on the Highlights page.

Related: Highlights · Output Model · Playground & Replay · fetch.fetchJson

expandai search <snapshotId> <query>

Search an existing snapshot without fetching the page again.

expandai search <snapshotId> <query>
expandai search 019... "return policy"
ArgumentRequiredDescription
snapshotIdYesExisting snapshot ID to search.
queryYesSearch query for Highlights.
OptionValuesDefaultDescription
--formattext, jsontextControls CLI output format.
--max-results to

Use search for snapshot reuse: it queries a page you already captured and skips the network round trip. If you do not have a snapshotId yet, run expandai fetch <url> --search <query> instead.

Related: Highlights · Playground & Replay · fetch.fetchSearch (/v1/fetch/search)

Auth and configuration

expandai login

Store local credentials for CLI and local integration use. interactive

expandai login

The command is interactive and supports two paths: browser login and API-key login. API-key auth is the normal production and server path. Credentials are written to the local Expand CLI config file (see Environment and config). Do not paste API keys into shell history; let login prompt for them.

expandai whoami

Check which Expand account or credential the CLI is using.

expandai whoami

This is the first command to run when Fetch, MCP, skills, or hooks fail because of auth. If whoami shows the wrong account or no credential, run expandai login.

expandai logout

Clear local stored Expand credentials.

expandai logout

Environment and config

NameTypeDescription
EXPAND_API_KEYenv varAPI key override for CLI and API clients.
EXPAND_API_URLenv varAPI base URL override, mainly for staging or self-hosted internal use.
XDG_CONFIG_HOME

Authored cURL examples authenticate with the API-key header, not bearer:

x-expand-api-key: $EXPAND_API_KEY

Agent setup

These commands wire Expand into local agent hosts: MCP config, the Expand Skill, and native-fetch hooks. The per-host quickstarts own the recommended setup and verification flow — Claude Code, Cursor, Codex, and OpenCode. agent setup

Install and uninstall commands take an explicit <scope> of global or project. Project scope writes files into the current working directory, so run these from the project root you want them in.

expandai mcp run [--docs]

Run the local Expand MCP server over stdio.

expandai mcp run
expandai mcp run --docs

MCP clients and generated MCP config launch this command; you rarely run it by hand. Plain mcp run exposes the Fetch tools. --docs additionally exposes Expand docs resources. First-class installers do not enable --docs by default. Full tool schemas live in MCP Tools & Resources; there is no hosted or remote Expand MCP server today.

expandai mcp install <host> <scope>

Install Expand MCP config for a supported local agent host.

expandai mcp install <host> <scope>

Hosts: claude-code, cursor, opencode, codex. Scopes: global, project.

expandai mcp install codex project
expandai mcp install cursor project

expandai mcp uninstall <host> <scope>

Remove Expand MCP config for a supported host and scope.

expandai mcp uninstall codex project

expandai skill install <host> <scope>

Install the Expand Skill for a supported agent host.

expandai skill install <host> <scope>

Hosts: claude-code, cursor, opencode, codex. Scopes: global, project.

expandai skill install codex project
expandai skill install claude-code project

Skills teach agents how to use Expand. Project scope writes skill files into the current project — commit them only if you want the skill enabled for collaborators. The command requires an explicit scope; it does not default to project. Detailed behavior lives on the Expand Skill page.

expandai skill uninstall <host> <scope>

Remove the Expand Skill for a host and scope.

expandai skill uninstall codex project

expandai hook install <host> <scope>

Install an Expand hook for hosts that can route native web-fetch behavior through Expand.

expandai hook install <host> <scope>

Hosts: claude-code, opencode. Scopes: global, project.

expandai hook install claude-code project
expandai hook install opencode project

Hook behavior is host-specific. The host pages own the full setup and verification flow.

expandai hook uninstall <host> <scope>

Remove an Expand hook for a host and scope.

expandai hook uninstall opencode project

expandai hook claude-code and expandai hook opencode

Runtime commands invoked by the Claude Code and OpenCode hook integrations. integration runtime

expandai hook claude-code
expandai hook opencode

These are integration-facing, not primary user commands. Most users should hook install or hook uninstall and never call them directly — the host invokes them when a hook fires.

Cleanup

expandai uninstall [target] [host] [scope]

Remove Expand integration files across hooks, skills, and MCP config.

expandai uninstall [target] [host] [scope]
  • target selects a surface such as all, hook, skill, or MCP.
  • host narrows cleanup to a supported host.
  • scope narrows cleanup to global or project files.
  • With no arguments, the command uses broad cleanup defaults.
expandai uninstall
expandai uninstall mcp codex project
expandai uninstall skill claude-code project

Project-scoped cleanup depends on the current working directory. Run cleanup from the same project root you used during installation, or it will not find the files to remove.

Related pages

TopicPage
Install and first fetchQuickstart
Human vs. agent routingWays to Use Expand
Fetch product behaviorFetch Overview
Output fields
PreviousAPI Reference
NextMCP Tools & Resources

On This Page

Most commonCommand indexFetch contentexpandai fetch <url>expandai fetch <url> --format jsonHighlightsexpandai fetch <url> --search <query>expandai search <snapshotId> <query>Auth and configurationexpandai loginexpandai whoamiexpandai logoutEnvironment and configAgent setupexpandai mcp run [--docs]expandai mcp install <host> <scope>expandai mcp uninstall <host> <scope>expandai skill install <host> <scope>expandai skill uninstall <host> <scope>expandai hook install <host> <scope>expandai hook uninstall <host> <scope>expandai hook claude-code and expandai hook opencodeCleanupexpandai uninstall [target] [host] [scope]Related pages
expandai fetch <url> --search <query>
Fetch a page, return Highlights snippets.
Highlightsexpandai search <snapshotId> <query>Search an existing snapshot, no recapture.
Authexpandai loginStore local credentials (browser or API key).
Authexpandai whoamiReport the current auth state.
Authexpandai logoutClear local stored credentials.
MCPexpandai mcp run [--docs]Run the local stdio MCP server.
MCPexpandai mcp install <host> <scope>Install Expand MCP config for a host.
MCPexpandai mcp uninstall <host> <scope>Remove Expand MCP config for a host.
Skillsexpandai skill install <host> <scope>Install the Expand Skill for a host.
Skillsexpandai skill uninstall <host> <scope>Remove the Expand Skill for a host.
Hooksexpandai hook install <host> <scope>Install an Expand fetch hook for a host.
Hooksexpandai hook uninstall <host> <scope>Remove an Expand fetch hook for a host.
Cleanupexpandai uninstall [target] [host] [scope]Remove installed Expand integration files.
none
Returns Highlights snippets for the query instead of the full page Markdown.
--max-results1 to 505Maximum Highlights snippets when --search is used.
--min-score0 to 10.6Minimum Highlights relevance score when --search is used.
1
50
5
Maximum snippets.
--min-score0 to 10.6Minimum relevance score.
env var
Changes where the CLI stores expandai/config.json.
~/.config/expandai/config.jsonfileDefault local config path when XDG_CONFIG_HOME is not set.
Output Model
Include controlsInclude Options
HighlightsHighlights
Citations and replayPlayground & Replay
Agent setupAgent Quickstarts
Skill behaviorExpand Skill
MCP schemasMCP Tools & Resources
Endpoint contractsAPI Reference