Expand AI logo
DocsDocs
API Reference
Login

Documentation

Start

WelcomeQuickstartCLI & AgentsAPI Reference

Concepts

Progressive DisclosureState JSONAppendixCitationsSearch & HighlightingSpatial MarkdownInclude OptionsBatched Fetch

Product

FetchMCPCLI

SDKs

SDKsTypeScript SDKPython SDK

CLI

Command-line interface for expand.ai

Use the Expand CLI to authenticate locally, fetch pages from a terminal, and install agent integrations.

Installation

Install the CLI globally with your package manager.

npm install -g expandai
pnpm add -g expandai
bun add -g expandai

Authenticate

For local development and agent harnesses, sign in through the browser. The CLI stores the local credential and reuses it for commands and MCP.

expandai login

Use EXPAND_API_KEY for CI, servers, and other non-interactive environments where browser login is not available.

Fetch from the terminal

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

fetch prints Markdown by default. Use JSON output when you need response metadata or other included evidence.

Install agent integrations

Claude Code and OpenCode use hooks:

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

Cursor and Codex use a skill plus MCP:

expandai skill install cursor project
expandai mcp install cursor project
expandai skill install codex project
expandai mcp install codex project

Use global instead of project only when Expand should be available in every project on this machine.

Check authentication

expandai whoami
PreviousMCP
NextSDKs

On This Page

InstallationAuthenticateFetch from the terminalInstall agent integrationsCheck authentication