Skip to content
On this page

Command-line interface

Install the trainheroic CLI, authenticate, and run JSON-oriented coach and athlete commands.

The CLI is designed for terminals, scripts, and AI agents. Successful commands print JSON to stdout; failures write to stderr and exit nonzero.

Install

npm install -g @trainheroic-unofficial/cli
npx @trainheroic-unofficial/cli whoami

Authenticate

export TRAINHEROIC_EMAIL=coach@example.com
export TRAINHEROIC_PASSWORD=yourpassword
trainheroic whoami

Common commands

trainheroic coach athletes
trainheroic coach teams
trainheroic coach programs
trainheroic coach exercise resolve "Back Squat"
trainheroic coach message list
trainheroic athlete profile
trainheroic athlete workouts --start 2026-08-01 --end 2026-08-31
trainheroic athlete export

Run trainheroic with no arguments for the full command tree.

Input and confirmation

Workout specs and other JSON inputs can be passed inline, read from --file, or piped on stdin. Inputs are validated against the shared DTO schemas before the request is sent.

Actions that publish, delete, send, archive, or write athlete results require --yes. Building a draft does not; building and publishing in one command does.

Was this page helpful?