tf_test_) while you build. Never paste a live key into a
page, a ticket or a chat.
Set a goal
A goal is what the teammate trains for: a goal type, an optional measurable target and an optional due date. Your organization keeps one goal per teammate; sending it again replaces it. The teammate’s own goals are not read or changed.200
GET /v1/teammates/{external_id}/goal reads it back, and answers 404 not_found when you have
set none. Setting a goal needs programs:write; reading it needs programs:read.
Create a program
A program is built as a job. Send the schedule; the goal is the one you set, or thegoal you
send in the same call.
202 with the job:
202
A program your organization creates never replaces one the teammate or their coach made: it is
saved, and the teammate chooses in their app.
Poll the job
200
status moves from queued to running, then to succeeded or failed. Poll every few
seconds; a program usually takes under a minute. A job is readable with a key of the
organization and mode that created it, and answers 404 after the teammate left.
A failed job’s
error.code is one of:
A teammate with a coach
When the teammate has a coach, the program is saved and not started. It waits as a proposal whose cause kind iscreated, and proposal.created fires. When the coach accepts it, the
program starts and program.revised fires with approval.mode coach. When the coach
declines, the program stays saved. See Proposals and coach approval.
Webhooks
A started program firesprogram.revised with revision 1, a null parent_revision and
the cause kind created:
program.revised
Errors
List a teammate’s programs
GET /v1/teammates/{external_id}/programs lists the teammate’s programs, newest first, so you
can find the id the reads below need.
- Organization key
- Teammate token
200
status is active, saved, waiting_for_coach or completed. created_by is
organization when your organization created it in this mode, else teammate or coach.
weekly_sessions is the number of sessions planned in the first week.
revision is the latest recorded revision, or null when none is recorded yet. No week or
session content is listed: read revisions and today’s session for that.
Reading a program
Both need a key with the
programs:read scope. After the teammate claims their account, they
also need to allow programs; until then, your organization can read what it sent for them.
Revisions
- Organization key
- Teammate token
200
limit, default 20). When next_cursor is not null, pass it
as cursor to read the next page. Revision 1 is the program as it was created and has no
diff.
Causes
cause.kind says why the program changed. cause.summary says it in a sentence you can show.
cause.event_ids are the ids of the events you sent that caused it, as
sending events returned them.
week_number counts from 1 and day_index is the weekday, 0 for Monday to 6 for Sunday.
Diffs
diff says what changed from from_week and from_day on; earlier days never change.
weeks_changed lists every week with any change, sessions_added and sessions_removed
count sessions, and changes lists each movement that was swapped, added (before is null)
or removed (after is null). A movement id is the id the
movement catalog uses.
A session_id names the session as it is planned now, in the form
{weekly_plan_id}:{session_index}. It is the id to send as session.planned_session_id when you
log sets against that session. It is null when that day has no session now.
Targets
feasibility has one entry per target the teammate set. feasible is true when the program is
on course to reach the target, false when it is likely out of reach, and null while there is
not enough training logged to say. projected_final is where the target is expected to land,
and shortfall how far short of the target that is.
Approval
A change waits for the coach only when the teammate has an active coach and the change alters
a session; see Proposals and coach approval. A declined
or replaced change keeps its revision number, and the next change can use the same number, so
two revisions can share one.
Today’s session
- Organization key
- Teammate token
200
date is today in the teammate’s time zone: the one the teammate set after they claimed their
account, else the timezone you set for them, else UTC. The session is the one scheduled for
that date on the teammate’s active program. When nothing is scheduled today, session is null
and next_session_date is the next date that has one. A program the teammate works through at
their own pace has no dates, so it has no session today and no next date.
effort chooses the version:
An easier or harder version is built when you ask and is not stored: the program does not
change, and the next read as planned returns the stored session. Building it can take a few
seconds. When it cannot be built right now, the answer is
503 engine_unavailable; try again
shortly. effort_target is the planned effort on a scale of 1 to 10, where 10 is the most a
teammate could do.