Skip to main content

Common Flags

These flags are supported across commands where applicable.

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:
Without --wait, you get the initial response:
With --wait, the CLI polls the status endpoint until completion and returns the full resource:
The default timeout is 20 minutes. Override with --timeout:
If the timeout is reached, the CLI exits with code 4. Stdout contains the last known resource state, and stderr contains a hint with the manual polling command:
If the operation reaches a terminal failure state, the CLI exits with code 1. Stdout contains the failure response (which often includes error details) and stderr contains the error envelope. --wait is supported on:
  • heygen video create
  • heygen video-agent create
  • heygen video-translate create
  • heygen 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:
Flags and -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:
Use --request-schema to discover the expected JSON shape for any command — no auth required:

Pagination

List commands return paginated results. Each response includes has_more and next_token:

Manual pagination

Use --token to fetch the next page:
If an agent needs multiple pages, it should read 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:
Use --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 type
  • message — human-readable description
  • hint — suggested action to resolve the error
  • request_id — included when the error comes from the API (from the X-Request-ID header). Omitted for local errors (bad flags, missing credentials, network failures).

Exit Codes

Exit code 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 with heygen config:
Config values are stored locally at ~/.heygen/config.toml.

Config keys

Environment variable overrides


Self-Update

The CLI can update itself:
The version flag requires the v prefix. Dev builds track dev prereleases; stable builds track stable releases only.

Analytics

The CLI collects anonymous usage analytics to inform product decisions. This includes command usage, error rates, CLI version, and platform. No API keys, scripts, prompts, or personally identifiable information are ever tracked. Disable analytics at any time:
Or via environment variable:
Analytics calls are non-blocking and never slow down the CLI.