zenrows CLI wraps every Zenrows primitive in one command, writes clean output to stdout and progress to stderr, and keeps a trace of every run. That makes it a natural fit for shell scripts, jq pipelines and cron jobs.
Uses: zenrows fetch, zenrows extract, zenrows batch, zenrows crawl, zenrows browser, traces
Ask your AI agent
With the Zenrows MCP server connected, or the CLI available to a coding agent such as Claude Code, paste this prompt:Install and log in
Install the CLI once, then set up a workspace with your API key.zenrows init creates the local .zenrows/ folder that holds your config, policy and run traces.
CLI
CLI
Fetch and extract into jq
zenrows fetch and zenrows extract use Adaptive Stealth Mode (mode=auto) by default. The page body goes to stdout and the status line goes to stderr, so pipes stay clean.
zenrows extract returns structured JSON, so you can pipe it straight into jq. With --css, you name the fields and their selectors:
CLI
--css, zenrows extract sends extract=auto for site-tailored fields on domains Zenrows has prepared, such as major retailers, and uses Autoparse on other domains.
Save any page as markdown with --output markdown and --out:
CLI
Script with —json
Every command accepts--json and prints a structured result instead of the body or the status line. Use it to branch on status or log cost in a script:
CLI
Run a URL list as one Batch job
For tens to thousands of URLs, submit them as one Batch job instead of a loop of fetches. The CLI reads a JSONL file with one{"url": ...} object per line.
1
Build the job file from a plain URL list
CLI
2
Estimate the cost locally
estimate validates the file and prints an upper bound, with no cloud call and no credits spent. Tasks in Adaptive Stealth Mode count at their highest possible cost.CLI
3
Submit and wait for the run
--follow polls until the run finishes. --output markdown sets the format of every result.CLI
4
Download every result
CLI
pages/ gets one file per task plus _manifest.jsonl, which maps each file to its URL and status:mode=auto bills only the configuration that succeeds. Check the real spend with zenrows batch status <job-id> --json, which returns stats.spend.credits.
Crawl a site, then batch what you found
zenrows crawl create discovers URLs from one start page. Feed the results straight into a Batch job:
CLI
/page/ lets the crawl walk the paginated listing, and the jq filter keeps only product URLs (88 of the 100 in this run). See Crawl from a seed URL for more patterns.
Drive a browser from the shell
When a page needs clicks or typing, open a Browser session. Each verb takes the--session id that open returns. Always close the session when you finish.
CLI
zenrows browser run script.json, which closes the session for you. See the Browser CLI guide.
Schedule it with cron
The CLI keeps your key and policy in.zenrows/, so a cron job only needs to run from that folder. This script refreshes the product pages every morning:
scrape.sh
crontab
Read a run’s trace
Everyfetch, extract, batch, crawl and browser run writes a record under .zenrows/runs/<run-id>/. The run id is in the status line (run r-1a9dfd1e).
CLI
trace inspect prints the full record as JSON, including the exact request parameters and costCredits. trace replay prints the command to run it again.
Customize it
Troubleshooting
AUTH_MISSING: no key in this workspace. Runzenrows login --api-key YOUR_ZENROWS_API_KEYfrom the project folder.No workspace foundontrace: traces live in.zenrows/. Runzenrows init --yesin the project folder, then run the command again.PARAM_CONFLICT_AUTO_MANUAL:--js-renderor--premium-proxyonfetchorextractneeds--manual. Add it, or drop those flags to keepmode=auto.POLICY_LIMIT_EXCEEDEDonbatch create: the estimate is above yourmax_credits_per_run. Split the file or raise the cap withzenrows policy set max_credits_per_run <n>.- The cron job finds no key: cron starts in your home folder.
cdinto the project folder first, as in the script above. - The cron job reports
zenrows: command not found: cron runs with a minimalPATH. Call the CLI by its full path, whichwhich zenrowsprints.
Related recipes
Scrape a list of URLs
Batch from the API and SDKs, with webhooks and reruns.
Prompts that put Zenrows MCP to work
The same jobs, done by your AI agent.
Track usage and control spend
Read per-request cost and set caps.
Resolve common response codes
Symptom-to-fix for 422, 429, 402 and more.