Skip to main content
TechnicallyFit is athletic performance infrastructure: a deterministic training engine, consent-first teammate data graph, real-time sensor gateway, multi-location equipment inventory model, and cryptographic verification layer behind public /v1 APIs and open SDKs (TypeScript @technicallyfit/sdk, Python technicallyfit, and @technicallyfit/source-adapters). This cookbook organizes 15 runnable scenarios into 4 builder tracks so you can jump straight to your use case, whether you are an indie developer testing on a free personal key, a performance coaching platform, a connected hardware maker, a testing combine, or a multi-location gym operator.

Scenarios by track

Track 1: Start in 5 minutes (Free personal workspace and sandbox)

Track 3: Hardware, real-time telemetry, and verified records

Track 4: Multi-location gyms, webhooks, and branded member apps

Setup

Set these two values once in your terminal. Every example in these docs reads them, so no example has a host or a key typed into it.
Use a test key (it starts with tf_test_) while you build. Never paste a live key into a page, a ticket or a chat. Install the published SDK packages before running the recipes below:
A personal workspace has a daily cap on program creations and sandbox week simulations, which scenarios 2 and 5 use. Running both in TypeScript and in Python takes most of a day’s allowance. The numbers are in Rate limits.

Track 1: Start in 5 minutes

1. Browse the exercise catalog, equipment, and training knowledge

Built for: Indie fitness app builders and AI application developers starting on a free personal workspace. When to use this scenario: You are building a smart exercise picker, movement-substitution screen, or training explainer and need canonical exercise IDs, drop-in alternatives, the standardized equipment taxonomy, and grounded training concepts from TechnicallyFit’s knowledge graph. Required scopes and mode: reference:read. Works in test or live mode with a free personal key or an organization key. What happens end-to-end: Your app queries GET /v1/exercises filtered by equipment and muscle group, fetches drop-in substitutes via GET /v1/exercises/{exercise_id}/alternatives, checks the canonical equipment tokens via GET /v1/equipment, and looks up training concepts through GET /v1/knowledge/search.

2. Simulate a 6-week injury-return lifecycle in the sandbox

Built for: Any developer evaluating the platform, plus automated QA and CI test suites. When to use this scenario: You want to experience the full deterministic engine, body-state shifts, program re-planning, and test webhook delivery in under a minute without recruiting a single real test user or touching live data. Required scopes and mode: Any test key (tf_test_*) from a free personal workspace or an organization workspace. Sandbox endpoints always reject live keys (403). What happens end-to-end: GET /v1/sandbox/presets lists the built-in teammate histories, POST /v1/sandbox/teammates creates a deterministic simulated teammate (returning_from_knee_injury with seed: 42 and 6 weeks of starting history), POST /v1/sandbox/teammates/{simulated_id}/simulate advances the simulated clock week by week under chosen behaviors (on_plan, reports_pain), and GET /v1/teammates/{external_id}/body-state shows the resulting left-knee caution before you clean up with POST /v1/sandbox/reset.
See Sandbox for the full list of presets (new_to_training, returning_from_knee_injury, endurance_runner) and behaviors (on_plan, misses_sessions, finds_it_hard, reports_pain).

Built for: Gym chains, coaching platforms, and member CRMs syncing their existing member directory. When to use this scenario: A new member joins your gym or app. You want to create their TechnicallyFit profile under your own stable external_id, hand them a claim link so they own their account, and write consent-aware reads that handle 403 consent_required cleanly if the teammate declines or revokes an item later. Required scopes and mode: teammates:write, teammates:read (plus body_state:read for the consent-gated read check). Works in test mode or organization live mode. What happens end-to-end: PUT /v1/teammates/{external_id} idempotently creates an unclaimed placeholder you can already populate with history or a program. POST /v1/teammates/{external_id}/invite moves them to invited and returns a claim_url (or emails it) requesting specific consent items. Once claimed, reading a consent-gated surface raises ConsentRequiredError if the teammate turned that item off.
Teammates own their accounts. Before a placeholder is claimed, your organization can populate events, goals, and programs; after claiming, the teammate decides every consent item and can revoke sharing at any time (emitting teammate.disconnected when sharing ends). See Teammates and ownership.

4. Ingest sets, observations, and body measurements with offline sync

