OpsTrailsDocs
Console

CLI

The OpsTrails CLI lets you track events from your terminal or CI/CD pipelines.

Installation

bash
npm install -g @opstrails/cli

Authentication

Set your API key as an environment variable:

bash
export OPSTRAILS_API_KEY=YOUR_API_KEY

Tip

In CI/CD environments, set OPSTRAILS_API_KEY as a secret/masked variable in your pipeline configuration.

Commands

opstrails track

Record an event on the timeline.

bash
opstrails track \
  --type deployment \
  --source "//github.com/your-org/your-repo" \
  --subject production \
  --version v1.2.3

Options

FlagRequiredDescription
--typerequiredEvent type (e.g. deployment, rollback)
--sourcerequiredEvent source URI
--subjectoptionalContext label (e.g. production)
--versionoptionalRelease version
--severityoptionalLOW, MINOR, MAJOR, or CRITICAL
--descriptionoptionalHuman-readable description of the event
--timeoptionalTimestamp (defaults to "NOW")

Full Example

bash
opstrails track \
  --type deployment \
  --source "//github.com/acme/api-service" \
  --subject production \
  --version v2.1.0 \
  --severity LOW \
  --description "Deployed API service v2.1.0 to production"

Environment Variables

VariableDescription
OPSTRAILS_API_KEYAPI key with READ_WRITE scope
OPSTRAILS_API_URLAPI base URL (defaults to https://api.opstrails.dev)

Links