> ## 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`.

# Fetch

> Get any page as clean, usable content from the terminal, reliably, even if it's dynamic, JavaScript-heavy, or protected.

`zenrows fetch` retrieves a single page and returns its HTML, Markdown, or plain text. It handles JavaScript rendering and anti-bot protection automatically, so most calls need no extra flags.

```bash theme={"theme":"css-variables"}
zenrows fetch <url> [flags]
```

## Examples

```bash theme={"theme":"css-variables"}
# Just works, no flags needed
zenrows fetch https://httpbin.io/html

# Markdown output
zenrows fetch https://example.com --output markdown

# Take manual control of rendering and proxies
zenrows fetch https://example.com --manual --js-render --premium-proxy

# Geo-target and wait for an element
zenrows fetch https://example.com --proxy-country us --wait-for ".price"

# Save the response to a file
zenrows fetch https://example.com --out page.html
```

> [!TIP]
>
> Start with the defaults. Only add `--manual --js-render --premium-proxy` after a run's trace (`zenrows trace explain <run-id>`) shows it's actually needed, each flag raises cost.

## Flags

| Flag | Description |
| - | - |
| `--manual` | Take manual control of rendering and proxies instead of the automatic default |
| `--js-render` | Render JavaScript (manual mode only) |
| `--premium-proxy` | Use residential IPs (manual mode only) |
| `--proxy-country <cc>` | Geo-target. Works alone by default; in manual mode requires `--premium-proxy` |
| `--wait <ms>` | Fixed wait after load |
| `--wait-for <selector>` | Wait for a CSS selector |
| `--js-instructions <json>` | JSON instructions to run on the page |
| `--session-id <n>` | Keep the same IP across requests |
| `--original-status` | Return the target's original HTTP status |
| `--output <fmt>` | `html` (default), `markdown`, `text`, or `pdf` |
| `--screenshot` | Capture an above-the-fold screenshot |
| `--out <file>` | Write the response body to a file |
| `--timeout <ms>` | Client-side timeout for each request, in milliseconds (default `200000`, above the API's 3-minute limit) |
| `--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](#retries) |
| `--no-signup` | Do not auto-create a Free-plan account if no key exists |
| `--json` | Print a structured result instead of the raw body |

## Retries

`zenrows fetch` and `zenrows extract` send each request once by default. Pass `--retries <n>` (CLI 1.13.0 or later) to retry up to `n` times after:

1. A `429`, `502`, `503` or `504` from the API. None of these is charged.
2. A failure to connect: a refused connection, a name that did not resolve, a connect timeout or an unreachable network. The request never reached the API.

```bash theme={"theme":"css-variables"}
zenrows fetch https://www.scrapingcourse.com/ecommerce/ --retries 2
```

The CLI never retries:

1. Its own timeout (`--timeout`), or any other network error, such as a connection that closed after the request was sent. The API may still finish that request and charge it.
2. Any status under `--original-status`, because the API then returns the target site's own status.
3. `zenrows extract prepare` and `prepare status`.

Before each retry, the CLI waits the API's `Retry-After` in whole seconds, from 0.25 s to 30 s. Otherwise it waits a random time from 0.25 s up to 1 s before the first retry, 2 s before the second, and so on, capped at 30 s. A retry starts only if its wait ends within 90 s of the first request. A running request is not cut short, so a command can take longer than that.

If a `502`, `503` or `504` is still the answer after the retries, the error is `FETCH_FAILED`, for example "The Zenrows API answered HTTP 503 after 2 retries.", and it tells you to wait a minute and run the same command again. A `429` keeps its usual error. An invalid value, such as `--retries -1`, is an `INVALID_USAGE` error.


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