Update a trainee

PATCH/api/public/trainees/{traineeId}

Update a trainee's personal details. Only supplied fields change.

Authentication

Requires an API key, sent as Authorization: Bearer cp_live_....

API keys carry scopes. Get the catalog of scopes and webhook events lists every scope.

Path parameters

Path parameters
NameTypeDescription
traineeIdrequiredstring

Header parameters

Header parameters
NameTypeDescription
Idempotency-Keystring

Optional. Send a unique key (e.g. a UUID) to make this POST safe to retry. The same key within 24h returns the original result instead of creating a duplicate.

Request body

application/json, required

Request body fields
NameTypeDescription
namestring
phoneNumberstring
goalstring
heightnumber

Height in cm. Must not be negative.

Minimum: 0

dateOfBirthstring

Date of birth as an ISO date, for example 1990-04-23.

Pattern: ^\d{4}-\d{2}-\d{2}

genderstring

One of: Male, Female, Other. Matching is case-insensitive, so "male" is accepted and stored as "Male".

activityLevelstring

One of: Sedentary, Lightly Active, Moderately Active, Very Active, Extremely Active. Matching is case-insensitive. Feeds the TDEE calculation, so changing it changes the calorie targets derived for this trainee. Weight is NOT set here: it is a dated history, use POST /trainees/{traineeId}/body-metrics.

injuriesstring
healthConditionsstring
allergiesstring
foodPreferencesstring
foodDislikesstring

Request examples

cURL
curl --request PATCH \
  --url 'https://api.coach-platform.com/api/public/trainees/<traineeId>' \
  --header 'Authorization: Bearer cp_live_...' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>"
}'
JavaScript (fetch)
const response = await fetch('https://api.coach-platform.com/api/public/trainees/<traineeId>', {
  method: 'PATCH',
  headers: {
    Authorization: 'Bearer cp_live_...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "<string>"
  }),
});

const data = await response.json();

Responses

200 OK

Successful response

Example body (application/json)
{
  "data": {
    "id": "<string>",
    "name": "<string>",
    "email": "<string>",
    "phoneNumber": "<string>",
    "goal": "<string>",
    "profileImageUrl": "<string>",
    "personalDetails": {},
    "labels": [
      {
        "id": "<string>",
        "text": "<string>",
        "color": "<string>",
        "coachId": "<string>"
      }
    ],
    "assignedEmployees": [
      {
        "id": "<string>",
        "name": "<string>"
      }
    ],
    "activeCoachDetails": {
      "activeEscort": "<string>",
      "pendingCoach": "<string>",
      "pendingCoachDate": "<date-time>"
    },
    "createdAt": "<date-time>"
  }
}
Response fields (21)
Response fields
NameTypeDescription
dataobject
data.idstring
data.namestring
data.emailstring
data.phoneNumberstring
data.goalstring
data.profileImageUrlstring
data.personalDetailsobject
data.labelsobject[]
data.labels[].idstring
data.labels[].textstring
data.labels[].colorstring
data.labels[].coachIdstring
data.assignedEmployeesobject[]
data.assignedEmployees[].idstring
data.assignedEmployees[].namestring
data.activeCoachDetailsobject
data.activeCoachDetails.activeEscortstring | null

Id of the escort currently in use for this trainee. Fetch the full escort with GET /escorts/{escortId}.

data.activeCoachDetails.pendingCoachstring | null

Coach id this trainee is pending approval for. Set when the trainee was invited but has not been approved yet; null once approved. Use ?status=pending on GET /trainees to list only these.

data.activeCoachDetails.pendingCoachDatestring<date-time> | null

When the trainee entered the pending state. Use it to measure how long approval has been waiting.

data.createdAtstring<date-time>

Error responses

  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 429 Too Many Requests
  • 500 Internal Server Error

These statuses share the same response body.

Example body (application/json)
{
  "error": {
    "code": "<string>",
    "message": "<string>",
    "fix": "<string>",
    "details": {},
    "retryAfterMs": 123
  }
}
Error fields (6)
Error fields
NameTypeDescription
errorobject
error.codestring
error.messagestring
error.fixstring | null
error.detailsobject | null
error.retryAfterMsnumber | null

This page is also available as Markdown. Browse it in the interactive explorer or download the OpenAPI spec.