A failed request gets an HTTP status and a JSON error envelope. Switch on code, and on details.reason where there is one. Never switch on message: it is written for people and may change.
{"error":{"code":"FORBIDDEN","message":"This API key cannot call this route","requestId":"9f8d2c1a-6b4e-4f0a-8c3d-2e1b5a7f9c60","details":{"reason":"insufficient_scope"}}}
code is one of a stable list of categories, below. The specific cause goes in details.reason.
requestId is the same as the X-Request-Id header that every response carries. Log it with the error, so you can trace a failure in your own records.
details is there when there is more to say: reason, issues, limit, max, rev or retryAfter.
details.reason names the cause of most 403 responses, and of some 409 and 422 responses. A few 403s carry none: a request from a browser, and a change to a built-in exercise. New reasons can appear within v1, so treat a reason you do not know like its code alone.
Reasons an API key can get
Reason
Status
Meaning
insufficient_scope
403FORBIDDEN
The key has none of the operation’s scopes, is the wrong kind of key, or the route is for people only, such as inviting a trainer.
plan_required
403FORBIDDEN
The organisation needs a plan in good standing for this: for webhooks, its own Pro or Trainer/Gym plan. The owner starts or changes the plan on the organisation’s Plan page in the portal; then send the request again.
plan_limit
422LIMIT_EXCEEDED
The plan allows no more of what details.limit names, apiKeys or programmes, and details.max is its allowance. Make room by revoking a key or archiving a programme, or move to a plan that allows more: an organisation’s owner on its Plan page in the portal, a person on Plan under Settings. See reaching a limit.
idempotency_key_reused
422VALIDATION
The Idempotency-Key was used in the last 24 hours for a different request.
idempotency_in_progress
409PAYLOAD_MISMATCH
The first request with this Idempotency-Key is still running. Retry after Retry-After: 1.
not_shared
403FORBIDDEN
The customer does not share their workouts with your organisation.
Reasons only members get, in the portal
Reason
Status
Meaning
role
403FORBIDDEN
The member’s role does not allow it, for example a trainer changing a programme someone else wrote.
owner
403FORBIDDEN
The owner cannot leave, be removed or change their own role. They transfer ownership or delete the organisation first.
solo
403FORBIDDEN
Independent trainers have one member, so they cannot invite trainers.
Reasons customers get on their own programmes
Reason
Status
Meaning
customer_cannot_edit
403FORBIDDEN
The programme belongs to an organisation that does not let customers change it.
customer_cannot_copy
403FORBIDDEN
The programme belongs to an organisation that does not let customers copy it.
not_owner
403FORBIDDEN
Only the owner archives a programme. A customer removes an assigned one from their list instead.
Reasons people get when they join or change sign-in
Reason
Status
Meaning
already_customer
422VALIDATION
The person accepting the invitation is already a customer of that organisation.
already_member
422VALIDATION
The person accepting the invitation is already a member of that organisation.
last_identity
422VALIDATION
A person cannot remove their last way to sign in.
Reasons on the payment routes, which work only in the web portal
Reason
Status
Meaning
web_only
403FORBIDDEN
Checkout and billing management work only in the web portal.
billing_off
422VALIDATION
Payments are not open yet.
plan_kind
422VALIDATION
The plan does not fit the organisation: Pro is for an independent trainer, not a gym.
already_subscribed
422VALIDATION
The account already has a plan. Change it in the billing portal.
no_billing_account
422VALIDATION
There is no plan to manage yet.
not_linked is not an error reason: it is an assignment outcome, given per customer in a successful response.
The request schema: for example invalid_type, too_small, too_big, invalid_value, custom (such as a duplicate in a list) and unrecognized_keys, for a field the operation does not take. Requests are closed: unknown fields are refused, not ignored.
The API’s own checks: REQUIRED, INVALID, TOO_LONG, OUT_OF_RANGE, TOO_MANY, TOO_FEW, DUPLICATE, UNKNOWN_REFERENCE for an ID that does not exist for you, and NOT_HTTPS, IP_LITERAL and OWN_DOMAIN for webhook addresses.
Which limit, for example activeProgrammes, privateExercises, privateMachines, invitations or webhooks, or with the reason plan_limit, apiKeys or programmes
details.max
LIMIT_EXCEEDED, reason plan_limit
The plan’s allowance for the limit in details.limit
Wait 1 second, then retry with the same Idempotency-Key.
5xx, a timeout or a network error
Retry with growing waits. Send the same Idempotency-Key, so a POST cannot happen twice.
412 REVISION_CONFLICT
Fetch the current revision, apply your change to it, and save again.
403, reason insufficient_scope
A key’s scopes cannot be changed. Replace the key with one that holds a scope the operation lists, or use the other kind of key. Trainer invitations are made by owners and admins in the portal.
422 LIMIT_EXCEEDED
Make room, then send the request again. By details.limit: archive programmes (activeProgrammes), exercises (privateExercises) or machines (privateMachines) you no longer use, revoke pending invitations (invitations), or delete an endpoint (webhooks). Archived items and expired invitations do not count.
422 LIMIT_EXCEEDED, reason plan_limit
The plan allows no more apiKeys or programmes, and details.max is its allowance. Revoke a key or archive a programme you no longer use, or move to a plan that allows more (reaching a limit).
403, reason plan_required
The organisation needs a plan, and for webhooks a plan of its own that includes them. Its owner starts or changes the plan on the organisation’s Plan page in the portal; then send the request again.