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
| Name | Type | Description |
|---|---|---|
traineeIdrequired | string |
Header parameters
| Name | Type | Description |
|---|---|---|
Idempotency-Key | string | 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
| Name | Type | Description |
|---|---|---|
name | string | |
phoneNumber | string | |
goal | string | |
height | number | Height in cm. Must not be negative. |
dateOfBirth | string | Date of birth as an ISO date, for example 1990-04-23. |
gender | string | One of: Male, Female, Other. Matching is case-insensitive, so "male" is accepted and stored as "Male". |
activityLevel | string | 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 |
injuries | string | |
healthConditions | string | |
allergies | string | |
foodPreferences | string | |
foodDislikes | string |
Request examples
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>"
}'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
{
"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)
| Name | Type | Description |
|---|---|---|
data | object | |
data.id | string | |
data.name | string | |
data.email | string | |
data.phoneNumber | string | |
data.goal | string | |
data.profileImageUrl | string | |
data.personalDetails | object | |
data.labels | object[] | |
data.labels[].id | string | |
data.labels[].text | string | |
data.labels[].color | string | |
data.labels[].coachId | string | |
data.assignedEmployees | object[] | |
data.assignedEmployees[].id | string | |
data.assignedEmployees[].name | string | |
data.activeCoachDetails | object | |
data.activeCoachDetails.activeEscort | string | null | Id of the escort currently in use for this trainee. Fetch the full escort with |
data.activeCoachDetails.pendingCoach | string | 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 |
data.activeCoachDetails.pendingCoachDate | string<date-time> | null | When the trainee entered the pending state. Use it to measure how long approval has been waiting. |
data.createdAt | string<date-time> |
Error responses
400Bad Request401Unauthorized403Forbidden404Not Found409Conflict429Too Many Requests500Internal Server Error
These statuses share the same response body.
{
"error": {
"code": "<string>",
"message": "<string>",
"fix": "<string>",
"details": {},
"retryAfterMs": 123
}
}Error fields (6)
| Name | Type | Description |
|---|---|---|
error | object | |
error.code | string | |
error.message | string | |
error.fix | string | null | |
error.details | object | null | |
error.retryAfterMs | number | null |
More Trainees endpoints
This page is also available as Markdown. Browse it in the interactive explorer or download the OpenAPI spec.