Guide
Authentication and keys
Every request carries an API key in the Authorization header. There are two kinds of key, and each holds scopes that decide which operations it may call.
Two kinds of key
| Organisation key | Personal key | |
|---|---|---|
| Starts with | wwo_ | wwp_ |
| Belongs to | A gym or an independent trainer | One person |
| Created by | The organisation’s owner or an admin, in the portal under Developers | The person, in the portal under Settings |
| Reaches | Its own organisation’s routes, /v1/orgs/{orgId}/… | That person’s own data, read only |
| Rate limit | 100 requests a minute | 30 requests a minute |
A key is its prefix followed by 32 random bytes in base64url. An organisation key never works on a personal route, and a personal key never works on an organisation route: both get 403 FORBIDDEN with the reason insufficient_scope.
How many active keys an account can have is set by its plan, in plans and limits. A person’s personal keys and the keys of the independent-trainer organisations they own share one allowance; a gym’s keys have their own.
Sending a key
GET /v1/orgs/org_id/programmes HTTP/1.1
Host: api.wristworkout.com
Authorization: Bearer wwo_your_key- Write the header exactly as
Bearer, one space and the key. - Send the key only in the
Authorizationheader. Never put it in a URL, where it ends up in logs and histories. - Keep keys on your server, in a secret store or an environment variable. Anyone who opens a web page, or unpacks an app, can read a key inside it. The API does not answer browsers: a request with an
Originheader gets 403. - Wrist Workout stores only a SHA-256 hash of each key, so it cannot show a key again. Copy it when you create it.
Scopes
A key may call an operation only if it holds one of the scopes the operation lists. The same lists are in the reference, and the API enforces exactly those lists. Any organisation key may call GET /v1/orgs/{orgId}, whatever its scopes.
Organisation keys wwo_
programmes:read5 operationsRead library programmes, their revisions and flags, and the organisation’s exercises and machines.
programmes:write11 operationsCreate, publish, archive and duplicate library programmes, set their flags, and manage the organisation’s exercises and machines.
- POST
/v1/ orgs/ {orgId}/ programmes - PUT
/v1/ orgs/ {orgId}/ programmes/ {programmeId} - PATCH
/v1/ orgs/ {orgId}/ programmes/ {programmeId} - DELETE
/v1/ orgs/ {orgId}/ programmes/ {programmeId} - POST
/v1/ orgs/ {orgId}/ programmes/ {programmeId}/ duplicate - POST
/v1/ orgs/ {orgId}/ exercises - PATCH
/v1/ orgs/ {orgId}/ exercises/ {id} - DELETE
/v1/ orgs/ {orgId}/ exercises/ {id} - POST
/v1/ orgs/ {orgId}/ machines - PATCH
/v1/ orgs/ {orgId}/ machines/ {id} - DELETE
/v1/ orgs/ {orgId}/ machines/ {id}
- POST
customers:read3 operationsRead customers (display name, your note, coach, since) and pending customer invitations.
customers:write4 operationsInvite customers, revoke invitations, change your note or a customer’s coach, and unlink customers.
assignments:read1 operationRead assignments.
assignments:write2 operationsAssign programmes with weekly slots, and unassign them.
results:read2 operationsRead shared workouts, only while each customer shares them.
webhooks:manage6 operationsManage webhook endpoints, send test events and read deliveries.
Personal keys wwp_
profile:read2 operationsYour profile and your coaching links.
programmes:read9 operationsYour programmes and their revisions, your exercises and your machines.
schedule:read2 operationsYour schedule, and what today and the next 7 days resolve to.
sessions:read3 operationsYour workouts and progress.
Give each integration its own key with only the scopes it needs, so you can revoke one without touching the others.
A key’s scopes cannot be changed after it is created. To change them, replace the key.
What keys never do
An organisation key reaches the whole organisation within its scopes, as an admin would: every customer and every library programme. Some things stay with people in the portal. A key never:
- creates, lists or revokes keys;
- invites trainers, or adds, removes or changes members;
- renames or deletes the organisation;
- starts or manages a plan.
No key works on the routes for signing in, accounts, data export, deletion, pairing watches or payments.
Expiry and revoking
- A key expires after the 30 to 365 days chosen when it was created, or never. The date cannot be changed later.
- Nothing warns before a key expires. Note the date, which the portal shows, and replace the key before then.
- Revoke a key in the portal at any time. A revoked or expired key gets 401
UNAUTHENTICATEDon its next request, the same as a key that never existed, and leaves the portal’s list. - If a key that worked starts getting 401, look for its first 12 characters in the portal’s list. If they are not there, the key has expired or been revoked.
- The portal lists each key with its name, its first 12 characters, its scopes, and when it was created, last used and expires. The last-used time moves at most once a minute.
- Each account holds at most 20 active keys, within its plan’s allowance. A plan that ends or allows fewer revokes no key: only a new one is refused.
Replacing a key
To replace a key without a gap, for new scopes or a new expiry: create the new key, deploy it, check that its last-used time moves, then revoke the old key. The new key needs room in the plan’s allowance, so at the allowance, revoke a key you no longer use first.
Personal keys
A person creates a personal key in Settings to read their own data with their own tools. Personal keys are read only, and have four scopes: profile:read, programmes:read, schedule:read and sessions:read. Your data lists the operations they can call. They count against the best plan covering the person, which can come with a seat at a gym or trainer they belong to or are a customer of.
No OAuth
Wrist Workout does not offer OAuth. An organisation acts on its own data and on the customers who joined it, and a customer who wants to work with their own data uses a personal key.
Working for several organisations
A booking or membership system that serves several gyms or trainers uses one key from each of them. The terms allow it, as long as each key is used only for its own organisation.
- The organisation’s owner or an admin creates a key under Developers in the portal, with the scopes your system needs, and gives it to you with the organisation’s ID from the portal’s address. A gym’s own plan, or the plan covering an independent trainer, must allow keys.
- Store each key with its organisation’s ID. No route tells a key which organisation it belongs to, and a key used with any other organisation’s ID gets 404
NOT_FOUND. - Check each pair with
GET /v1/orgs/{orgId}, which any key of the organisation may call. - Add a webhook endpoint in each organisation with that organisation’s key, which needs
webhooks:manage, and a plan of the organisation’s own that includes webhooks. Give each endpoint a path of its own, such ashttps://example.com/hooks/wrist-workout/q3Hn8VbT2kLm, so your receiver knows which secret to check before it reads the body.