1. Install the CLI
~/.local/bin.
Verify the installation:
The CLI ships as a single binary with no runtime prerequisites. macOS (Apple Silicon and Intel) and Linux (x64 and arm64) are supported. Windows support is coming soon — WSL is recommended in the meantime.
2. Authenticate
Log in with your API key from API dashboard:~/.heygen/credentials.
For CI/Docker/agent environments, set the environment variable instead — it takes precedence over stored credentials:
Log in with OAuth
As an alternative to an API key, log in with your HeyGen account via OAuth:Logging in one way replaces the other stored credential. Non-interactive shells (piped input,
CI=true, or HEYGEN_NONINTERACTIVE=1) default to the API-key flow — pass --oauth explicitly in automation. Set BROWSER=none or HEYGEN_NO_BROWSER=1 to print the sign-in URL instead of opening a browser.3. Create a Video
Send a prompt to the Video Agent and let it handle avatar, voice, and layout:Output
video create with a JSON body:
--request-schema on any command to discover the expected JSON fields — no auth required:
4. Check Status
Poll for the result using thevideo_id returned from step 3:
Output
pending → processing → completed or failed. If the video fails, the response includes failure_code and failure_message fields.
Tip: Add
--wait to the create command to block until the video is ready instead of polling manually. The default timeout is 20 minutes — override with --timeout 30m. On timeout, the CLI exits with code 4 and prints the last known resource state along with a hint to resume polling manually.5. Download the Video
Once complete, download to a local file:Output

