curl -X PATCH "https://api.fitsociety.io/public/v1/workout/clients/{clientId}/plans/template/{templateId}/weeks/reorder" \
-H "Authorization: Bearer <access_token>" \
-H "Idempotency-Key: <stable_request_key>" \
-H "Content-Type: application/json" \
-d '{}'const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({weeks: [4, 2, 3, 1]})
};
fetch('https://api.fitsociety.io/public/v1/workout/clients/{clientId}/plans/template/{templateId}/weeks/reorder', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.fitsociety.io/public/v1/workout/clients/{clientId}/plans/template/{templateId}/weeks/reorder"
payload = { "weeks": [4, 2, 3, 1] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"data": {
"planId": "67f1234567890abcdef1234",
"weeks": [
4,
2,
3,
1
],
"totalWeeks": 4,
"weekOrder": [
{
"weekNumber": 1,
"dayCount": 7
}
]
},
"meta": {
"requestId": "4f849d7d-f4f1-45cc-b4b7-3984a3d17f83",
"rateLimit": {
"limit": 10,
"remaining": 9,
"resetSeconds": 1
},
"idempotency": {
"replayed": false
}
}
}Reorder the weeks of the client's own multi-week programme
Reorder the WEEKS of the client’s own multi-week programme. A week’s whole CONTENT travels with it — all seven of its days, their isRestDay flags and every entry in items[] (workouts and activities) — so the weeks are rearranged, never rewritten. Swapping week 1 with week 4 moves week 1’s seven days into slot 4 and week 4’s seven days into slot 1.
weeks[i] is the week whose content moves to week number i + 1. So a plan with weeks 1..4 and body [4, 2, 3, 1] swaps weeks 1 and 4 (weeks 2 and 3 stay). Every existing week number must be listed exactly once, which keeps the request idempotent and lets one call express any rearrangement.
Both week-number stores are remapped together: the calendar definition (schedule.weeks[].weekNumber, whose days and items ride along because they are nested inside the week) and each plan moment’s own weekNumber (a workout item points at a plan moment, which records the week it belongs to).
Multi-week only: a recurring plan is a single repeating week with nothing to reorder. The plan is pinned to the caller’s own ASSIGNED multi-week calendar programme, so a client can never reorder a library template or another client’s plan.
Requires the workout_client_plans:write scope and the corresponding Workout features and permissions.
The clientId path parameter identifies a client in the company bound to the Public API token.
curl -X PATCH "https://api.fitsociety.io/public/v1/workout/clients/{clientId}/plans/template/{templateId}/weeks/reorder" \
-H "Authorization: Bearer <access_token>" \
-H "Idempotency-Key: <stable_request_key>" \
-H "Content-Type: application/json" \
-d '{}'const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({weeks: [4, 2, 3, 1]})
};
fetch('https://api.fitsociety.io/public/v1/workout/clients/{clientId}/plans/template/{templateId}/weeks/reorder', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.fitsociety.io/public/v1/workout/clients/{clientId}/plans/template/{templateId}/weeks/reorder"
payload = { "weeks": [4, 2, 3, 1] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"data": {
"planId": "67f1234567890abcdef1234",
"weeks": [
4,
2,
3,
1
],
"totalWeeks": 4,
"weekOrder": [
{
"weekNumber": 1,
"dayCount": 7
}
]
},
"meta": {
"requestId": "4f849d7d-f4f1-45cc-b4b7-3984a3d17f83",
"rateLimit": {
"limit": 10,
"remaining": 9,
"resetSeconds": 1
},
"idempotency": {
"replayed": false
}
}
}Authorizations
Headers
Required for Public API write requests. Reusing the same key with the same method, path, and body replays the stored successful response; reusing it with a different request returns 409 idempotency.conflict.
1 - 200"booking-create-20260714-001"