Common Flags
These flags are supported across commands where applicable.| Flag | Description | Default |
|---|---|---|
--human | Enable rich TUI output (tables, colorized values, readable timestamps) | Off (JSON) |
--wait | Block until async operation completes, subject to --timeout. Exits with code 4 if timeout is reached. | Off |
--timeout <duration> | Max wait time when using --wait (e.g. 10m, 1h) | 20m |
--limit <n> | Maximum items per page (1–100) | Endpoint-specific |
--token <cursor> | Pagination cursor from a previous response’s next_token | None |
--force | Skip confirmation prompts for destructive operations | Off (prompt) |
-d, --data <json|path|-> | JSON request body (inline, file path, or - for stdin) | None |
--request-schema | Print the API request body JSON schema and exit (no auth required) | Off |
--response-schema | Print the API response JSON schema and exit (no auth required) | Off |
Async Operations and --wait
Commands that create videos or translations return immediately by default with an ID and status. The operation continues in the background.
Add --wait to block until the operation completes:
--wait, you get the initial response:
--wait, the CLI polls the status endpoint until completion and returns the full resource:
--timeout:
4. Stdout contains the last known resource state, and stderr contains a hint with the manual polling command:
1. Stdout contains the failure response (which often includes error details) and stderr contains the error envelope.
--wait is supported on:
heygen video createheygen video-agent createheygen video-translate createheygen lipsync create
Complex Request Bodies (-d / --data)
Endpoints with nested inputs — discriminated unions, arrays of objects, nested configs — use -d for raw JSON instead of individual flags:
-d can be combined — flags override matching fields in the JSON body. This lets you keep a reusable JSON template and tweak individual fields per invocation:
--request-schema to discover the expected JSON shape for any command — no auth required:
Pagination
List commands return paginated results. Each response includeshas_more and next_token:
Manual pagination
Use--token to fetch the next page:
next_token from the JSON response and pass it to the next call explicitly. The CLI does not auto-paginate — each page is a separate request.
Stdin Support
Flags that accept long text support reading from stdin with-:
Destructive Operations and --force
Commands that delete resources (video delete, webhook endpoints delete, video-translate delete, lipsync delete) prompt for confirmation interactively:
--force to skip the prompt — useful in scripts and CI:
Error Handling
All errors use a consistent JSON envelope on stderr:code— machine-readable error typemessage— human-readable descriptionhint— suggested action to resolve the errorrequest_id— included when the error comes from the API (from theX-Request-IDheader). Omitted for local errors (bad flags, missing credentials, network failures).
Exit Codes
| Code | Meaning | When |
|---|---|---|
0 | Success | Operation completed |
1 | General error | API 4xx/5xx, network failure, terminal job failure |
2 | Usage error | Bad flags, missing required args |
3 | Auth error | 401/403, missing or invalid API key |
4 | Timeout | Resource was created but polling timed out before completion |
4 is distinct from 1 so agents can tell “the job exists but we don’t know the final state” apart from a hard failure. Stdout will contain the last known resource state when exit 4 occurs.
Rate Limiting
429 responses are retried automatically with exponential backoff, respecting the Retry-After header. The error only surfaces if retries are exhausted. The default retry count is 2; override with the HEYGEN_MAX_RETRIES environment variable.
Configuration
Persistent settings are managed withheygen config:
~/.heygen/config.toml.
Config keys
| Key | Values | Description |
|---|---|---|
output | json, human | Default output format (default: json) |
analytics | true, false | Enable or disable anonymous usage analytics |
Environment variable overrides
| Variable | Description |
|---|---|
HEYGEN_API_KEY | API key (takes precedence over stored credentials) |
HEYGEN_OUTPUT | Output format: json or human |
HEYGEN_NO_ANALYTICS | Set to any non-empty value to disable analytics |
HEYGEN_MAX_RETRIES | Max retry count for transient failures (default: 2) |
HEYGEN_API_BASE | Override the API base URL (internal/test use) |
Self-Update
The CLI can update itself:v prefix. Dev builds track dev prereleases; stable builds track stable releases only.

