Skip to main content
An organization key reads and writes every teammate of your organization. It belongs on your server and never inside a mobile app, a browser or any other code that ships to a person’s device. When your own app needs to talk to TechnicallyFit for one person, the person signs in and your app gets a teammate token: a credential for that one teammate of your organization, nothing more.

What a teammate token can do

A teammate token is short-lived, belongs to one teammate of one organization, and can be revoked at any time.
  • It addresses its teammate as @me, for example GET /v1/teammates/@me. Any other teammate id answers 404.
  • It never sees more than your organization’s key could. What it can do is the overlap of its scopes and the teammate’s own consent: with a consent item off, the matching call answers 403 consent_required, exactly as it does for your key.
  • It never changes consent and never leaves the organization. Those happen on the teammate’s own account page, whose address GET /v1/teammates/@me returns as account_url. A 403 consent_required answer to a teammate token carries the same address in details.account_url, so your app can send the person there.
  • Every other route refuses it with 403 forbidden, including every route that needs an organization key.
The operations that accept a teammate token list a second security scheme, TeammateToken, in the API reference. A teammate token never holds teammates:write, proposals, webhooks, insights or location writes.

Calling /@me operations

A teammate token calls these operations, always with @me in place of the teammate id. Each needs its scope on the token and the consent item the teammate allowed your organization when they signed in. Consent is read again on every call. Read today’s session for the signed-in teammate:
200
session is null on a day with nothing planned, and next_session_date names the next day that has a session.

Starting today’s session

Call POST /v1/teammates/@me/sessions/today:start with programs:write on the token and the teammate’s programs consent item allowed. Send an effort: An easier or harder session is stored, so the teammate’s app and every later read of today’s session show the rebuilt session. Rebuilding asks the training engine, so it can take a few seconds longer than as_planned.
  • Once today’s session has started, calling it again that day, with any effort, changes nothing and returns 200 with the same started_at and session. The response’s effort is the one the session started with, not the one you sent.
  • When no session is scheduled for today, it answers 404 not_found.
  • When programs consent is missing or switched off, it answers 403 consent_required.
  • Calling with any teammate id other than @me answers 404 not_found.
The same call with the SDKs, and its answer:
200

Sending events

On POST /v1/teammates/@me/events a teammate token sends logged_set, observation (self-reports on the teammate route only; any other route is rejected with invalid_event on data.source.route, tying its route and confidence to teammate) and visit_check_in only. Any other type comes back in the results as rejected with event_type_not_allowed; send those from your server with your organization key. Leave teammate out of each event, or send @me. A set and a soreness report from the app go through; a constraint does not, because only your organization key sends it:
200
What a refused call returns:

Register your app

An owner or admin of your organization registers each app for one mode (test or live), with:
  • a name, shown to the person when they sign in;
  • the redirect addresses your app receives the sign-in result on: an https link your app has claimed, or a private-use scheme named after your domain such as com.example.gym:/callback. Loopback http addresses work in test mode only;
  • the scopes the app may ask for, from the table above;
  • whether a person with no invitation may join your organization while signing in.
Registering gives you a client_id. There is no client secret: an app cannot keep one. Turning an app off signs every teammate out of it at once.

Reading app configuration before sign-in

Call GET /v1/app-config?client_id=<your client_id> on launch to load your organization’s branding and enabled app features before a teammate signs in. This endpoint is public and takes no API key or teammate token. It returns your organization’s display_name, logo_url, primary_color, accent_color, support_email, gym_handle, features (programs, visit_check_ins and coaches) and updated_at.
curl

Sign a teammate in

Sign-in is the standard OAuth authorization code flow with PKCE. The person signs in on a page TechnicallyFit hosts, shown with your organization’s name, logo and colors.
1

Make a PKCE pair

Make a random code_verifier and its SHA-256 code_challenge (base64url, no padding).
2

Open the authorization address

Open the authorization address in the system browser, never in a web view:
Add claim=<token> when the person opened one of your invitation links, so they claim their account while they sign in.
3

The person signs in

The person signs in or signs up, and then:
  • if they are already your teammate, they confirm in one step;
  • if an invitation came with the sign-in, they claim it and choose what to share;
  • if your app allows joining, they join your organization and choose what to share;
  • otherwise your app receives error=access_denied.
4

Exchange the code

Your redirect address receives code and your state. Check the state, then exchange the code:
Tokens
5

Call the API as the teammate

Call the API with Authorization: Bearer <access_token>:
Store both tokens in the device’s secure storage and never log them. The TypeScript and Python SDKs run these steps for you and give you a credential that refreshes itself.

Refresh and sign out

An access token lasts one hour. Exchange the refresh token for a new pair before it expires:
Each refresh returns a new refresh token and retires the old one; a refresh token lasts 30 days from its last use. Refresh one request at a time. Using a retired refresh token again signs the person out of your app, because it means the token was copied. To sign out, send POST /oauth/revoke with token=<refresh_token>. The person can also sign out of your app from their TechnicallyFit settings.

When a teammate leaves

A teammate token stops working at once, and the next request answers 401, when:
  • the teammate leaves your organization;
  • the teammate deletes their account;
  • the person signs out of your app, in your app or in their settings;
  • your organization turns the app off.
The refresh token stops working at the same moment. Send the person back to sign-in.