API reference
Assignments
Assign library programmes to customers with weekly slots, list assignments and unassign.
These operations take an organisation key (wwo_) with the scope each one lists, and work only on that key’s own organisation. Base URL https://api.wristworkout.com. Authentication and keys explains keys and scopes.
Active assignments
GET/
Newest first; filter by programme or customer. Trainers see their own customers’ assignments.
Path parameters
orgIdstringRequiredThe organisation’s ID. A key works only on its own organisation.
1 to 64 characters.
Query parameters
cursorstringnextCursorfrom the previous page.At most 400 characters.
limitintegerPage size, 20 when left out.
1 to 50.
programmeIdstringOnly this programme’s assignments.
An ID of 12 letters and digits.
customerIdstringOnly this customer’s assignments.
An ID of 12 letters and digits.
Response 200 · Assignments
itemsarray of objectsRequired6 fields in each item
programmeIdstringRequiredprogrammeNamestringRequiredcustomerIdstringRequiredThe customer’s ID in your organisation (a link ID).
customerNamestringRequiredassignedByobject or nullRequiredA member of the organisation.
2 fields
userIdstringRequireddisplayNamestringRequired
sinceintegerRequiredUnix time in seconds
nextCursorstring or nullRequiredSend it as
cursorfor the next page. Null on the last page.
Errors
Errors any call can get: 401, 403, 404, 422, 429
401UNAUTHENTICATED | The key is missing, unknown, expired or revoked. |
403FORBIDDENinsufficient_scope | The key lacks the scope, or is a personal key. |
403FORBIDDENplan_required | When API keys need a plan and the organisation has none in good standing. |
404NOT_FOUND | The organisation is not the key’s own. |
403FORBIDDEN | The request came from a web page (it has an Origin header). Call the API from your server. |
422VALIDATION | A parameter or the body breaks the schema. |
429RATE_LIMITED | The key is over its limit for this minute, or over the service-wide 120 requests a minute (then with Retry-After: 60 and no RateLimit headers). |
Example
curl https://api.wristworkout.com/v1/orgs/org_id/assignments \
-H "Authorization: Bearer wwo_your_key"const res = await fetch('https://api.wristworkout.com/v1/orgs/org_id/assignments', {
headers: { Authorization: 'Bearer wwo_your_key' },
});
const data = await res.json();Assign a programme to customers
POST/
One library programme to 1 to 100 customers. With weekdays, those days of each customer’s weekly schedule are set to it, replacing what was there; customers may change them later. Each customer gets an outcome. Send an Idempotency-Key so a retry cannot assign twice.
Path parameters
orgIdstringRequiredThe organisation’s ID. A key works only on its own organisation.
1 to 64 characters.
Headers
Idempotency-KeystringMakes a retry safe: the same key with the same request within 24 hours returns the first response. See idempotency.
1 to 64 letters, digits,
_and-.
Request body
programmeIdstringRequiredAn ID of 12 letters and digits.
customerIdsarray of stringsRequiredCustomer IDs (link IDs), 1 to 100.
1 to 100 items. Each item: an ID of 12 letters and digits.
weekdaysarray of integersISO weekdays to set to this programme on each customer’s weekly schedule.
At most 7 items. Each item: 1 to 7.
Any other field is refused with 422 VALIDATION.
Response 200 · One outcome per customer
programmeIdstringRequiredresultsarray of objectsRequired2 fields in each item
customerIdstringRequiredThe customer’s ID in your organisation (a link ID).
outcomestringRequiredlimit_exceeded: the customer already has 30 active programmes, their own and assigned ones together.assignedalready_assignednot_linkedlimit_exceeded
Errors
403FORBIDDENplan_required | When the organisation needs a plan to assign programmes. |
422VALIDATION | programmeId is not an active programme in the library (UNKNOWN_REFERENCE). |
Errors any call can get: 400, 401, 403, 404, 409, 413, 422, 429
401UNAUTHENTICATED | The key is missing, unknown, expired or revoked. |
403FORBIDDENinsufficient_scope | The key lacks the scope, or is a personal key. |
403FORBIDDENplan_required | When API keys need a plan and the organisation has none in good standing. |
404NOT_FOUND | The organisation is not the key’s own. |
403FORBIDDEN | The request came from a web page (it has an Origin header). Call the API from your server. |
400MALFORMED | The body is not valid JSON. |
413PAYLOAD_TOO_LARGE | The body is over 64 KiB. |
422VALIDATION | A parameter or the body breaks the schema. |
422VALIDATIONidempotency_key_reused | The Idempotency-Key was used for a different request. |
409PAYLOAD_MISMATCHidempotency_in_progress | The first request with this Idempotency-Key is still running (for up to a minute). |
429RATE_LIMITED | The key is over its limit for this minute, or over the service-wide 120 requests a minute (then with Retry-After: 60 and no RateLimit headers). |
Example
IDEMPOTENCY_KEY=$(uuidgen) # send the same key again if you retry
curl -X POST https://api.wristworkout.com/v1/orgs/org_id/assignments \
-H "Authorization: Bearer wwo_your_key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-d '{
"programmeId": "p7Kd2LmQ9xTe",
"customerIds": ["c4Rt8NwZ1bYs", "c9Hm3QaV6eKd"],
"weekdays": [2, 4]
}'// Send the same key again if you retry.
const idempotencyKey = crypto.randomUUID();
const res = await fetch('https://api.wristworkout.com/v1/orgs/org_id/assignments', {
method: 'POST',
headers: {
Authorization: 'Bearer wwo_your_key',
'Content-Type': 'application/json',
'Idempotency-Key': idempotencyKey,
},
body: JSON.stringify({
programmeId: 'p7Kd2LmQ9xTe',
customerIds: ['c4Rt8NwZ1bYs', 'c9Hm3QaV6eKd'],
weekdays: [2, 4],
}),
});
const data = await res.json();Unassign a programme from a customer
DELETE/
It leaves their programme list, weekly schedule and future days. Recorded workouts keep it.
Path parameters
orgIdstringRequiredThe organisation’s ID. A key works only on its own organisation.
1 to 64 characters.
programmeIdstringRequiredThe programme’s ID.
1 to 64 characters.
customerIdstringRequiredThe customer’s ID in your organisation, from the customers list.
1 to 64 characters.
Response 200 · Unassigned
okbooleanRequiredtrue
Errors
404NOT_FOUND | No such customer, or the programme is not assigned to them. |
Errors any call can get: 401, 403, 404, 422, 429
401UNAUTHENTICATED | The key is missing, unknown, expired or revoked. |
403FORBIDDENinsufficient_scope | The key lacks the scope, or is a personal key. |
403FORBIDDENplan_required | When API keys need a plan and the organisation has none in good standing. |
404NOT_FOUND | The organisation is not the key’s own. |
403FORBIDDEN | The request came from a web page (it has an Origin header). Call the API from your server. |
422VALIDATION | A parameter or the body breaks the schema. |
429RATE_LIMITED | The key is over its limit for this minute, or over the service-wide 120 requests a minute (then with Retry-After: 60 and no RateLimit headers). |
Example
curl -X DELETE \
https://api.wristworkout.com/v1/orgs/org_id/assignments/programme_id/customer_id \
-H "Authorization: Bearer wwo_your_key"const res = await fetch('https://api.wristworkout.com/v1/orgs/org_id/assignments/programme_id/customer_id', {
method: 'DELETE',
headers: { Authorization: 'Bearer wwo_your_key' },
});
const data = await res.json();