Built for: Mobile workout apps, gym floor kiosks, and smart-scale sync backends. When to use this scenario: Your client records completed sets, joint soreness check-ins, and body mass measurements in unreliable gym Wi-Fi environments, needs guaranteed deduplication across retries, and wants to undo an accidental entry cleanly without corrupting history. Required scopes and mode: events:write. Works in test or live mode. OfflineQueue flushes in chunks through POST /v1/events:bulk (organization key). What happens end-to-end: The SDK validates each event locally before sending. Sending via tf.events.send posts to POST /v1/teammates/{external_id}/events and returns a per-item status (accepted, duplicate, or rejected with a structured reason). OfflineQueue persists events while offline and flushes safely later without duplicates. If a user logged a wrong weight, POST /v1/teammates/{external_id}/events/{event_id}:undo takes the event back, rebuilds body state, and triggers re-planning.
Replace MemoryStorage with a file, SQLite table, or device-storage adapter in production so queued events survive app restarts. See Offline batching.

5. Generate a deterministic program and audit every revision

Built for: Fitness apps, digital health platforms, and coaching software that need auditable, scientifically constrained prescriptions rather than unconstrained LLM workouts. When to use this scenario: You want to generate a multi-week training program tailored to a teammate’s goal, schedule, and location equipment, display today’s session immediately (including an on-demand easier or harder variant), and inspect the deterministic revision trail (revision, engine_version, and cause.summary). Required scopes and mode: programs:write and programs:read. Works in test or live mode. After a teammate claims their account, they must allow programs consent. What happens end-to-end: POST /v1/teammates/{external_id}/programs returns 202 with a job record. Your app polls GET /v1/program-jobs/{job_id} (or listens for the program.revised webhook in production), reads today’s scheduled workout via GET /v1/teammates/{external_id}/sessions/today, and audits every change through GET /v1/teammates/{external_id}/programs/{program_id}/revisions.

6. Read joint caution, recovery, and uncertainty without a wearable

Built for: Physical therapy and return-to-play clinics, sports performance staff, and adaptive coaching apps. When to use this scenario: You want to know how careful to be with every joint, how recovered it is from recent workload, and how much epistemic uncertainty remains, even when a teammate wears zero devices. Body state is computed purely from logged sets, self-reported soreness, and known constraints, and never alters a program unless you explicitly opt in. Required scopes and mode: body_state:read and teammates:write. Works in test or live mode. Requires the teammate’s body_state consent after claim. What happens end-to-end: Your app reads per-joint caution, recovery, and uncertainty from GET /v1/teammates/{external_id}/body-state, flags joints with elevated caution or high uncertainty (meaning more observations are needed), and optionally turns on body-state-aware planning for this teammate through PATCH /v1/teammates/{external_id}/settings.
Body state is a training-load estimate, not a medical diagnosis. Never present caution values as an injury diagnosis; when a teammate reports pain, direct them to a qualified clinician. See Body state.

7. Run an async coach-in-the-loop proposal review workflow

Built for: Coaching platforms, high-touch performance academies, and collegiate or professional strength and conditioning staffs. When to use this scenario: Your coached teammates have human coaches who retain final authority over program changes. When a constraint or workload event suggests revising upcoming sessions, TechnicallyFit opens a pending proposal instead of silently overwriting the plan. Required scopes and mode: events:write, proposals:read, and proposals:write. Requires organization live mode (test-mode events never create proposals). What happens end-to-end: Sending a constraint event queues the engine asynchronously. When the engine proposes changes, TechnicallyFit pushes a proposal.created webhook to your backend. Your coaching UI reads the proposal diff via GET /v1/proposals/{proposal_id} (or lists pending proposals via GET /v1/teammates/{external_id}/proposals), displays the exact session changes to the coach, and records either POST /v1/proposals/{proposal_id}/accept or POST /v1/proposals/{proposal_id}/decline with the coach’s reason.

8. Adapt a workout live mid-session with one-tap undo

Built for: Interactive training apps, smart gym floor displays, and velocity-based training apps. When to use this scenario: During a live workout, a teammate logs a set whose effort spikes far above target. TechnicallyFit’s live adaptation adjusts remaining sets automatically while keeping the teammate in complete control via a single-tap undo (:veto). Required scopes and mode: programs:read, programs:write, and events:write. Works in test or live mode where live adaptation is enabled. What happens end-to-end: Your app enables a preset via PUT /v1/teammates/{external_id}/adaptation-profile, starts today’s session via POST /v1/teammates/{external_id}/sessions/today:start and captures the baseline prescription, logs a high-effort set (effort: 9.5), reads the updated session from GET /v1/teammates/{external_id}/sessions/today to display before-vs-after remaining sets, and wires a one-tap Undo button to POST /v1/teammates/{external_id}/adaptations/{adaptation_id}:veto using the adaptation_id delivered on the session.adapted webhook.

