Skip to content
Developer docsAuthentication and keys

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

Two kinds of key
Organisation keyPersonal key
Starts withwwo_wwp_
Belongs toA gym or an independent trainerOne person
Created byThe organisation’s owner or an admin, in the portal under DevelopersThe person, in the portal under Settings
ReachesIts own organisation’s routes, /v1/orgs/{orgId}/…That person’s own data, read only
Rate limit100 requests a minute30 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

HTTP
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 Authorization header. 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 Origin header 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_

Personal keys wwp_

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 UNAUTHENTICATED on 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.

  1. 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.
  2. 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.
  3. Check each pair with GET /v1/orgs/{orgId}, which any key of the organisation may call.
  4. 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 as https://example.com/hooks/wrist-workout/q3Hn8VbT2kLm, so your receiver knows which secret to check before it reads the body.