Skip to main content
An event is one thing your organization knows about a teammate: a reading, an injury, a change of equipment or a change of schedule. You send events in batches, and every event is answered on its own. Your systems retry and devices sync late, so the same event will reach us more than once. It is stored once. 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.

Two endpoints

Both need a key with the events:write scope, and a request body of at most 1 MB. Both answer 200 whenever the request itself is well formed, also when some events in it are rejected. Read the result of each event.
The teammate in the path is your own id for them (see Teammates and ownership). Create the teammate first: an event for a teammate you have not created is not accepted. In the bulk endpoint each event also names its teammate:

The fields of an event

An unknown field on an event is rejected, so a typo never passes silently.

Event types

observation

data is one observation in the observation/1 format. Observations lists every field, the quantities and their units.
  • A quantity on the list is checked: its unit, its measure and its body location must be ones that quantity takes. A unit we cannot convert is rejected with unit_not_convertible, and the message lists the units the quantity takes.
  • A quantity that is not on the list is accepted and kept. Its result says "kind": "unknown".
  • Every accepted observation answers "status": "not_interpreted": it is stored and has not been used yet.
  • Streams reach the API as summaries, never as raw sample lists. If you stream a session over Real-time, its folded summaries arrive as ordinary observation readings through this same path when the session ends.
  • data.teammate is optional. When you send it, it must be the teammate the event is for.
  • Pain, soreness and session effort are self-reports, with a scale and two routes of their own: teammate and coach. A value off the scale is value_out_of_range, and another quantity on those routes is route_quantity_not_allowed. Without a device has the rules and examples.

constraint

Adds or clears a limitation at a joint.

equipment_change

Changes the teammate’s own equipment. Send at least one of the three lists. Every entry is a token, a name or another spelling from the equipment reference. An entry that is not on it is rejected, and field names the entry.

schedule_change

Changes the days the teammate can train. Send at least one of the two fields.

visit_check_in

A teammate’s visit to one of your locations, from your app or your door system. It needs an idempotency_key and at. See Visit check-ins.
A location you do not have, or one that is archived, is rejected with unknown_location. A time more than five minutes ahead of our clock is rejected with at_in_future.

logged_set

One set the teammate performed: a movement, the reps, and the load, effort, duration or distance when you have them. It is stored with the teammate’s training, marked as sent by your organization, with its source route, device, record id and confidence. Its facts (reps, load, and any measures you send with it) are also stored as observations of the set.
  • A logged set is keyed by its source, as an observation is: source.route together with source.record_id. Sending the same set again answers duplicate and stores nothing.
  • A movement id that is not in the movement reference is rejected with unknown_movement. Send a name instead for a movement we do not list.
  • A measure is checked like an observation: a unit the quantity does not take is unit_not_convertible. A quantity that needs a body location belongs in an observation event.
  • The set belongs to the teammate. It counts as training they did, and it stays with them when they leave your organization. Sets you send earn no XP, accolades or personal records in the TechnicallyFit app.
  • A logged set is new information only. To correct a set, send it with a new record_id.

Results

The response lists one result per event, in the order you sent them, and a count of each status. This is the answer to the organization key example above, with a third event added that sends a load in a unit the quantity does not take:
200
index is the position of the event in your request. event_id is our id for the stored event. It is null for an event we could not store at all: one with no usable key, one of an unknown type, or one for a teammate you cannot send events for.

Idempotency

Every event has a key, and we store one event per key for each teammate.
  • An observation and a logged_set are keyed by their source: source.route together with source.record_id. Give each reading a record_id that stays the same when you send it again.
  • Every other type is keyed by the idempotency_key you send.
Sending the organization key example again answers:
200
  • The first accepted copy wins. A later event with the same key is a duplicate even when its content differs, so use a new key for a new fact.
  • A rejected event is not final. Fix it and send it again with the same key, and it is accepted under the same event_id.
  • Keys are separate per teammate and per mode. A test key and a live key never see each other’s events.

Rejection codes

A reason.message never repeats a value you sent. Before a teammate claims their account, the events you send are your organization’s own data and are always accepted. After the claim you can send events only while the teammate allows the events item.
  • On the per-teammate endpoint the whole request answers 403 with code consent_required, or 404 with code not_found for a teammate you do not have.
  • On the bulk endpoint those two are results of single events, and the rest of the batch is processed as usual.
Teammates and ownership explains both answers.

Read back what you sent

With an organization key holding events:read, you can list the events your organization sent, newest first by received time, for one teammate (GET /v1/teammates/{external_id}/events) or across your whole organization and mode (GET /v1/events). Filter by type, status (accepted or rejected), from (inclusive received time) and to (exclusive received time), and page with limit (1 to 100, default 50) and cursor. Each entry returns id, teammate, type, status, key, occurred_at, received_at, accepted_at, attempts, reason (for a rejected event), and revisions (any program revision that names the event, or null when a claimed teammate does not allow programs).
Two limits apply to the stored event log:
  • A corrected resend overwrites its earlier rejected row in place; only the send count (attempts) remains from the earlier attempts.
  • Disconnecting a source route deletes the events stored for that source.

Batching and retries

  • Send what you have in one request: up to 500 events for one teammate, up to 1,000 across teammates, at most 1 MB.
  • A request over a limit is refused as a whole: 422 with code validation_failed for an empty or oversized list of events, 413 with code payload_too_large for a body over 1 MB. Split it and send the parts.
  • When a request fails with a 429, a 5xx or a network error, send the same request again. Events that were already stored answer duplicate, so a retry never stores an event twice.
  • Events for the same teammate are decided in the order you list them.
Errors describes the body of every whole-request error.