Track 3: Hardware, real-time telemetry, and verified records

9. Stream live sensor data for real-time cues with reconnect recovery

Built for: Connected hardware makers (linear encoders, smart racks, wearables) and real-time training apps. When to use this scenario: You are streaming live readings during an active set, such as Bluetooth GATT heart rate (0x180D / 0x2A37) or rep-by-rep bar velocity (m/s), want immediate server-evaluated cues when velocity drops past a threshold, need automatic checkpoint resume if basement gym Wi-Fi drops, and want the entire stream folded once into clean summary observations on close. Required scopes and mode: events:write. Connects to the live gateway at wss://live.technicallyfit.com. What happens end-to-end: openLiveSession (TypeScript) and open_live_session (Python) authenticate over WebSocket, decode standard BLE packets with @technicallyfit/source-adapters or send bar-velocity readings directly via sendReadings / send_readings, invoke onCue / on_cue when a live cue rule fires, recover transparently via session.resume() after a dropped socket without double-counting acknowledged batches, and fold the session into durable summary observations on session.close().

10. Build and certify a custom hardware source adapter

Built for: Hardware manufacturers (velocity trackers, force plates, smart racks, smart scales) and telemetry integrators onboarding a custom device without waiting on bespoke vendor code. When to use this scenario: Your hardware produces proprietary telemetry frames and you want to map them into TechnicallyFit’s canonical observation/1 contract, declare stream reducers, prove that your mapping passes every schema, provenance, neutrality, and deduplication rule offline (and optionally against a test teammate), and ship with confidence. Required scopes and mode: Offline conformance requires no API key. Passing the optional live option to runConformance uses a test key (tf_test_*) with events:write and verifies accepted on first send and duplicate on replay. What happens end-to-end: You define a source-adapter/2 manifest naming a vendor-neutral device.kind and instrument (linear_encoder), implement a pure toEvents(record) mapper (in TypeScript with @technicallyfit/source-adapters, or validated locally in Python with observation builders before ingestion), and run runConformance across sample records to check all 12 offline rules (manifest.valid, events.schema, events.registry, events.provenance, events.no_vouching, reducers.valid, record_id.stable, neutral.names, and more).
See Adapting a source and Supported devices for all built-in Bluetooth GATT starter adapters and source-adapter/2 rules.

11. Issue and offline-verify a cryptographically attested record

Built for: Approved testing combines and performance labs (Issuer) plus scouts, colleges, leagues, and partner platforms (Offline Verifier, no API key required). When to use this scenario: An approved facility records an official performance test (such as a 40-yard sprint timed with electronic timing gates), certifies it to Vouching Level 4 with an Ed25519 cryptographic attestation, and any third party verifies the signed envelope completely offline without holding a TechnicallyFit API key or accessing private account data. Required scopes and mode: Part A (Issuer) requires measurements:write and attestations:write, in an organization workspace approved as an attestor. Any other workspace, a personal one included, gets 403 (attestor_not_approved). Part B (Verifier) uses only public endpoints (GET /v1/attestations/keys and GET /v1/attestations/{attestation_id}/status) with no API key. What happens end-to-end: In Part A, the approved facility records the measurement and calls POST /v1/attestations to obtain a signed attestation/1 envelope. In Part B, an independent third party caches TechnicallyFit’s Ed25519 public key set, verifies the RFC 8785 canonical JSON signature offline via verifyAttestation / verify_attestation, and optionally checks live revocation status.

Track 4: Multi-location gyms, webhooks, and branded member apps

12. Subscribe to outbound webhooks, fetch details, and rotate secrets with zero downtime

