Analytics
Query TrainHeroic coach analytics from the SDK, including team readiness, compliance, training volume, one-rep-max history, and lift progress.
Analytics helpers are read-only. TrainHeroic happens to use POST for these report queries, but the calls do not mutate account data.
import { analyticsMetricCatalog, queryAnalytics } from "@trainheroic-unofficial/js";
const readiness = await queryAnalytics(client, {
metric: "readiness-team",
teamId: 42,
date: "2026-08-10",
});
console.log(readiness);
console.log(analyticsMetricCatalog());
Metrics
| Metric | Scope | Required inputs |
|---|---|---|
readiness-team |
Team | date |
compliance-team |
Team | dateStart, dateEnd |
lift-progress-team |
Team | exerciseId, dateStart, dateEnd |
readiness-athlete |
Athlete | dateStart, dateEnd |
training-summary-athlete |
Athlete | dateStart, dateEnd |
lift-1rm-history |
Athlete | exerciseId, dateStart, dateEnd |
working-max-history |
Athlete | exerciseId |
queryAnalytics throws a readable error that names any required input you left out.
Query inputs
metricAnalyticsMetric
One of the metric names in the metrics table.
AnalyticsMetricteamId?number
The team to report on. Required for team metrics.
numberuserIds?number[]
One or more athlete ids. Required for athlete metrics; the report returns one row per athlete.
number[]date?string
A single day as YYYY-MM-DD, for readiness-team.
stringdateStart?string
The first day of a range, as YYYY-MM-DD.
stringdateEnd?string
The last day of a range, as YYYY-MM-DD.
stringexerciseId?number
The lift to report on, for the lift metrics.
numberuseMetric?boolean
Report weights in kilograms, for lift-1rm-history and working-max-history.
booleanTeam volume
There is no raw team-volume metric. Pass every athlete id to training-summary-athlete, or
use teamVolume() to group the per-athlete rows into one rollup.