/scraperapi:scraperapi-clifrom ScraperAPI
Reference for the ScraperAPI CLI tool (`sapi`) for scraping URLs, running async jobs, fetching structured data, and checking credits from a terminal or shell pipeline.
Ships in ScraperAPI. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
sapi)sapi is the official ScraperAPI command-line tool. It is the right choice when:
sapi … | jq …, xargs, make, GitHub Actions).--render or --premium unblocks a target before committing the choice to code.If the user is writing application code in Python, Node, PHP, Ruby, or Java, point them at the matching SDK skill instead — the CLI is for shells, not application logic.
npm install -g scraperapi-cli # requires Node.js 18+
sapi init # interactive: prompts for the key and validates it
Non-interactive setup (for CI / Dockerfiles):
sapi init --api-key YOUR_API_KEY
sapi looks for the API key in this order, stopping at the first hit:
--api-key <key> flag on the commandSCRAPERAPI_API_KEY environment variable~/.config/scraperapi/config.json (written by sapi init)In CI, prefer the env var — it keeps the key out of shell history and config files.
| Stream | What goes there |
|---|---|
| stdout | The data (page body, JSON, table rows) |
| stderr | Spinners, warnings, errors |
When stdout is not a TTY (a pipe or redirect), sapi automatically switches to JSON mode:
sapi scrape https://example.com | jq .body # auto-JSON
sapi scrape https://example.com > out.json # auto-JSON
sapi scrape https://example.com # human output (page body to stdout)
Force JSON mode in a TTY with --json. Force a specific body format with --output html|markdown|text|json|csv — --output overrides the non-TTY auto-JSON rule, so you can pipe raw HTML or markdown into another tool without it being wrapped in JSON.
sapi does not prompt for confirmation on expensive calls. If you want to check what a request will cost before running it, use sapi cost.
sapi scrape <url> — synchronous fetchThe workhorse command. Returns the page body to stdout.
sapi scrape https://example.com
sapi scrape https://example.com --render # 10 credits, JS rendering
sapi scrape https://example.com --render --wait-for "#main" # wait for selector
sapi scrape https://example.com --country uk # geotarget UK
sapi scrape https://example.com --premium # 10 credits, residential proxies
sapi scrape https://example.com --ultra-premium # 30 credits, hardest sites
sapi scrape https://example.com --autoparse --json # structured JSON for supported sites
sapi scrape https://example.com --screenshot --json # PNG (10 credits) returned as base64 in JSON
sapi scrape https://example.com --async # submit as async job, prints jobId
Always start at the cheapest option and only escalate when a request fails:
--render if the page loads content via JavaScript (SPA, hydrated tables, infinite scroll). 10 credits.--premium if the request fails with 500 or returns a block page from datacenter IPs. 10 credits.--ultra-premium only for the hardest anti-bot sites (Cloudflare Turnstile, sophisticated fingerprinting). 30 credits.Combining flags costs more than either alone: --render --premium is 25 credits, --render --ultra-premium is 75. 200 and 404 responses are charged; failed (500) ones are not.
| Flag | Description | Credits |
|---|---|---|
--render | JavaScript rendering | 10 |
--premium | Residential proxies | 10 (25 with --render) |
--ultra-premium | Advanced anti-bot bypass | 30 (75 with --render) |
--screenshot | PNG screenshot (base64 in JSON mode) | 10 |
--autoparse | Auto-parsed JSON for supported sites | — |
--country <cc> | Country code (e.g. us, uk, de). The UK is uk, not gb | — |
--device <type> | mobile or desktop user-agent | — |
--output <fmt> | html, markdown, text, json, csv | — |
--session <n> | Sticky session number (reuse IP) | — |
--wait-for <sel> | CSS selector to wait for (needs --render) | — |
--timeout <sec> | Request timeout (default 70). Only scrape has this flag | — |
--async | Submit as async job, print job ID, exit | — |
--json | Force JSON output mode | — |
--api-key <key> | Override the configured API key for one call | — |
There is no interactive confirmation step — sapi scrape runs the request immediately. Use sapi cost <url> (below) to preview credit cost without spending credits.
sapi cost <url> — preview credit costsapi cost https://example.com --json # {"credits":1}
sapi cost https://example.com --render --premium --json # {"credits":25}
sapi cost https://example.com --render --json | jq .credits
Use --json (or pipe the output) and read .credits. Accepts the same parameter flags as sapi scrape except --async and --timeout. Useful as a pre-flight check before running an expensive batch — wire it into a script when you want to fail fast if a chosen flag combination is more expensive than expected.
sapi jobs — async scrapingUse async for batches, slow targets, or fire-and-forget work.
sapi scrape https://example.com --async # returns a jobId on stdout
sapi jobs list # list all jobs
sapi jobs get <jobId> # poll every 2s until done, no time limit
sapi jobs get <jobId> --no-poll # one-shot status check
sapi jobs cancel <jobId> # cancel a running job
sapi jobs get without --no-poll waits until the job is finished or failed, with no timeout. A job that keeps retrying (async jobs can retry for up to 24 hours) makes a script hang. In scripts, poll with --no-poll in your own loop and give up after a deadline. Async jobs (the batch pipeline below) are the right tool whenever there are more than ~100 URLs — sync sapi scrape calls in a loop will burn through your concurrent request budget and hit 429s.
Submit one async job per URL, then poll each one. Any sapi scrape flag works here (--render, --premium, --autoparse, …), and ScraperAPI handles the retries:
# 1. Submit one async job per URL (urls.txt: one URL per line), keep the job ids.
while read -r URL; do
sapi scrape "$URL" --async --json < /dev/null | jq -r .id
done < urls.txt > job-ids.txt
# 2. Poll each one with a deadline (plain `jobs get` would wait forever on a stuck job).
while read -r ID; do
for _ in $(seq 1 60); do # ~10 minutes per job
JOB=$(sapi jobs get "$ID" --no-poll --json < /dev/null)
STATUS=$(echo "$JOB" | jq -r .status)
[ "$STATUS" = finished ] || [ "$STATUS" = failed ] && break
sleep 10
done
echo "$JOB" >> batch-results.ndjson
done < job-ids.txt
# 3. Extract bodies that succeeded.
jq -s '[.[] | select(.status=="finished") | .response.body]' batch-results.ndjson
sapi structured — pre-parsed JSON for supported sitesFor Amazon and Google searches, prefer structured over scraping and parsing HTML. The endpoints return clean, schema-stable JSON.
sapi structured amazon search "wireless headphones"
sapi structured google serp "best espresso machine"
sapi structured google news "artificial intelligence"
sapi structured google jobs "software engineer remote"
sapi structured google shopping "standing desk"
All structured commands accept --json for raw output (auto-on when piped). See docs.scraperapi.com for the schema of each vertical.
scrape --autoparseFor an Amazon, Walmart or eBay product, Google Maps, or Redfin, use sapi scrape with --autoparse and the page URL. ScraperAPI parses supported pages into JSON:
sapi scrape "https://www.amazon.com/dp/B07FTKQ97Q" --autoparse --json | jq '.body | fromjson'
sapi scrape "https://www.walmart.com/ip/5253396052" --autoparse --json | jq '.body | fromjson'
sapi scrape "https://www.ebay.com/itm/166619046796" --autoparse --json | jq '.body | fromjson'
In JSON mode, sapi scrape wraps the response as {"body": "<string>", "statusCode": 200}, so the parsed data is a JSON string inside .body, and fromjson turns it back into an object. Autoparse covers Amazon (product, search, offers, reviews), eBay (product, search), Walmart (product, category), Google (search, news, shopping, jobs, maps) and Redfin (for sale, for rent, search, agent pages). It costs the site's normal rate (5 credits for Amazon, Walmart and eBay).
sapi account — usage and creditssapi account --json # includes creditsLeft, requestCount, requestLimit, concurrencyLimit
sapi account --json | jq .creditsLeft
Use --json whenever you need the credit balance: creditsLeft is in the JSON output.
Run sapi account --json before anything large: it's the cheapest way to confirm the key works and that there are enough credits.
sapi config — stored API keysapi config list
sapi config get api_key
sapi config set api_key YOUR_API_KEY
Pass --country, --output and --timeout on each call. On a shared machine, use the SCRAPERAPI_API_KEY env var rather than storing the key in the config file.
pup, append to CSVURL="https://example.com"
TITLE=$(sapi scrape "$URL" --json | jq -r .body | pup 'title text{}')
echo "$URL,$TITLE" >> titles.csv
# crontab: 7am every day
0 7 * * * /usr/local/bin/sapi scrape "https://www.amazon.com/dp/B07FTKQ97Q" --autoparse --json \
| jq -c '.body | fromjson | {ts: now, price: .pricing}' >> ~/prices.ndjson
xargs# Run 5 in parallel; --json puts one record per line (no prompts to worry about).
cat urls.txt | xargs -n1 -P5 sapi scrape --render --json > out.ndjson
Above ~100 URLs prefer the async batch pipeline over this — it sidesteps the concurrent request limit.
sapi exits non-zero on any error (2 when credits are exhausted, 1 otherwise), so set -e works as expected:
set -euo pipefail
sapi account --json | jq -e '.creditsLeft > 1000' # fails the build if low
sapi scrape "$URL" --output markdown > page.md
sapi scrape "$URL" --output html > out.html \
|| sapi scrape "$URL" --render --output html > out.html \
|| sapi scrape "$URL" --premium --output html > out.html
Cheap → expensive, only paying for the next tier when the previous one fails. --output html keeps raw HTML in each redirect — without it the non-TTY rule would wrap the body in JSON.
sapisite: search and scrape it with the batch pipeline.| Symptom | Likely cause | Fix |
|---|---|---|
command not found: sapi | Not installed, or npm global bin not on $PATH | npm install -g scraperapi-cli; check npm config get prefix |
401 Invalid API key | Key missing or wrong | Run sapi account to confirm; re-run sapi init |
500 on a public page | ScraperAPI retried for 70s and still got blocked (not charged) | Retry with --premium, then --ultra-premium |
403, exit code 2 | Credits exhausted for this billing cycle | Check sapi account --json; upgrade or enable overages at https://dashboard.scraperapi.com/billing |
429 from sapi | Hit concurrent request limit | Switch to the async batch pipeline or lower the xargs -P cap |
| Script hangs forever | sapi jobs get polls with no time limit | Use --no-poll in a loop with a deadline (see the batch pipeline above) |
sapi scrape times out | Target is slow; default timeout is 70s | --timeout 120, or use --async. Other commands have no --timeout |
| Output is JSON instead of HTML | stdout is piped → auto-JSON | Force with --output html if you want raw HTML in a pipe |
See docs.scraperapi.com for the full parameter reference and current credit costs.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub scraperapi/scraperapi-skills --plugin scraperapi20 skills in this plugin
/scraperapi-agent-onboardingEntry point for agents and developers new to ScraperAPI. Read first when integrating ScraperAPI into an agent or app, setting up the MCP server for Claude Code or other LLM tools, choosing the right ScraperAPI product, or getting an API key. Trigger on: "how do I use ScraperAPI", "set up ScraperAPI", "connect ScraperAPI to Claude", "which ScraperAPI product should I use", "get web data for my agent", "add web scraping to my project", "ScraperAPI getting started". After reading, route to the narrower skill that owns the chosen path. If the user already named a language or SDK, n8n, Zapier, or the sapi CLI, use that skill directly instead.
Note: Transmits user-supplied queries, URLs, and content to ScraperAPI.
/scraperapi-asyncReference for ScraperAPI's Async Jobs REST API: submit scraping jobs in the background and get results by polling or webhook, including batch jobs. Consult when the user is scraping many URLs, needs non-blocking requests, or wants webhook delivery. Use when user asks: "how do I scrape 1000 URLs with ScraperAPI", "ScraperAPI async jobs", "batch scraping with ScraperAPI", "submit a scraping job and poll for results", "ScraperAPI webhook callback", "ScraperAPI batchjobs endpoint". Covers single and batch jobs, webhook callbacks, apiParams, async-only parameters, binary responses, retention, and error handling. It is language-agnostic: for SDK client code, use the language's SDK skill; to crawl a whole site by following links, use scraperapi-crawler.
Note: Transmits user-supplied queries, URLs, and content to ScraperAPI.
/scraperapi-crawlerProduct-usage reference for ScraperAPI's Crawler — crawl an entire site or section by following links automatically. Consult when the user needs to extract data from many pages of a site without knowing the URLs upfront. Use when user asks: "crawl an entire website with ScraperAPI", "scrape all pages on a domain", "follow links and scrape each page", "how do I use the ScraperAPI crawler API", "scrape a site map", "extract data from every product page on a site", "ScraperAPI crawler job API". Covers job creation, URL regex patterns, depth vs budget, per-page scraping parameters, job states, webhooks, scheduling, and credit costs. Also invoke when the user is building a site-wide scraper and asks which ScraperAPI product to use.
Note: Transmits user-supplied queries, URLs, and content to ScraperAPI.
/scraperapi-datapipelineProduct-usage reference for ScraperAPI's DataPipeline — managed, scheduled scraping projects that run automatically and deliver results to a webhook or dashboard download. Consult when the user needs recurring scraping, has a large list of URLs/ASINs/queries to process, or wants to avoid building and maintaining their own scraping infrastructure. Use when user asks: "schedule recurring scraping with ScraperAPI", "ScraperAPI DataPipeline", "how do I run a scraping project on a schedule", "scrape 10000 ASINs automatically", "ScraperAPI managed scraping project", "set up a ScraperAPI pipeline", "deliver scraping results to a webhook automatically". Covers project types, input methods, scheduling, output delivery, the DataPipeline API, job management, and credit costs.
Note: Transmits user-supplied queries, URLs, and content to ScraperAPI.
/scraperapi-java-sdkBest-practices reference for the ScraperAPI Java SDK (com.scraperapi:sdk Maven artifact). Consult whenever the user is writing, debugging, or reviewing Java code that calls ScraperAPI. Use when user asks: "scrape a website with Java and ScraperAPI", "ScraperAPI Java example", "how do I add ScraperAPI to my Maven project", "Java ScraperAPI render", "ScraperAPI Java fluent API", "ScraperAPI Java premium proxy", "ScraperAPI Java error handling", "ScraperAPI Java retry". Covers Maven/Gradle setup, the fluent builder API, all request parameters, the escalation ladder, async jobs, structured data calls, error handling, and credit costs.
Note: Transmits user-supplied queries, URLs, and content to ScraperAPI.
/scraperapi-lead-enrichmentUse this skill whenever the user wants to enrich one contact or company and build a profile. Trigger on: "enrich this lead", "find info about [person or company]", "build a contact card for X", "I have this LinkedIn URL, find more about them", "find the email for [person] at [company]", "research this contact", "I have an email, can you find more details". Accepts any seed: a name, company name, LinkedIn URL, email address, domain, or a mix. Searches Google and fetches pages through the ScraperAPI MCP server, then builds a structured contact card with person fields (name, title, email, phone, LinkedIn, location, social) and company fields (domain, revenue, funding, employee count, founded year, HQ, tech stack, investors, news, competitors). It works on one person or company at a time: for a whole market, category or competitor landscape, use scraperapi-market-research.
Note: Transmits user-supplied queries, URLs, and content to ScraperAPI.
Other plugins' skills for the same job