Skip to main content
The CLI is agent-first: the default output is structured JSON — no spinners, no color codes, no decorations. Just parseable data on stdout. Progress, warnings, and errors go to stderr so piping always works cleanly. Humans can opt into a prettier experience with --human.

Default: JSON (Agent-Friendly)

Every command outputs clean JSON by default. The response follows the HeyGen API envelope shape — a top-level data field wraps the payload:

--human: Pretty Output for Humans

Add --human when you’re working interactively. You get tables, colorized status values, and human-readable timestamps:
For get commands (single resource), --human renders a key-value layout:
When --wait is used in human mode, the CLI shows a live spinner on stderr while polling:
On a non-TTY stderr (e.g. in CI with --human), the spinner falls back to plain-text status lines:

Errors

Errors always go to stderr as a structured JSON envelope, regardless of output mode:
In --human mode, errors render as readable text instead:
The request_id field is included when the error comes from the API (from the X-Request-ID response header). It is omitted for local errors such as bad flags or missing credentials.

Exit Codes

Exit code 4 is distinct from 1 so agents and scripts can tell “the resource was created but we don’t know the final status” apart from a hard failure. Stdout will contain the last known resource state when exit 4 occurs.

Configuring a Default Output Mode

Set a persistent default so you don’t need --human on every command:
Valid values are json (default) and human. The priority order is: --human flag → HEYGEN_OUTPUT env var → config set output → default (json)

Stdout vs Stderr

The CLI strictly separates data from everything else:
  • stdout — JSON payload only. This is what gets piped to jq, captured in shell variables, or consumed by agents.
  • stderr — progress indicators, warnings, and error messages.
This means piping works cleanly with no extra flags: