# Command line

> Every command, option and exit code of porticol-cli, the command-line runner.

Canonical: https://porticol.app/docs/cli

[View as Markdown](https://porticol.app/docs/cli.md)

`porticol-cli` runs collections, flows and performance tests in CI, and lints and diffs OpenAPI documents. This page is its help, as `porticol-cli help` prints it. Each command has a page of its own: [run](https://porticol.app/docs/cli/run), [perf](https://porticol.app/docs/cli/perf), [flow](https://porticol.app/docs/cli/flow), [diff](https://porticol.app/docs/cli/diff), [lint](https://porticol.app/docs/cli/lint), [guard](https://porticol.app/docs/cli/guard), [mcp](https://porticol.app/docs/cli/mcp), [login](https://porticol.app/docs/cli/login), [logout](https://porticol.app/docs/cli/logout), [whoami](https://porticol.app/docs/cli/whoami), [collections](https://porticol.app/docs/cli/collections), [environments](https://porticol.app/docs/cli/environments), [init](https://porticol.app/docs/cli/init), [completion](https://porticol.app/docs/cli/completion), [help](https://porticol.app/docs/cli/help) and [version](https://porticol.app/docs/cli/version).

## Install

```
curl -fsSL https://porticol.app/install.sh | sh      macOS and Linux, with the app
irm https://porticol.app/install.ps1 | iex           Windows PowerShell, with the app
or take an archive: https://porticol.app/download.html#cli
```

## First run

```
porticol-cli init                                writes a collection, an environment and a workflow
porticol-cli login                               signs in and keeps an API token
porticol-cli run orders.json -e staging.json
```

## Examples

```
porticol-cli run checkout.json
porticol-cli run checkout.json -e staging.json -r junit:report.xml
porticol-cli run --server https://cloud.porticol.app --collection Orders
porticol-cli perf ping.json -u 25 --duration 5m --threshold p95=500
porticol-cli diff base.yaml head.yaml --fail-on breaking
porticol-cli guard scan
porticol-cli guard proxy
porticol-cli guard log verify
porticol-cli guard log export --format csv
```

## Usage

```
porticol-cli run <collection-file|folder> [options]
porticol-cli run --server <url> --collection <id|name> [options]
porticol-cli perf <collection-file|folder> [options]
porticol-cli perf --server <url> --collection <id|name> [options]
porticol-cli flow <flow-file> [options]
porticol-cli diff <base-document> <head-document> [options]
porticol-cli lint <document> [options]
porticol-cli guard scan [<folder>]
porticol-cli guard proxy [--port 7777] [--data-dir <path>]
porticol-cli guard hook <claude|codex|cursor> [--data-dir <path>]
porticol-cli guard log verify [--data-dir <path>]
porticol-cli guard log export --format <json|csv> [--since <date>] [--output <file>] [--data-dir <path>]
porticol-cli agent setup --print-trust [--data-dir <path>]
porticol-cli mcp [--data-dir <path>] [--read-only]
porticol-cli approve <id> [--data-dir <path>]
porticol-cli deny <id> [--data-dir <path>]
porticol-cli login [--server <url>] [--workspace <name|id>] [--token <token>]
porticol-cli logout
porticol-cli whoami [--server <url>]
porticol-cli collections [--server <url>]
porticol-cli environments [--server <url>]
porticol-cli init [<folder>]
porticol-cli completion <bash|zsh|fish>
porticol-cli help [<command>]
porticol-cli version
```

## Commands

| Command | What it does |
| --- | --- |
| `run` | send a collection's requests, once or per data row |
| `perf` | hold a collection under load and check its thresholds |
| `flow` | run a flow the app exports |
| `diff` | compare two OpenAPI documents and fail on what breaks |
| `lint` | check an OpenAPI document against the style rules |
| `guard` | find keys, serve Guard's proxy and hooks, verify or export the record |
| `agent` | print what a runtime needs to trust Guard's local proxy |
| `mcp` | serve a workspace to an agent over MCP on standard input |
| `approve` | allow a call an agent is waiting on, after typing its code |
| `deny` | deny a call an agent is waiting on |
| `login` | sign in and keep a token for --server |
| `logout` | forget the token this machine keeps |
| `whoami` | say which server the kept token is for |
| `collections` | list the collections a token can reach |
| `environments` | list the environments a token can reach |
| `init` | write a starter collection, environment and workflow |
| `completion` | print a shell completion script |
| `help` | this text, or one command's part of it |
| `version` | the version of this binary and its platform |

## Run options

| Option | What it does |
| --- | --- |
| `-d, --data <file>` | a CSV or JSON dataset, one row per iteration |
| `-n, --iterations <n>` | how many times to run the collection |
| `--concurrency <n>` | requests in flight at once; --bail stops scheduling new ones after the first failure |
| `--delay <ms>` | the wait before each request but the first |
| `--timeout <ms>` | the request timeout where the collection sets none, 30000 by default |
| `--max-time <time>` | stop the whole run after this, as 30s or 10m |
| `--retry <n>` | try a request the transport could not send n more times |
| `--bail` | stop at the first failing request |
| `--schema <document>` | check every response against an OpenAPI document |
| `--fail-on-http-error` | a response of 5xx fails the run even with no assertion |
| `--open` | open the HTML report when it is written |

## Perf options

| Option | What it does |
| --- | --- |
| `-u, --users <n>` | virtual users, 1 to 200 (default 10) |
| `--duration <time>` | how long the load lasts, as 1500ms, 90s, 5m or 1h, from 1s to 1h (default 60s) |
| `--ramp-up <time>` | the users start spread across this (default 0s) |
| `--threshold <measure=n>` | the run fails unless this holds: p50, p90, p95, p99, max and mean in ms, and error_rate in percent, at most n; requests_per_second at least n. Repeatable |
| `--timeout <ms>` | as for run |
| `-d, --data <file>` | a CSV or JSON dataset, read round-robin by the users |
| `--max-time <time>` | stop the load after this, as 30s or 10m |
| `--retry <n>` | try a request the transport could not send n more times |

## Flow options

| Option | What it does |
| --- | --- |
| `--bail` | stop the flow at the first failing request |
| `--max-time <time>` | stop the flow after this, as 30s or 10m |

## Diff options

| Option | What it does |
| --- | --- |
| `--fail-on <level>` | breaking (the default), potentially-breaking, none |
| `-f, --format text\|json` | what to print; the default is text |
| `-r, --reporter text\|json` | the same as --format |

## Lint options

| Option | What it does |
| --- | --- |
| `--rule <names>` | rule names to run, comma-separated |
| `--rules <names>` | the same, and a name ending in .yaml, .yml or .json is a rule configuration file |
| `--config <file>` | a YAML or JSON rule configuration: severities, and rules turned off |
| `-f, --format text\|json` | what to print; the default is text |
| `-r, --reporter text\|json` | the same as --format |

## Mcp

Every send and run goes through Guard's policy: a call it asks about waits for a person in Porticol or for porticol-cli approve, and every call is recorded.

## Guard

scan reads a folder six levels deep for .env files, .npmrc tokens and service account keys, and your home folder for AWS credentials, .netrc passwords and Kubernetes tokens. It prints where each key is, never its value. proxy serves Guard's local proxy for a sandboxed agent on 127.0.0.1 only: it injects the key the policy names for a host, asks a person before a risky call and records every call. hook answers an agent's hook: claude, codex and cursor each read that hook's JSON on standard input and get the answer their agent expects. Claude Code and Codex leave an HTTP call to Guard's proxy; a command that changes how its calls reach the proxy, or names a guarded host Guard cannot read as one plain call, fails closed, with Claude Code asking and Codex denying. Cursor's hook decides one plain curl, wget or httpie call, asks on a command it cannot read, and waits 25 seconds for a person; it also decides a remote MCP server by its URL. log verify walks every workspace's chain and names the first entry that does not match the one before it. log export writes every entry as JSON or CSV, with no secret value. The CSV's first columns answer a CERT-In request: who, which agent, what call, what decision, which rule, who approved it and when. The column guide is at [https://porticol.app/docs/guides/guard-log-export.html](https://porticol.app/docs/guides/guard-log-export.html)

## Agent

| Option | What it does |
| --- | --- |
| `setup --print-trust makes Guard's local certificate authority on first use, its` | key in the keychain and its certificate in the data folder, and prints the variables that make Node, Python, curl and other runtimes trust it and send through Guard's proxy, plus the line that adds it to Java. |

## Mcp options

| Option | What it does |
| --- | --- |
| `--data-dir <path>` | the workspace to serve: PORTICOL_DATA_DIR, or the desktop's data folder |
| `--read-only` | serve only the tools that read; the default serves the whole MCP tool table |
| `--create` | create the data folder when it is not there yet |

## Approval options

| Option | What it does |
| --- | --- |
| `--data-dir <path>` | the workspace the approval is in: PORTICOL_DATA_DIR, or the desktop's data folder |

## Login options

| Option | What it does |
| --- | --- |
| `--server <url>` | the server to sign in to, or PORTICOL_SERVER |
| `--workspace <name\|id>` | the workspace the token acts in; the default one without it |
| `--token <token>` | store a token made on the portal's API tokens page, reading no browser |

## Sources

| Option | What it does |
| --- | --- |
| `--server <url>` | a Porticol Cloud or Team Server, or PORTICOL_SERVER |
| `--token <token>` | an API token for it, or PORTICOL_TOKEN, or the file named by PORTICOL_TOKEN_FILE, or the one login kept |
| `--collection <id\|name>` | the server's collection to run |
| `--folder <name\|id>` | run this folder's requests alone |
| `-e, --environment <file\|name>` | an environment file, or the name or id of one of the server's environments; file: and env: say which |
| `--remote` | run on the server rather than here (run only) |

## Secrets

| Option | What it does |
| --- | --- |
| `--secret <name=value>` | a secret variable, repeatable; above the environment file and the server's values, masked in every report |
| `--secret <name>` | the same, with the value read from the variable name |
| `--env-var <name>` | the same: the value is the process variable of that name |
| `--env-file <file>` | names to read from a .env file, one NAME=VALUE a line |

## Project

porticol.toml beside the collection names environment, data, timeout and reports; a flag always wins over it

## Reports

| Option | What it does |
| --- | --- |
| `-r, --reporter <name[:path]>` | cli, junit, json or html, to standard output or to the file at path; repeat for several. perf reports as cli, json or html |
| `--junit <path>` | the same as -r junit:<path> |
| `--json <path>` | the same as -r json:<path> |
| `--html <path>` | the same as -r html:<path> |

## Output

| Option | What it does |
| --- | --- |
| `--color <auto\|always\|never>` | colour in the report; auto is a terminal, or CLICOLOR_FORCE in the environment |
| `--no-color` | the same as --color never |
| `-q, --quiet` | the totals alone: no header, no result lines, and no notices |
| `--silent` | nothing on standard output; file reports still written |
| `--no-progress` | the results at the end rather than as they finish |
| `--verbose` | every assertion and every console line |

porticol-cli never prompts, except login, which opens a browser, and approve and deny, which ask for the code shown in Porticol. Only mcp reads standard input, speaking MCP over it. A collection file runs with no account. Running or listing a server's collections and environments needs one: sign in with porticol-cli login, or pass a token. A server does not give out the values of secret variables, so a run asks for each one with --secret or --env-var before it sends anything.

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | every request, assertion and threshold passed |
| 1 | an assertion, a schema check or a threshold failed, a flow stopped, or the run was stopped with Ctrl-C |
| 2 | a request could not be made |
| 3 | the command line, a file, the configuration, the token or a variable is wrong |
| 4 | the licence refused the run |
| 5 | the head document breaks the base document, at the level --fail-on names |
| 6 | the document has a lint finding of severity error |

## See also

- [this text, with examples](https://porticol.app/docs/cli.html)
- [a pipeline to copy](https://porticol.app/docs/automation.html)