Built for: Backend platform engineers integrating TechnicallyFit into their CRM, coaching portal, or notification pipelines. When to use this scenario: You want TechnicallyFit to push real-time notifications to your HTTPS server whenever a program changes, a coach proposal opens, or a teammate becomes at risk, without polling. You also need production-grade patterns: verifying raw bytes, deduplicating retries on event.id, fetching full details via the REST API, and rotating signing secrets with zero dropped deliveries. Required scopes and mode: webhooks:write to register endpoints and rotate secrets, plus read scopes (such as programs:read) for follow-up detail fetches. Works in test or live mode. What happens end-to-end: Webhooks are outbound POST requests pushed from TechnicallyFit to your server. Payloads carry IDs and summaries only (never full diffs or health values). Your handler verifies the raw body with verifyWebhook / verify_webhook, deduplicates on event.id, fetches fresh details over REST when needed, and passes [newSecret, previousSecret] during the overlap window returned by POST /v1/webhook-endpoints/{id}/rotate-secret.
Always verify rawBody before parsing JSON. Re-serializing parsed JSON changes whitespace or key ordering and breaks the HMAC-SHA256 signature check. See Webhook verification.

13. Handle a gym equipment outage with floor-wide program replanning

Built for: Multi-location gym chains and facility maintenance systems. When to use this scenario: You run multiple clubs sharing a standard equipment baseline, and a machine (such as the leg press at your Northside club) breaks down until parts arrive. One API call updates that club’s effective inventory and triggers TechnicallyFit to emit location.inventory_changed and adapt upcoming programs for teammates homed at that location. Required scopes and mode: locations:write and locations:read. Works in test or live mode. What happens end-to-end: PUT /v1/locations/{location_external_id} registers the club. PUT /v1/inventory/baseline defines the standard floor across every club. PUT /v1/locations/{location_external_id}/overrides/{token} marks leg_press as out_of_service with an expected back_in_service_on date. Reading GET /v1/locations/{location_external_id}/inventory returns the live effective inventory and unavailable list, and removing the override via DELETE restores it when repaired.
Subscribe to location.inventory_changed to receive a count of homed teammates affected whenever a baseline, override, or out-of-service change lands. See Locations and equipment.

14. Sync gym visits, read traffic, discover PT leads, and flag at-risk members

Built for: Gym operators, multi-club general managers, and retention/CRM teams. When to use this scenario: You want your door-access system to feed visit check-ins into TechnicallyFit, read privacy-safe club traffic by day or hour, surface self-guided regulars who are ready for personal training (ready_for_a_coach), and trigger staff outreach for members slipping away (once_and_gone and at-risk). Required scopes and mode: locations:write, events:write, and insights:read. Works in organization live mode (or test mode). Steps 1 and 2 also run in a personal workspace; the groups and at-risk reads (steps 3 and 4) need an organization workspace and answer 404 in a personal one. What happens end-to-end: Your backend upserts a club via PUT /v1/locations/{location_external_id}, logs a door check-in (visit_check_in), queries GET /v1/insights/traffic for weekly/daily check-in volume (with groups smaller than min_group_size: 5 automatically withheld for privacy), reads all six ready-made member cohorts via GET /v1/insights/groups (including ready_for_a_coach and once_and_gone), lists actionable members via GET /v1/insights/groups/{key}/teammates, and pulls retention alerts from GET /v1/insights/at-risk.

15. Launch a branded member app with Sign in with TechnicallyFit and drop-in components

Built for: Gym brands, consumer fitness apps, and university athletics portals shipping a member-facing web or mobile app in an afternoon. When to use this scenario: You want members to sign in to your branded web portal or mobile app using their own TechnicallyFit account (never shipping an organization API key onto client devices), pull your gym’s brand theme from GET /v1/app-config, and embed TechnicallyFit’s hosted drop-in components (<tf-today-session>, <tf-record>, and <tf-live-cues>) without building workout or verified-record screens from scratch. Required scopes and mode: Sign in with TechnicallyFit OAuth (PKCE) tokens scoped to teammates:read, programs:read, and record:read. Organization API keys (tf_live_* / tf_test_*) are refused inside drop-in frames. What happens end-to-end: Your app starts OAuth PKCE with beginTeammateSignIn, exchanges the redirect callback with completeTeammateSignIn, wraps the tokens in RefreshingTeammateCredential to call GET /v1/app-config and GET /v1/teammates/@me, and passes the in-memory teammate access token to <tf-today-session>, <tf-record>, and <tf-live-cues> via setToken(token) over postMessage (never in URLs or browser storage).
See Sign in with TechnicallyFit and Drop-in components for origin allowlist rules, WCAG AA accent contrast checks, and mobile web view setup.