For the complete documentation index, see llms.txt. This page is also available as Markdown.

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-cli

Authentication

sapi looks for your API key in this order:

  • --api-key flag

  • SCRAPERAPI_API_KEY environment variable

  • Config 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 .statusCode

Commands & Flags

Command
Result

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.

For detailed information on the CLI and examples, visit the scraperapi-cli npm package.

Last updated