Scan your whole stack
Are you using @dlwiest/ts-tonal-client?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.8.0
@dlwiest/ts-tonal-client was last scanned on 29 Nov 2026 at version 0.8.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.8.0 LATEST | 29 Nov 2026 | No rules fired |
| 0.7.1 | 10 Nov 2026 | No rules fired |
| 0.7.0 | 30 Oct 2026 | No rules fired |
| 0.5.1 | 2 Sep 2026 | Not shown |
| 0.5.0 | 2 Sep 2026 | Not shown |
Findings for v0.8.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.8.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
A TypeScript client for working with data from a Tonal account. It wraps authentication, workout and movement APIs, completed performance data, recovery metrics, programs, goals, and personal health-data exports in a typed interface.
[!IMPORTANT] This is an unofficial community project. It is not affiliated with or supported by Tonal, and the private APIs it uses may change without notice.
The client is meant for personal tools, data exports, and applications that need more Tonal detail than a general fitness integration may provide. In particular, it can retrieve performed set data—movements, reps, weight, volume, training modes, timing, and estimated one-rep max—and combine it with workout summaries, muscle readiness, and lifetime totals.
One intended workflow is to create a privacy-conscious JSON snapshot and upload it to an AI assistant such as ChatGPT for personal health analysis. This is a file-based bridge, not a live or automatic ChatGPT connection: generate a new export whenever the assistant needs current Tonal data.
| Area | Current capabilities |
|---|---|
| Authentication | Sign in with Tonal account credentials and automatically manage access-token refresh |
| Workout library | List, retrieve, create, update, delete, share, and estimate workouts; retrieve Daily Lifts |
| Completed performance | Retrieve activity summaries, paginated workout history, and individual workout details including performed sets, reps, weights, volume, timing, training modes, and estimated one-rep max |
| Movements and programs | Browse Tonal movements and muscle groups, list the full guided-workout and program library (cached), and retrieve detailed training programs |
| Training and recovery | Retrieve daily metrics, streaks, muscle readiness, weekly targets, and actual metric scores |
| History and achievements | Retrieve lifetime statistics, achievement progress, earned achievements, and home-calendar recommendations |
| Health data export | Produce date-filtered JSON with aggregate totals, optional recovery and lifetime data, and optional set-level workout details |
| Developer experience | TypeScript response types, request validation, retries, timeouts, movement caching, and runnable examples |
.env file or include credentials in an export.npm install @dlwiest/ts-tonal-client
git clone https://github.com/dlwiest/ts-tonal-client.git
cd ts-tonal-client
npm install
npm run build
Basic usage:
import TonalClient from '@dlwiest/ts-tonal-client'
const client = await TonalClient.create({
username: 'your_email@example.com',
password: 'your_password',
})
// Get your workouts
const workouts = await client.getUserWorkouts()
console.log(`You have ${workouts.length} workouts`)
TonalClient.create() accepts credentials and an optional cache directory:
TonalClient.create(credentials: {
username: string,
password: string,
cacheDir?: string,
}): Promise<TonalClient>
Without cacheDir, cached movements, guided-library indexes, and completed workout activities are stored in $XDG_CACHE_HOME/ts-tonal-client when XDG_CACHE_HOME is set. Otherwise, the cache lives at ~/.cache/ts-tonal-client. The directory is created on the first successful cache write, not when the client is created.
Pass cacheDir to store these caches somewhere else:
const client = await TonalClient.create({
username: 'your_email@example.com',
password: 'your_password',
cacheDir: '/path/to/cache',
})
await client.invalidateMovementsCache() clears the movements cache only. It does not clear cached workout activities.
await client.invalidateLibraryCache() clears both guided-library indexes (workouts and programs).
client.invalidateUserInfo() clears the in-memory user profile. Call it before the next getUserInfo() request to fetch fresh data.
To run the example scripts, first create a .env file:
cp .env.sample .env
# Edit .env with your Tonal username (email) and password
Then try the examples:
# See all your workouts
npm run example:user-workouts
# Search for workouts by name
npm run example:workout:name "Upper Body"
# Get your user info
npm run example:user
# Browse available movements
npm run example:movements
# See fitness goals
npm run example:goals
# Estimate workout duration
npm run example:estimate
# Create a new workout
npm run example:create-workout
# Edit an existing workout
npm run example:edit-workout
# Delete a workout
npm run example:delete-workout
# Get daily lifts
npm run example:daily-lifts
# Get training effect goals
npm run example:training-effect-goals
# Get training types
npm run example:training-types
# Get user settings
npm run example:user-settings
# Get daily metrics
npm run example:daily-metrics
# Get current workout streak
npm run example:current-streak
# Get workout activity history
npm run example:activity-summaries
# Get lifetime user statistics
npm run example:user-statistics
# Get achievement stats and milestones
npm run example:achievement-stats
# Get earned achievement history
npm run example:achievements
# Get home calendar and workout recommendations
npm run example:home-calendar
# Get muscle readiness and recovery status
npm run example:muscle-readiness
# Get detailed program information by ID
npm run example:program-by-id
# Get weekly fitness targets and progress tracking
npm run example:target-scores
# Get actual performance scores vs targets with comprehensive analytics
npm run example:metric-scores
# Export workout summaries for personal health analysis
npm run example:health-export
# Export complete Tonal history and all available health metrics
npm run example:complete-health-export
Create a JSON-ready export containing workout summaries, aggregate totals, current muscle readiness, and lifetime statistics:
import { writeFile } from 'node:fs/promises'
const exportData = await client.getHealthExport({
startDate: '2026-01-01',
limit: 100,
includeSetDetails: true,
})
await writeFile(
'tonal-health-export.json',
JSON.stringify(exportData, null, 2)
)
Run npm run example:health-export to write a compact export of the 50 most
recent Tonal workouts to tonal-health-export.json. The example atomically
replaces the file with owner-only permissions and refuses symbolic-link
destinations.
The export intentionally excludes profile details, account identifiers, device identifiers, application versions, and authentication data. It still contains private health and workout information, so store and share it carefully.
Available options:
startDate and endDate: include activities within an ISO-8601 range;
date-only values use each workout's local calendar daylimit: include at most this many activities, newest firstincludeMuscleReadiness: include current readiness data (default: true)includeLifetimeStatistics: include lifetime aggregate data (default: true)includeExternalActivities: include workouts imported into Tonal from another
service (default: false, preventing duplication with Apple Health data)includeSetDetails: fetch performed sets, reps, weights, movement names, and
one-rep-max estimates from paginated workout activity data (default: false)Set details keep Tonal's reported per-cable values in
averageResistancePerCablePounds and
estimatedOneRepMaxPerCablePounds. Arithmetic derived from total volume and
completed reps is separated under derivedEstimates, with
averageResistancePounds and oneRepMaxPounds explicitly documented as
estimates rather than measured values. totalVolumePounds uses Tonal's
totalOnMachineVolume, which reconciles with the completed workout's total
volume.
Detailed completed workouts are also available directly:
// Get a page of completed activities with performed set data
const activities = await client.getWorkoutActivities(0, 100)
// Get every activity, with duplicate-page and page-cap safety checks
const completeHistory = await client.getAllWorkoutActivities()
// Get one completed activity by its activity ID
const activity = await client.getWorkoutActivityById('activity-uuid')
console.log(activity.workoutSetActivity)
// Get the summary returned for one activity
const summary = await client.getFormattedWorkoutSummary('activity-uuid')
console.log(summary.timeUnderTension)
for (const movement of summary.movementSets) {
console.log(movement.movementName, movement.reps, movement.sets)
}
// Get summaries in bounded request batches
const summaries = await client.getFormattedWorkoutSummaries(
completeHistory.map(item => item.id),
5
)
Formatted summaries include the complete per-movement breakdown in
movementSets, along with workout totals such as timeUnderTension,
totalReps, totalVolume, and totalWork. Fields that Tonal only returns for
some workouts, including coachName and program identifiers, are optional.
Run npm run example:complete-health-export to retrieve every paginated Tonal
workout from the beginning of the account history. The resulting
tonal-complete-health-export.json includes raw set-performance metrics,
formatted workout and movement summaries, full daily metrics for the covered
period, strength-score history, weekly targets and scores, current readiness,
streaks, lifetime statistics, achievements, and reference definitions.
The complete export is structured as JSON for analysis tools such as ChatGPT. It includes a data dictionary explaining units and Tonal's per-cable resistance convention. Account, device, application, subscription, and authentication identifiers and user weight are removed recursively. The JSON is compacted to reduce upload size and text-token usage without dropping allowed data. The file still contains highly private health information and is atomically replaced with owner-only permissions.
The script also atomically recreates a private tonal-chatgpt-export directory
containing overview-and-metrics.json and one workouts-YYYY.json file for
each year in the history, so files from an older export cannot survive a rerun.
Upload every file listed by overview-and-metrics.json together. The split
bundle contains the same information but keeps each text file smaller and
easier for ChatGPT to analyze completely.
// Get your workouts (with pagination)
const workouts = await client.getUserWorkouts(0, 10)
console.log(`You have ${workouts.length} workouts`)
// Get daily lifts (auto-detects timezone)
const dailyLifts = await client.getDailyLifts()
console.log(`You have ${dailyLifts.length} daily lifts`)
// Get daily lifts with specific timezone
const dailyLiftsEST = await client.getDailyLifts('America/New_York')
// Get specific workout details
const workout = await client.getWorkoutById('workout-uuid')
// Search for workouts by name (case-insensitive partial match)
const workouts = await client.getUserWorkouts(0, 50)
const matches = workouts.filter(w =>
w.title.toLowerCase().includes('upper body')
)
console.log(`Found ${matches.length} matching workouts`)
// Get shared workout
const sharedWorkout = await client.getWorkoutByShareUrl('https://share.tonal.com/workout/...')
// Estimate workout duration
const sets = [/* workout sets */]
const estimate = await client.estimateWorkoutDuration(sets)
console.log(`Estimated duration: ${estimate.duration} seconds`)
// Create a new workout
const newWorkout = await client.createWorkout({
title: 'My Custom Workout',
sets: sets,
createdSource: 'WorkoutBuilder',
description: 'A great workout!'
})
// Edit an existing workout
const updatedWorkout = await client.updateWorkout({
id: 'workout-uuid',
title: 'My Updated Workout Title',
description: 'Updated description with changes',
coachId: '00000000-0000-0000-0000-000000000000',
sets: modifiedSets,
assetId: 'asset-uuid',
createdSource: 'WorkoutBuilder'
})
// Delete a workout
await client.deleteWorkout('workout-uuid')
A workout activity is one performed workout session, not a workout template. Get an activity ID from getActivitySummaries(), then fetch its detail from /users/{userId}/workout-activities/{activityId}:
const summaries = await client.getActivitySummaries()
const recent = [...summaries]
.filter(summary => summary.completed)
.sort((a, b) => Date.parse(b.timestamp) - Date.parse(a.timestamp))[0]
if (recent) {
const activity = await client.getWorkoutActivityById(recent.id)
console.log(`${activity.totalSets} sets, ${activity.totalReps} reps`)
console.log(`Completed: ${activity.completed === true}`)
}
The method signature is:
async getWorkoutActivityById(
activityId: string,
useCache: boolean = true
): Promise<TonalWorkoutActivity>
Completed activities are immutable, so results with completed === true are cached permanently with no TTL. In-progress activities are never cached. Cache keys include both the user and activity IDs, which prevents collisions between accounts. Cache reads and writes are best-effort: a cache failure never fails the API request or hides a successful response. Pass false for useCache to force a fresh request.
Activity entries use the same cacheDir and default cache location described under Client setup. Permanent entries never expire and nothing evicts them automatically, so the cache grows by one small file for each completed activity viewed. invalidateMovementsCache() does not clear these entries.
TonalWorkoutActivity contains the performed session's IDs, timestamps, duration and aggregate totals, completion state, device metadata, and its set activity records:
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.