webscraping-ai-cli

July 17, 2026 · View on GitHub

npm CI

Official command-line client for the WebScraping.AI API. Fetch HTML, plain text, AI-extracted data, or single CSS selections from any URL — with JavaScript rendering, residential / stealth proxies, and per-country geolocation. See the API documentation for the full parameter reference.

Ships with an AI agent skill that you can install into Claude Code, Cursor, Windsurf, Kiro, OpenCode, Gemini CLI, GitHub Copilot, Augment, or Factory — your coding agent learns when and how to use the CLI for live page fetches.

Install

npm install -g webscraping-ai-cli
# or run without installing
npx -y webscraping-ai-cli --help

The package exposes two executables: webscraping-ai (primary) and wsai (short alias).

Authenticate

Sign up to get an API key — the free trial includes 2,000 credits, no credit card required. Your key lives in the dashboard.

Pick one:

# 1. Environment variable (simplest in CI)
export WEBSCRAPING_AI_API_KEY=your-key-here

# 2. Persist to ~/.config/webscraping-ai/config.json (chmod 0600)
webscraping-ai auth set your-key-here

# 3. Pass per command
webscraping-ai html https://example.com --api-key your-key-here

Commands

webscraping-ai html  <url> [flags]         # Full rendered HTML
webscraping-ai text  <url> [flags]         # Visible text (plain | json | xml)
webscraping-ai selected <url> --selector <css>           # One CSS area
webscraping-ai selected-multiple <url> --selector a --selector b ...
webscraping-ai ask <url> --question "..."  # AI question about the page
webscraping-ai extract <url> --fields '{"title":"...","price":"..."}'
webscraping-ai account                     # Remaining credits / quota

Common flags shared by every scrape command:

FlagPurpose
--js / --no-jsToggle JavaScript rendering (default: on)
--proxy TYPEdatacenter (default), residential, stealth
--country CCTwo-letter proxy country code
--device TYPEdesktop, mobile, tablet
--timeout MSTotal page-retrieval timeout (max 30000)
--js-timeout MSJS rendering time after page load (max 20000)
--wait-for CSSCSS selector to wait for
--headers JSONHTTP headers to forward; inline JSON or @file.json
--custom-proxy URLhttp://user:pass@host:port
--js-script CODECustom JS to evaluate on the target page
--error-on-404Treat 404 responses as errors
--error-on-redirectTreat redirects as errors
--output FILEWrite to FILE instead of stdout
--pretty / --no-prettyForce pretty / single-line JSON

<url> may be - to read URLs from stdin (one per line; lines starting with # are ignored).

Install the AI agent skill

# Just for Claude Code
webscraping-ai setup skill --editor claude-code

# All supported editors
webscraping-ai setup skill --all

# List what's supported
webscraping-ai setup list

Supported editor ids: claude-code, cursor, windsurf, kiro, opencode, gemini, copilot, augment, factory. Re-run with --force to overwrite existing installations.

You can also install the skill via the Claude Code Plugin Marketplace using the bundled plugins/webscraping-ai/.claude-plugin/marketplace.json.

Exit codes

CodeMeaning
0Success
2Usage error (commander)
3400 Bad Request from the API
4403 Authentication error
5402 Payment Required (out of credits)
6429 Rate limit
7500 Server error (or wrapped target-page error)
8Timeout (504 or local AbortController)
9Connection / DNS failure
1Anything else

Scripts can branch on these without parsing stderr.

Examples

# Fast static fetch
webscraping-ai html https://example.com --no-js

# Residential proxy from Germany, wait for a selector
webscraping-ai html https://geo.example.com \
  --proxy residential --country de --wait-for '.product-card'

# Pipe URLs through extract
cat urls.txt | webscraping-ai extract - \
  --fields '{"title":"Product title","price":"Current price"}' \
  --output products.ndjson

# Headers from a file
webscraping-ai html https://example.com --headers @./headers.json

License

MIT — © WebScraping.AI