# Command line: vp

> The vp command line tool: pages as Markdown, structured data, screenshots, PDFs, site maps, crawls and web search from your terminal, scripts and AI coding agents.

Source: https://docs.virginproxy.com/cli/

`vp` brings VirginProxy to your terminal, shell scripts and AI coding agents: a page as clean Markdown with one command, structured product or article data, screenshots, PDFs, every address of a site, crawls and web search – human-readable by default, JSON with `--json`.

*Three examples:*

```
vp scrape https://example.com/
vp scrape https://shop.example/item/42 --render-auto --auto-extract product --json
vp search "open source vector database" --limit 5 --scrape
```

## Install

One file, no dependencies; it needs Node.js 18 or newer. Download it, make it executable and put it on your `PATH`:

*macOS and Linux:*

```bash
curl -fsSLo vp https://docs.virginproxy.com/cli/vp.mjs
chmod +x vp
sudo mv vp /usr/local/bin/vp
vp --version
```

On Windows, save [`vp.mjs`](https://docs.virginproxy.com/cli/vp.mjs) and run it with `node vp.mjs …`. Version 0.1.0.

> **Note:** The command line tool is offered as a file on this site; there is no npm package yet.

## Sign in

*Store your key:*

```
vp login      # paste your key – the input is hidden; it is checked and stored
vp whoami     # vp_live_…a1b2 (live) from ~/.config/virginproxy/key
vp logout     # deletes the stored key
```

`vp login` checks the key with `GET /v1/account` and stores it in `~/.config/virginproxy/key` (or `$XDG_CONFIG_HOME/virginproxy/key`) readable only by you (mode 600). The key is never printed. You can also pipe it in (`printf %s "$KEY" | vp login`) or set an environment variable instead:

| Variable | Meaning |
| --- | --- |
| `VP_API_KEY` | Your key. Takes precedence over the stored one. `VP_KEY`, the name the SDKs use, works too. |
| `VP_API_URL` | Another API address, for example a local stub in your tests. Default `https://api.virginproxy.com`. |

> **Tip:** Try every command at no cost with a test key (`vp_test_…`): the answers are samples. See [Test mode](https://docs.virginproxy.com/test-mode/).

## Examples

*Examples:*

```
# A page as Markdown of its main content (cost line on stderr)
vp scrape https://example.com/ > page.md

# Use a browser only when the page needs one; get product data as JSON
vp scrape https://shop.example/item/42 --render-auto --auto-extract product --json

# Only the article, without navigation; personal data blanked out
vp scrape https://example.com/blog/post --include-selector "main article" --redact email,phone

# A PDF document as Markdown (first 20 pages)
vp scrape https://example.com/report.pdf --max-pages 20 -o report.md

# Your own fields by CSS selector
vp scrape https://example.com/ --extract '{"title": "h1", "links": {"selector": "a", "attr": "href", "all": true}}' --json

# Screenshot of the whole page, and the page as PDF
vp screenshot https://example.com/ --full-page -o page.png
vp pdf https://example.com/ -o page.pdf

# Every address of a site, then a crawl of its docs, one JSON line per page
vp map https://example.com/ --search blog > urls.txt
vp crawl https://example.com/ --limit 50 --include-path "/docs/**" --wait --json > pages.ndjson

# Web search; with --scrape every result page comes as Markdown too
vp search "best trail running shoes 2026" --limit 5 --scrape

# Jobs
vp jobs list
vp jobs get job_8fK2pQ7wLz3nVd0sXa4T --wait 25
vp jobs export job_8fK2pQ7wLz3nVd0sXa4T --format csv -o results.csv

# Credits left and usage per day
vp usage --days 7
```

## Output, errors and exit codes

- Without `--json` the result goes to stdout – the page body, one address per line, numbered search results – and the status, the credits it cost and notes go to stderr, so pipes stay clean. `-q` silences stderr.
- With `--json` you get the API's JSON answer. Crawl results with `--wait`, `vp jobs stream` and `vp jobs results --all` are NDJSON: one result per line.
- With `--auto-extract` or `--extract` (and without `--json`) only the extracted data is printed, as JSON.
- Screenshots, PDFs and binary page bodies (with `-o`) are written to files. `-o -` writes them to stdout.
- Errors print the API's code and message, for example `vp: credits_exhausted: …`; with `--json` they are `{"error": {"code", "message"}}` on stdout. See [Errors](https://docs.virginproxy.com/errors/).
- `busy`, `rate_limited`, `concurrency_limited`, `maintenance` and the other short-lived codes are retried after the time the API asks for (2 times; `--retries`). Nothing else is retried, so nothing is charged twice.

| Exit code | Meaning |
| --- | --- |
| `0` | OK. |
| `1` | The API answered with an error, or it could not be reached. |
| `2` | Wrong usage (unknown option, missing argument) or no API key. |

## Every command

Read from the tool itself – the same text as `vp <command> --help`. Global options for every command: `--json`, `-q` / `--quiet`, `--timeout <seconds>` (default 180), `--retries <n>`, `-h` / `--help`, `-V` / `--version`.

### `vp scrape`

*vp scrape --help:*

```bash
vp scrape <url> [options]

Fetch one page (default: Markdown of its main content).

Options:
  --render               Load the page in a browser (adds 9 credits).
  --render-auto          Try without a browser first; use one only if the page needs it.
                         Only the answer you get is charged.
  --format <f>           markdown (default), text, clean_html or raw.
  --no-main-content      Keep the whole page, not only its main content.
  --auto-extract <type>  product, article, job, review_list, recipe, event or organization.
  --redact <list>        email,phone,iban,card,ip or all – blank these out in the answer.
  --include-selector <css> / --exclude-selector <css>   Narrow what is converted.
  --no-images / --no-links                              Leave images / links out of Markdown.
  --max-pages <n>        For PDF/Office documents: pages to convert (1–500).
  --wait-for <css>, --wait-until <load|domcontentloaded|networkidle>, --wait-ms <ms>,
  --scroll <n>, --trace, --screenshot                   Browser options (need --render/--render-auto).
  --parse <list>         e.g. metadata,links,headings (or serp).
  --extract <json>       Extraction rules, e.g. '{"title":"h1"}' or @rules.json.
  --browser, --locale, --session, --fresh-ip, --preset <name>
  --max-credits <n>      This request never costs more.
  --tag <label>          Your label, filterable in usage.
  --data <json>          Any other POST /v1/requests options, merged in (JSON, @file or -).
  -o, --output <file>    Write the page body to a file (binary bodies are decoded).

Without --json the page body goes to stdout and a cost line to stderr. With --auto-extract or
--extract only the extracted data is printed (as JSON).
```

### `vp screenshot`

*vp screenshot --help:*

```bash
vp screenshot <url> [-o file.png] [options]

Save a screenshot of a page (10 credits up to 1 MB loaded).

Options:
  -o, --output <file>    Where to save it (default: <host>.png; "-" for stdout).
  --full-page            The whole page, not only the visible part.
  --selector <css>       Only this element.
  --format <png|jpeg|webp>, --quality <1-100>, --width <px>, --height <px>, --scale <0.5-4>
  --wait-until <load|domcontentloaded|networkidle>, --wait-for <css>, --wait-ms <ms>, --scroll <n>
  --browser, --locale, --timezone, --color-scheme <light|dark>, --block image,font,…
  --session, --fresh-ip, --max-credits <n>, --tag <label>
```

### `vp pdf`

*vp pdf --help:*

```bash
vp pdf <url> [-o page.pdf] [options]

Save a page as a PDF document (10 credits up to 1 MB loaded).

Options:
  -o, --output <file>    Where to save it (default: <host>.pdf; "-" for stdout).
  --wait-until, --wait-for, --wait-ms, --scroll, --browser, --locale, --timezone,
  --color-scheme, --block, --session, --fresh-ip, --max-credits, --tag   As for screenshot.
```

### `vp request`

*vp request --help:*

```bash
vp request <json | @file.json | ->

Send any POST /v1/requests body as it is (prints the full answer as JSON).

Example: vp request '{"url":"https://example.com/","format":"text"}'
```

### `vp map`

*vp map --help:*

```bash
vp map <url> [options]

List the addresses of a website (links and sitemaps).

Options:
  -n, --limit <n>        Addresses at most.
  --search <text>        Only addresses (or link texts) containing this text.
  --sitemap <include|skip|only>
  --include-subdomains   Also addresses on subdomains.
  --render               Load the start page in a browser first (10 credits or more).
  --robots <ignore|respect|report>
  --max-credits <n>      Bound for all reads of this call together.

Without --json: one address per line on stdout.
```

### `vp crawl`

*vp crawl --help:*

```bash
vp crawl <url> [options]

Crawl a website in the background (a job); optionally wait and print the pages.

Options:
  -n, --limit <n>        Pages at most (max_pages; your plan's job limit applies).
  --depth <n>            Links away from the start page (0 = only the start page).
  --include-path <p>     Follow only matching paths, e.g. /blog/** (repeat or comma-separate).
  --exclude-path <p>     Never follow matching paths.
  --include-subdomains, --ignore-query, --robots <ignore|respect>
  --format <f>           Format of every page (default markdown), --no-main-content,
  --render / --render-auto, --auto-extract <type>, --redact <list>
  --request <json>       Any other per-page options (merged in).
  --max-credits <n>      Cost cap of the whole crawl.
  --webhook-url <https>  Send results there as well.
  --wait                 Wait and print each page as it finishes (NDJSON with --json).

Without --wait the job id is printed; follow it with: vp jobs get <id> --wait 25
```

### `vp search`

*vp search --help:*

```bash
vp search <query> [options]

Search the web; with --scrape also fetch every result page.

Options:
  --engine <name>        Search engine (default duckduckgo, about 1 credit per results page).
  -n, --limit <1-50>     Results (default 10).
  --language <bcp47>     e.g. en, de-DE (default en).
  --country <cc>         Two-letter country for the search itself.
  --time-range <day|week|month|year>
  --include-domain <d>, --exclude-domain <d>   Repeat or comma-separate (each ≤ 20).
  --scrape               Fetch every result page too (each is charged like a request).
  --format <f>, --render, --render-auto, --scrape-options <json>   How result pages are fetched.
  --max-credits <n>      Cost cap of the whole search.

Cost: each results page is charged like a normal request, plus each fetched result.
```

### `vp jobs`

*vp jobs --help:*

```bash
vp jobs <list|get|results|stream|cancel|export> [id] [options]

Jobs and crawls: list, progress, results, live stream, cancel, export.

Subcommands:
  vp jobs list [--limit n] [--before job_id]
  vp jobs get <id> [--wait 1-30]           Progress; --wait holds until something changes.
  vp jobs results <id> [--status s] [--offset n] [--limit n] [--all]
                                           --all pages through every result (NDJSON with --json).
  vp jobs stream <id>                      Print results as they finish, until the job ends.
  vp jobs cancel <id>
  vp jobs export <id> [--format ndjson|csv|json] [--status s] [--no-include-body] [-o file]
```

### `vp usage`

*vp usage --help:*

```bash
vp usage [--days n] [--tag label]

Plan, credits left and usage per day.

Reads GET /v1/account and GET /v1/usage (the usage part needs a key with the read permission).
```

### `vp account`

*vp account --help:*

```bash
vp account

Your plan, credits and limits as JSON.
```

### `vp login`

*vp login --help:*

```bash
vp login [--no-verify]

Store your API key in ~/.config/virginproxy/key (mode 600).

Reads the key from stdin (typed without echo on a terminal, or piped:
  vp login < key.txt     or     printf %s "$KEY" | vp login
The key is checked with GET /v1/account unless --no-verify. It is never printed.
VP_API_KEY in the environment takes precedence over the stored key.
```

### `vp logout`

*vp logout --help:*

```bash
vp logout

Delete the stored key.
```

### `vp whoami`

*vp whoami --help:*

```bash
vp whoami

Which key is used (masked) and where it comes from.
```

## What it costs

Every command prints what it cost. In short (all rules on [Credits and billing](https://docs.virginproxy.com/billing/)):

| Command | Credits |
| --- | --- |
| `vp scrape` | About 1 per MB loaded. `--render` adds 9. `--render-auto` tries without a browser first and only the answer you get is charged. |
| `vp screenshot`, `vp pdf` | 10 for up to 1 MB loaded. |
| `vp map` | Each page and sitemap read, usually 1 each. |
| `vp crawl` | Every page like a scrape. Always set `--limit`; `--max-credits` caps the whole crawl. |
| `vp search` | One request per results page, plus one per fetched result with `--scrape`. |
| `vp jobs`, `vp usage`, `vp login` | Free. |

`--max-credits <n>` caps a single call.

## For AI coding agents (Claude Code, Codex …)

Agents that can run shell commands can use `vp` directly. The ready-made skill file [`SKILL.md`](https://docs.virginproxy.com/cli/SKILL.md) tells them when to use it, which command fits, what it costs and how to handle the key:

*Claude Code: install the skill:*

```
mkdir -p ~/.claude/skills/virginproxy
curl -fsSLo ~/.claude/skills/virginproxy/SKILL.md https://docs.virginproxy.com/cli/SKILL.md
```

For Codex and other agents, put the file into the agent's skills or instructions folder (for example next to your `AGENTS.md`).

> **Warning:** Never paste an API key into an agent chat. Run `vp login` yourself in a terminal, or set `VP_API_KEY` in the environment the agent runs in. The skill tells the agent to ask you to do exactly that. Give each agent its own key with a credit limit ([Manage keys](https://docs.virginproxy.com/security/#keys-api)).

Agents that speak MCP can also use the [MCP server](https://docs.virginproxy.com/ai-agents/) instead of the command line.
