ScraperAPI CLI
The scraperapi-cli npm package exposes the full ScraperAPI surface as a command-line tool (sapi). Use it from the shell, in bash pipelines, cron jobs, or CI/CD workflows.
Requirements
Node.js 18 or higher
ScraperAPI account and API key
Installation
npm install -g scraperapi-cliAuthentication
sapi looks for your API key in this order:
--api-keyflagSCRAPERAPI_API_KEYenvironment variableConfig file written by
sapi init
Quick Start
# 1. Configure your API key (from https://dashboard.scraperapi.com)
sapi init
# 2. Scrape a page
sapi scrape https://example.com
# 3. Pipe output into another tool
sapi scrape https://example.com --json | jq .statusCodeCommands & Flags
sapi init
Interactive setup. Prompts for your API Key and saves it to config.
sapi scrape <url>
Scrape a URL. Check the 'Flags' tab to see all supported parameters.
sapi cost <url>
Check credit cost without executing.
sapi jobs
Manage async jobs (list, get, cancel, batch up to 50k URLs).
sapi structured
Fetch structured data from Amazon, Google, Walmart, eBay and Redfin
sapi crawler
Crawl an entire domain and scrape all discovered URLs.
sapi pipeline
Manage DataPipeline projects.
sapi account
View account usage and manage API Key.
sapi config
Read and write config defaults without re-running sapi init.
--render
JavaScript rendering
--premium
Residential proxies
--ultra-premium
Advanced anti-bot bypass
--screenshot
Capture PNG screenshot
--autoparse
Return structured JSON
--country <cc>
Geotarget (ISO 3166-1, e.g. us, gb, de)
--device <type>
mobile or desktop user-agent
--output <fmt>
html, markdown, text, json, csv
--session <n>
Sticky session (reuse same IP)
--wait-for <sel>
CSS selector to wait for (requires --render)
--timeout <sec>
Request timeout in seconds (default: 70)
--async
Submit as async job, print job ID and exit
--json
Output raw JSON to stdout
For detailed information on the CLI and examples, visit the scraperapi-cli npm package.

