> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zenrows.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Zenrows HTTP API serves Fetch and Extract (extract=auto) at https://api.zenrows.com/v1/, Crawl at https://api.zenrows.com/v1/crawls, and Batch at https://async.api.zenrows.com/v1. Fetch, Extract, Crawl and Batch are described in OpenAPI 3.1 at https://www.zenrows.com/openapi.json and listed in the RFC 9727 API catalog at https://www.zenrows.com/.well-known/api-catalog. Every endpoint also has its own page under /api-reference with its schema. Use the spec for exact parameter names and types. Crawl's endpoints, parameters and errors are also at https://docs.zenrows.com/crawl/endpoints.md. To call Zenrows from an agent, connect the MCP server at https://mcp.zenrows.com/mcp. To search these docs from an agent, connect the docs MCP server at https://docs.zenrows.com/mcp. Agent skills for Zenrows are published at https://github.com/ZenRows/cli and install with `npx skills add ZenRows/cli`.

# Extract

> Turn any messy web page into structured JSON, exact fields you pick, or Markdown, from the terminal.

`zenrows extract` fetches a page and converts it into structured data: site-tailored JSON with [Extract](https://docs.zenrows.com/extract/introduction.md) (`extract=auto`, the default) on any prepared domain, fields you choose with CSS selectors, or Markdown.

```bash theme={"theme":"css-variables"}
zenrows extract <url> [flags]
zenrows extract prepare <domain> --url <page-url> [--url <page-url>...] [--wait]
zenrows extract prepare status <domain>
```

## Examples

```bash theme={"theme":"css-variables"}
# Site-tailored JSON with Extract (default method), on a prepared domain
zenrows extract https://www.scrapingcourse.com/ecommerce/

# CSS selector map, on any domain
zenrows extract <url> --css '{"title":"h1","price":".price"}' --validate

# Built-in output filters
zenrows extract <url> --outputs emails,links

# Convert to Markdown
zenrows extract <url> --output markdown
```

## Flags

The default method is Extract (`extract=auto`). Pick at most one other method per call: `--css`, `--outputs`, `--output`, or the deprecated `--autoparse`.

| Flag | Description |
| - | - |
| `--css <json>` | CSS selector map, e.g. `'{"title":"h1","price":".price"}'` |
| `--outputs <list>` | Built-in output filters as JSON: `emails`, `phone_numbers`, `headings`, `images`, `audios`, `videos`, `links`, `menus`, `hashtags`, `metadata`, `tables`, `favicon`, comma-separated, or `*` for all |
| `--output <fmt>` | `markdown` or `text` conversion instead of extraction |
| `--autoparse` | Deprecated general-purpose JSON, on any domain. Runs only when you pass it |
| `--validate` | Fail if the result is not valid JSON, or if every field came back empty |
| `--manual` / `--js-render` / `--premium-proxy` | Same manual fetch controls as [`zenrows fetch`](https://docs.zenrows.com/cli/fetch/introduction) |
| `--proxy-country <cc>` | Geo-target |
| `--wait <ms>` / `--wait-for <selector>` | Same wait controls as `zenrows fetch` |
| `--retries <n>` | Retry a `429`, `502`, `503` or `504`, or a failure to connect, up to `n` times. Default `0`: the request is sent once. See [Retries](https://docs.zenrows.com/cli/fetch/introduction.md#retries) |
| `--out <file>` | Write output to a file |
| `--no-signup` | Do not auto-create a Free-plan account if no key exists |
| `--json` | Print a structured result |

## When Extract refuses a page

When Extract refuses a page with [`REQS007`](https://docs.zenrows.com/api-error-codes#REQS007), `zenrows extract` reports one of three CLI error codes and prints the next step. It never retries with Autoparse. Each CLI code maps to one API `reason` value, but the names differ:

| CLI error code | API case | Next step |
| - | - | - |
| `EXTRACT_DOMAIN_NOT_PREPARED` | Domain not prepared (`domain_not_prepared`) | Prepare it with `zenrows extract prepare`, below |
| `EXTRACT_PAGE_NOT_RECOGNISED` | Page not recognised on a prepared domain (`page_not_recognised`) | See below. Preparing again does not change it |
| `EXTRACT_DOMAIN_NOT_ENABLED` | Extract not enabled for the site (`domain_not_enabled`) | Use `--css`, or contact support. Preparing does not change it |

On a domain Extract hasn't prepared:

```bash theme={"theme":"css-variables"}
zenrows extract prepare example.com --url https://www.example.com/products/a --url https://www.example.com/products/b --url https://www.example.com/products/c --wait
zenrows extract https://www.example.com/products/d
```

| Flag | Description |
| - | - |
| `--url <page-url>` | 1 to 5 real pages you want to extract. One works; we recommend 3 or more of the same page type. Repeat the flag |
| `--wait` | Poll every 30 seconds until the domain is `ready` or `failed`. Off by default |
| `--timeout <seconds>` | Stop waiting after this long (default 900). The preparation keeps running |

Without `--wait`, the command returns at once; check progress and your monthly allowance with `zenrows extract prepare status <domain>`. Preparing takes a few minutes, costs no credits, and uses one slot of the monthly allowance; a domain that is already prepared answers `ready` at once and uses none. The domain is the host: a leading `www.` is dropped, and any other subdomain is prepared on its own. `prepare` never creates an account, so it needs an API key.

`prepare` and `prepare status` are never retried: a `429` there means the monthly allowance is used up, and a `503` means preparation is unavailable right now.

`EXTRACT_PAGE_NOT_RECOGNISED` (also `REQS007`) means the domain is prepared, but Extract did not recognise this page as one it can extract. It may be a page with nothing to extract, such as a home page. Try a product, article or listing page instead, retry it once in a few minutes if it should work, or use `--css`. Preparing the domain again does not change it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.