Skip to content
Developer docsAssignments

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/v1/orgs/{orgId}/assignments

Newest first; filter by programme or customer. Trainers see their own customers’ assignments.

Key
Organisation key, wwo_
Scope
assignments:read
Plans
Pro and Trainer/Gym. Plans and limits

Path parameters

orgIdstringRequired

The organisation’s ID. A key works only on its own organisation.

1 to 64 characters.

Query parameters

cursorstring

nextCursor from the previous page.

At most 400 characters.

limitinteger

Page size, 20 when left out.

1 to 50.

programmeIdstring

Only this programme’s assignments.

An ID of 12 letters and digits.

customerIdstring

Only this customer’s assignments.

An ID of 12 letters and digits.

Response 200 · Assignments

itemsarray of objectsRequired
6 fields in each item
programmeIdstringRequired
programmeNamestringRequired
customerIdstringRequired

The customer’s ID in your organisation (a link ID).

customerNamestringRequired
assignedByobject or nullRequired

A member of the organisation.

2 fields
userIdstringRequired
displayNamestringRequired
sinceintegerRequired

Unix time in seconds

nextCursorstring or nullRequired

Send it as cursor for the next page. Null on the last page.

Errors

Errors any call can get: 401, 403, 404, 422, 429
401UNAUTHENTICATEDThe key is missing, unknown, expired or revoked.
403FORBIDDENinsufficient_scopeThe key lacks the scope, or is a personal key.
403FORBIDDENplan_requiredWhen API keys need a plan and the organisation has none in good standing.
404NOT_FOUNDThe organisation is not the key’s own.
403FORBIDDENThe request came from a web page (it has an Origin header). Call the API from your server.
422VALIDATIONA parameter or the body breaks the schema.
429RATE_LIMITEDThe 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/v1/orgs/{orgId}/assignments

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.

Key
Organisation key, wwo_
Scope
assignments:write
Plans
Pro and Trainer/Gym. Plans and limits

Path parameters

orgIdstringRequired

The organisation’s ID. A key works only on its own organisation.

1 to 64 characters.

Headers

Idempotency-Keystring

Makes 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

programmeIdstringRequired

An ID of 12 letters and digits.

customerIdsarray of stringsRequired

Customer IDs (link IDs), 1 to 100.

1 to 100 items. Each item: an ID of 12 letters and digits.

weekdaysarray of integers

ISO 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

programmeIdstringRequired
resultsarray of objectsRequired
2 fields in each item
customerIdstringRequired

The customer’s ID in your organisation (a link ID).

outcomestringRequired

limit_exceeded: the customer already has 30 active programmes, their own and assigned ones together.

One ofassignedalready_assignednot_linkedlimit_exceeded

Errors

403FORBIDDENplan_requiredWhen the organisation needs a plan to assign programmes.
422VALIDATIONprogrammeId is not an active programme in the library (UNKNOWN_REFERENCE).
Errors any call can get: 400, 401, 403, 404, 409, 413, 422, 429
401UNAUTHENTICATEDThe key is missing, unknown, expired or revoked.
403FORBIDDENinsufficient_scopeThe key lacks the scope, or is a personal key.
403FORBIDDENplan_requiredWhen API keys need a plan and the organisation has none in good standing.
404NOT_FOUNDThe organisation is not the key’s own.
403FORBIDDENThe request came from a web page (it has an Origin header). Call the API from your server.
400MALFORMEDThe body is not valid JSON.
413PAYLOAD_TOO_LARGEThe body is over 64 KiB.
422VALIDATIONA parameter or the body breaks the schema.
422VALIDATIONidempotency_key_reusedThe Idempotency-Key was used for a different request.
409PAYLOAD_MISMATCHidempotency_in_progressThe first request with this Idempotency-Key is still running (for up to a minute).
429RATE_LIMITEDThe 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/v1/orgs/{orgId}/assignments/{programmeId}/{customerId}

It leaves their programme list, weekly schedule and future days. Recorded workouts keep it.

Key
Organisation key, wwo_
Scope
assignments:write
Plans
Pro and Trainer/Gym. Plans and limits

Path parameters

orgIdstringRequired

The organisation’s ID. A key works only on its own organisation.

1 to 64 characters.

programmeIdstringRequired

The programme’s ID.

1 to 64 characters.

customerIdstringRequired

The customer’s ID in your organisation, from the customers list.

1 to 64 characters.

Response 200 · Unassigned

okbooleanRequired

Valuetrue

Errors

404NOT_FOUNDNo such customer, or the programme is not assigned to them.
Errors any call can get: 401, 403, 404, 422, 429
401UNAUTHENTICATEDThe key is missing, unknown, expired or revoked.
403FORBIDDENinsufficient_scopeThe key lacks the scope, or is a personal key.
403FORBIDDENplan_requiredWhen API keys need a plan and the organisation has none in good standing.
404NOT_FOUNDThe organisation is not the key’s own.
403FORBIDDENThe request came from a web page (it has an Origin header). Call the API from your server.
422VALIDATIONA parameter or the body breaks the schema.
429RATE_LIMITEDThe 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();