Terra CLI
Set up, manage, and debug your Terra integration from the terminal.
Set up and debug your Terra integration from the terminal: environments, credentials, providers, webhooks, users, and event replay. Your coding agent can run it too. See Coding agents.
Before you begin
Open a terminal and have your Terra account ready.
Step 1: Install Terra CLI
Choose an installation method:
Copy and run the command for your platform in your terminal.
macOS and Linux:
curl -fsSL https://cli.tryterra.co/install.sh | shWindows PowerShell:
irm "https://cli.tryterra.co/install.ps1" | iexmacOS, Linux, and Windows:
Requires Node.js 18 or later.
npm install -g @tryterra/climacOS:
brew install tryterra/tap/terraCheck the installation:
terra versionSee Installation for updates, shell completion, and installation through a coding agent.
Step 2: Log in
terra loginThe CLI opens your browser and prints a pairing code. Approve it in the Terra dashboard to finish logging in.
To use Terra with a coding agent, also run:
See Coding agents for details. For CI, see Authentication.
Step 3: Pick an environment
List your environments, then select one by name:
Replace Production with your environment's name. The CLI uses this environment for subsequent commands, so you don't need to pass --env each time.
Step 4: Run your first command
This lists users in the selected environment. Output is a table on a terminal and JSON when piped. See Output and scripting.
Start from an example app
Downloads a complete app into a new directory and returns the next steps. No Terra login is required. Follow the app's README to install dependencies, configure credentials, and run it. See Example apps.
Common tasks
The examples below use the selected environment. Credential reads and data API key lookup require keys:read, which default login leaves out. See Authentication for choosing scopes and Raw API requests for supplying a key directly.
Set up an environment
Send a user through auth, then check it worked
Create a session with the Terra widget. The generateWidgetSession command below is for legacy integrations. Terra accounts created after 3 September 2026 receive HTTP 410 from that endpoint and must use POST https://access.tryterra.co/api/widget/session instead.
Find out why a webhook never arrived, and resend it
Use the row's event_id, user_id, and data_type for the resend flags. Acceptance is asynchronous and does not mean the destination received it. events list defaults to the last 7 days, or 14 days with --event-id. Payload retrieval requires payloads:read, and stored payloads expire after about 14 days. Replace the sample identifiers in these examples with your own.
Inspect connection and delivery statistics
The default basic view returns summary metrics. full adds time buckets and breakdowns. User statistics default to the last three months; event statistics default to the last 24 hours. Use --since and --until to choose a window. Statistics use an inclusive start and exclusive end, and full views allow at most 1,500 buckets. See each command's help for its metrics and limits.
Pull a user's data
Drop to_webhook=false to send the data to your destination instead, which is how you backfill a new user's history.
Rotate an API key
Turn on a health score and read the results
Push a planned workout to a user's calendar
Use the numeric workout_id returned by creation in place of 1024.
List a user's planned workouts
The list covers workouts you pushed through Terra and workouts the athlete created on the provider, in the same shape.
Check where a lab report was delivered
Ask the docs
See Ask the docs.
Find a command
terra --help lists the groups, terra <command> --help describes one, and terra reference prints everything. See Command reference.
Safe by default
--dry-runsends an authenticated preview request on supported commands, without committing the change.Credential endpoints print the secrets returned by the API; read scopes control access.
Destructive commands confirm first, or need
--yeswithout a terminal.
See Guardrails.
Get help
Open a GitHub issue with the output of terra version and the failing command run with --show-headers. Credentials are redacted. Account, billing, and contract questions go to your Terra support channel, not the public tracker.
Security issues: follow the security policy, not a public issue.
Last updated
Was this helpful?