The organization API is in early access and is not yet available to every organization.
Live sessions are currently enabled in staging and gated behind early access in production.
- Authentication: Connect to
wss://<host>/v1/livewith an organization key (X-API-Key) or a teammate token (Authorization: Bearer <token>) carrying theevents:writescope. - Consent: Before a teammate claims their account, live sessions are always accepted.
After the claim, the teammate must allow the
eventsconsent item. - One ingestion path: A live session does not write raw samples to the teammate’s
history. When you close the session, the folded summaries enter through the same consent,
route limit, and duplicate checks as
POST /v1/teammates/{external_id}/events.
tf_test_) while you build. Never paste a live key into a
page, a ticket or a chat.
Opening and streaming a session
Open a session for one teammate, send live readings in numbered batches, listen for live cues, and close the session when the workout finishes. Both published SDKs provide a live helper (openLiveSession in @technicallyfit/sdk and open_live_session in
technicallyfit[live]).
Wire protocol
Every message on/v1/live is a JSON object with a type field.
1. Open a session
Sendsession.open after the WebSocket connects. Pass an optional idempotency_key if your
client may retry opening the same session.
Client -> Server
Server -> Client
2. Stream numbered batches and acknowledgements
Send readings inreadings.batch frames with a monotonically increasing seq starting at
1. The gateway acknowledges each batch with readings.ack. If you resend a batch whose
seq was already acknowledged, the gateway acknowledges it again without double-counting
its readings.
Client -> Server
Server -> Client
3. Live cues
While readings arrive, the gateway tracks session summaries (such as a mean, a peak, or velocity loss within a set) and evaluates live cue rules. When a cue fires, the gateway sends acue.emitted frame. Each cue respects a cooldown window so the same cue does not
repeat on every rep, even if the client disconnects and resumes.
Server -> Client
4. Resuming after a drop
If the network drops or a server restarts during a deploy, reconnect to/v1/live and send
session.resume with the session_id and your last_acked_seq. The gateway restores your
session checkpoint and cue cooldowns, replies with session.opened ("resumed": true), and
you continue from last_acked_seq + 1.
Client -> Server
Server -> Client
5. Closing and the close answer
Sendsession.end when the workout finishes. The gateway folds the session’s readings once
into summaries and writes them through the events ingestion path. The session.ended frame
returns one result per folded observation, using the same accepted, duplicate, and
rejected statuses as Sending events.
Client -> Server
Server -> Client
Limits and errors
Every refusal or error arrives as asession.error frame with a stable code, a plain
sentence message, and a retryable flag.
Server -> Client
See Rate limits and Plans for
the default live session limits and how organization contracts configure them.