TrainingPeaks
by @rubengarciam
Pull real-time training plans, workouts, fitness metrics (CTL/ATL/TSB), and personal records from TrainingPeaks. Uses cookie-based authentication (no API key needed). Use in conjunction with other endurance, cycling, running or swimming triathlon coach skills for best results.
clawhub install trainingpeaksπ About This Skill
name: trainingpeaks description: Pull real-time training plans, workouts, fitness metrics (CTL/ATL/TSB), and personal records from TrainingPeaks. Uses cookie-based authentication (no API key needed). Use in conjunction with other endurance, cycling, running or swimming triathlon coach skills for best results.
TrainingPeaks Skill
CLI access to the TrainingPeaks internal API. Pure Python stdlib β no pip dependencies.
Setup: Getting Your Auth Cookie
1. Log in to TrainingPeaks in your browser
2. Open DevTools β Application β Cookies β app.trainingpeaks.com
3. Find the cookie named Production_tpAuth
4. Copy its value (long encoded string)
Then authenticate:
python3 scripts/tp.py auth ""
Or set the environment variable (useful for CI/scripts):
export TP_AUTH_COOKIE=""
Credentials are stored in ~/.trainingpeaks/ with 0600 permissions.
Commands
auth β Authenticate
Store and validate a Production_tpAuth cookie. Exchanges it for a Bearer token and caches the athlete ID.
python3 scripts/tp.py auth "eyJhbGci..."
β Authenticated successfully!
Account: user@example.com
Athlete ID: 12345
Token expires in: 60 minutes
auth-status β Check Authentication
python3 scripts/tp.py auth-status
Cookie: stored (file)
Token: valid (42m remaining)
Athlete ID: 12345
β Ready
profile [--json] β Athlete Profile
python3 scripts/tp.py profile
Profile
ββββββββββββββββββββββββββββββββββββββββ
Name: Ruben Example
Email: ruben@example.com
Athlete ID: 12345
Account: Premium
Bike FTP: 280 W
workouts [--filter all|planned|completed] [--json]
List workouts in a date range (max 90 days).
# All workouts this week
python3 scripts/tp.py workouts 2026-01-26 2026-02-01Only completed workouts
python3 scripts/tp.py workouts 2026-01-01 2026-01-31 --filter completedRaw JSON for scripting
python3 scripts/tp.py workouts 2026-01-26 2026-02-01 --json
Output columns: Date, Title, Sport, Status (β/β), Planned duration, Actual duration, TSS, Distance.
workout [--json] β Workout Detail
Get full details for a single workout including description, coach comments, and all metrics.
python3 scripts/tp.py workout 123456789
Workout: Tempo Intervals 3x10min
ββββββββββββββββββββββββββββββββββββββββββββββββββ
Date: 2026-01-28
Sport: Bike
Status: Completed β
...
fitness [--days 90] [--json] β CTL/ATL/TSB
Get fitness (CTL), fatigue (ATL), and form (TSB) data.
# Last 90 days (default)
python3 scripts/tp.py fitnessFull season
python3 scripts/tp.py fitness --days 365JSON for charts
python3 scripts/tp.py fitness --json
Shows a summary with current CTL/ATL/TSB and status interpretation, plus a 14-day daily table.
peaks [--days 3650] [--json] β Personal Records
Get ranked personal records by sport and metric.
# Best 20-minute power (all time)
python3 scripts/tp.py peaks Bike power20min5K running PRs from last year
python3 scripts/tp.py peaks Run speed5K --days 3655-second max power
python3 scripts/tp.py peaks Bike power5sec
Valid PR types:
| Sport | Types |
|-------|-------|
| Bike | power5sec, power1min, power5min, power10min, power20min, power60min, power90min, hR5sec, hR1min, hR5min, hR10min, hR20min, hR60min, hR90min |
| Run | hR5secβhR90min, speed400Meter, speed800Meter, speed1K, speed1Mi, speed5K, speed5Mi, speed10K, speed10Mi, speedHalfMarathon, speedMarathon, speed50K |
Token Management
~/.trainingpeaks/token.json~/.trainingpeaks/cookieFile Locations
| File | Purpose |
|------|---------|
| ~/.trainingpeaks/cookie | Stored Production_tpAuth cookie |
| ~/.trainingpeaks/token.json | Cached OAuth Bearer token + expiry |
| ~/.trainingpeaks/config.json | Cached athlete ID and account info |
Notes
YYYY-MM-DD formatTP_AUTH_COOKIE environment variable overrides stored cookie--json gives raw API responsesπ Tips & Best Practices
YYYY-MM-DD formatTP_AUTH_COOKIE environment variable overrides stored cookie--json gives raw API responses