hen 0.20.1

Run protocol-aware API request collections from the command line or through MCP.
Documentation
---
title: Run Hen from the CLI
description: Use run, verify, inspect, and import from the terminal for local workflows and automation.
---

Hen has four primary commands:

- `hen run` executes a collection or request
- `hen verify` parses and validates a collection without making requests
- `hen inspect` exposes machine-readable authoring structure for editor tooling and automation
- `hen import` lowers OpenAPI 3.x specs into editable `.hen` collections

## Pick the right command

| Command | Use it when you want to... |
| --- | --- |
| `hen run` | execute a collection or one request |
| `hen verify` | validate structure before anything runs |
| `hen inspect` | expose authoring data to editors or scripts |
| `hen import` | turn an OpenAPI spec into a starter Hen collection |

## Common flows

```bash
hen verify ./examples/lorem.hen
hen run ./examples/lorem.hen 0
hen run ./examples/lorem.hen all --non-interactive
hen inspect ./examples/lorem.hen --output json
hen import ./examples/openapi_import.yaml --output ./examples/openapi_imported.hen
```

## OpenAPI import

- `hen import <spec-path> [selector] --output <collection.hen>` accepts OpenAPI 3.0.x and 3.1.x YAML or JSON.
- Omit the selector or use `all` to import every safely materializable operation.
- Use an `operationId`, `METHOD /path`, `tag:name`, or numeric index to import one operation.
- Supported schema lowering includes object-shaped `allOf`, named `oneOf(...)` and `anyOf(...)` unions, scalar `const(...)` tags, and `discriminator(...)` unions when the OpenAPI shape is representable.
- Successful imports can still emit warnings for approximations such as reduced auth flows or omitted unsupported schema details.

## Selection and prompts

- If a directory contains one `.hen` file, Hen selects it automatically.
- If a collection contains multiple requests, provide an index or `all` to bypass the picker.
- The text CLI prompts for unresolved `[[ prompt ]]` placeholders.
- `--non-interactive` disables selection prompts and fails when required prompt values are missing.
- Use repeated `--input key=value` flags to provide prompt values up front.
- Use `--env <name>` to apply a named collection environment before request execution.

## Output formats

| Format | Use it when you want... |
| --- | --- |
| `text` | terminal-first use |
| `json` | structured automation |
| `ndjson` | streaming machine-readable logs |
| `junit` | CI test reporting |

```bash
hen run ./examples/lorem.hen all --non-interactive --output json
hen inspect ./examples/lorem.hen --output json
```

## Useful options

- `--body none|selected|failed|all`
- `--parallel`
- `--max-concurrency N`
- `--continue-on-error`
- `--benchmark N`
- `--export`
- `--verbose`

For the full command surface, argument list, and option descriptions, see the
[CLI Reference](./reference.md).