Skip to content
Developer docsErrors

Conventions

Errors

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.

The envelope

JSON
{
  "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.

Codes

Codes an integration can get
StatusCodeMeaning
400MALFORMEDThe body is not valid JSON.
401UNAUTHENTICATEDNo key, or a key that is unknown, expired or revoked.
403FORBIDDENNot allowed. details.reason usually says why, for example insufficient_scope.
404NOT_FOUNDIt does not exist, or it is not yours to see. The API never says which.
409PAYLOAD_MISMATCHA request with the same Idempotency-Key is still running (idempotency_in_progress).
412REVISION_CONFLICTThe programme changed since the revision in If-Match. details.rev is the current one.
413PAYLOAD_TOO_LARGEThe body is over 64 KiB, or over 128 KiB on programme routes.
422VALIDATIONThe request breaks a rule. details.issues lists each path and code.
422LIMIT_EXCEEDEDAn account limit, or the plan’s allowance, is reached. details.limit names it; with the reason plan_limit, details.max is the allowance.
422PLAN_TOO_LARGEThe programme would be too large for the watch. details.watchBytes is its size, details.limit the maximum.
422PLAN_ARCHIVEDArchived programmes cannot be changed.
429RATE_LIMITEDToo many requests. Wait for the seconds in Retry-After (also in details.retryAfter).
500INTERNALSomething failed on our side. Retry with backoff.
Codes only the apps and the watch get
StatusCodeMeaning
401REAUTH_REQUIREDA person must sign in again first.
401DEVICE_REVOKEDA watch was unlinked.
409ACCOUNT_DELETINGThe account is being deleted.
409IDENTITY_IN_USEA sign-in belongs to another account.
422MISSING_PARTSA workout upload is incomplete.
422PAIRING_EXPIREDA watch pairing code expired.
422PAIRING_INVALIDA watch pairing code is wrong.

Reasons

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
ReasonStatusMeaning
insufficient_scope403FORBIDDENThe 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_required403FORBIDDENThe 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_limit422LIMIT_EXCEEDEDThe 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_reused422VALIDATIONThe Idempotency-Key was used in the last 24 hours for a different request.
idempotency_in_progress409PAYLOAD_MISMATCHThe first request with this Idempotency-Key is still running. Retry after Retry-After: 1.
not_shared403FORBIDDENThe customer does not share their workouts with your organisation.
Reasons only members get, in the portal
ReasonStatusMeaning
role403FORBIDDENThe member’s role does not allow it, for example a trainer changing a programme someone else wrote.
owner403FORBIDDENThe owner cannot leave, be removed or change their own role. They transfer ownership or delete the organisation first.
solo403FORBIDDENIndependent trainers have one member, so they cannot invite trainers.
Reasons customers get on their own programmes
ReasonStatusMeaning
customer_cannot_edit403FORBIDDENThe programme belongs to an organisation that does not let customers change it.
customer_cannot_copy403FORBIDDENThe programme belongs to an organisation that does not let customers copy it.
not_owner403FORBIDDENOnly 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
ReasonStatusMeaning
already_customer422VALIDATIONThe person accepting the invitation is already a customer of that organisation.
already_member422VALIDATIONThe person accepting the invitation is already a member of that organisation.
last_identity422VALIDATIONA person cannot remove their last way to sign in.
Reasons on the payment routes, which work only in the web portal
ReasonStatusMeaning
web_only403FORBIDDENCheckout and billing management work only in the web portal.
billing_off422VALIDATIONPayments are not open yet.
plan_kind422VALIDATIONThe plan does not fit the organisation: Pro is for an independent trainer, not a gym.
already_subscribed422VALIDATIONThe account already has a plan. Change it in the billing portal.
no_billing_account422VALIDATIONThere 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.

Validation issues

A 422 VALIDATION lists what failed in details.issues. Each issue has a path to the field and a code. The values you sent are never repeated back.

JSON
{
  "error": {
    "code": "VALIDATION",
    "message": "Request failed validation",
    "requestId": "c2a7e5d1-08f3-4b6c-9a1e-7d4f2b8c6e03",
    "details": {
      "issues": [
        { "path": "weekdays.0", "code": "too_big" },
        { "path": "customerIds", "code": "too_small" }
      ]
    }
  }
}

Issue codes come from two places:

  • 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.

Other details

Other details
FieldComes withMeaning
details.limitLIMIT_EXCEEDEDWhich limit, for example activeProgrammes, privateExercises, privateMachines, invitations or webhooks, or with the reason plan_limit, apiKeys or programmes
details.maxLIMIT_EXCEEDED, reason plan_limitThe plan’s allowance for the limit in details.limit
details.revREVISION_CONFLICTThe programme’s current revision
details.watchBytes, details.limitPLAN_TOO_LARGEThe plan’s size and the maximum, in bytes
details.retryAfterRATE_LIMITED, PAYLOAD_MISMATCHSeconds to wait, as in the Retry-After header

Retrying

Retrying
ResponseWhat to do
429 RATE_LIMITEDWait for the seconds in Retry-After, then retry.
409, reason idempotency_in_progressWait 1 second, then retry with the same Idempotency-Key.
5xx, a timeout or a network errorRetry with growing waits. Send the same Idempotency-Key, so a POST cannot happen twice.
412 REVISION_CONFLICTFetch the current revision, apply your change to it, and save again.
403, reason insufficient_scopeA 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_EXCEEDEDMake 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_limitThe 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_requiredThe 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.
Any other 4xxDo not retry the same request: change it first.