Fitness Workout Plans
Function-calling namespace: fitnessWorkoutPlans
- Base URL:
https://api.aivida.in - Engine endpoint:
POST /api - Auth: Stack token middleware enabled in
optionalmode. - Send token in header:
x-stack-access-token: <access_token>(orAuthorization: Bearer <access_token>). - In
optionalmode: no token is allowed; invalid token is rejected with401.
cancel
Source: backend/endpoints/fitness-workout-plans/cancel
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
assignmentId | string | Yes | - |
reason | string | No | - |
actorStackUserId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "fitnessWorkoutPlans",
"apiName": "cancel",
"data": {
"organizationId": "org_123",
"assignmentId": "assignment_123"
}
}'Example Response
{ "status": "ok", "data": {} }createDateRangePlan
Source: backend/endpoints/fitness-workout-plans/create-date-range-plan
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
memberId | string | Yes | - |
title | string | Yes | - |
description | string | No | - |
startDate | string | Yes | format: YYYY-MM-DD |
endDate | string | Yes | format: YYYY-MM-DD |
workoutDays | array<object> | Yes | min: 1; dive |
actorStackUserId | string | No | - |
workoutDays Shape
Each item in workoutDays creates exactly one daily task in fitness_workout_tasks for that date.
| Field | Type | Required |
|---|---|---|
date | string (YYYY-MM-DD) | Yes |
dayLabel | string | No |
exercises | []WorkoutExerciseInput | Yes |
WorkoutExerciseInput
| Field | Type | Required |
|---|---|---|
exerciseId | string | Yes |
targetSets | int | No |
targetReps | int | No |
targetDurationSec | int (>=1) | Yes |
plannedRestSec | int | No |
sortOrder | int | No |
Validation Rules
startDate,endDate, and eachworkoutDays[].datemust be inYYYY-MM-DDformat.startDatecannot be afterendDate.- Each
workoutDays[].datemust be withinstartDate..endDate. - Duplicate
workoutDays[].datevalues are rejected. - Each day must include at least one exercise.
exerciseIdmust exist in the exercises table.
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "fitnessWorkoutPlans",
"apiName": "createDateRangePlan",
"data": {
"organizationId": "org_123",
"memberId": "member_123",
"title": "Week 1 Foundation Plan",
"description": "Starter block for lower body + push work",
"startDate": "2026-03-10",
"endDate": "2026-03-12",
"workoutDays": [
{
"date": "2026-03-10",
"dayLabel": "Day 1",
"exercises": [
{
"exerciseId": "ex_squats",
"targetSets": 4,
"targetReps": 10,
"targetDurationSec": 45,
"plannedRestSec": 20,
"sortOrder": 1
},
{
"exerciseId": "ex_wall_pushups",
"targetSets": 3,
"targetReps": 12,
"targetDurationSec": 40,
"plannedRestSec": 30,
"sortOrder": 2
}
]
},
{
"date": "2026-03-12",
"dayLabel": "Day 2",
"exercises": [
{
"exerciseId": "ex_backward_lunge",
"targetSets": 3,
"targetReps": 12,
"targetDurationSec": 50,
"plannedRestSec": 25,
"sortOrder": 1
}
]
}
]
}
}'Example Response
{ "status": "ok", "data": {} }getById
Source: backend/endpoints/fitness-workout-plans/get-by-id
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
assignmentId | string | Yes | - |
actorStackUserId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "fitnessWorkoutPlans",
"apiName": "getById",
"data": {
"organizationId": "org_123",
"assignmentId": "assignment_123"
}
}'Example Response
{ "status": "ok", "data": {} }listByOrganization
Source: backend/endpoints/fitness-workout-plans/list-by-organization
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
memberId | string | No | - |
status | string | No | - |
fromDate | string | No | format: YYYY-MM-DD |
toDate | string | No | format: YYYY-MM-DD |
page | integer | No | - |
pageSize | integer | No | - |
actorStackUserId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "fitnessWorkoutPlans",
"apiName": "listByOrganization",
"data": {
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }updateDateRangePlan
Source: backend/endpoints/fitness-workout-plans/update-date-range-plan
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
assignmentId | string | Yes | - |
title | string | No | nullable |
description | string | No | nullable |
endDate | string | No | format: YYYY-MM-DD; nullable |
workoutDays | array<object> | No | min: 1; dive; nullable |
actorStackUserId | string | No | - |
When workoutDays is provided in update:
- the same shape/validation rules as
createDateRangePlanare applied. - days included in payload are created/updated by
date. - days not included are not auto-created.
- non-
pendingexisting task days cannot be replaced.
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "fitnessWorkoutPlans",
"apiName": "updateDateRangePlan",
"data": {
"organizationId": "org_123",
"assignmentId": "assignment_123",
"endDate": "2026-03-15",
"workoutDays": [
{
"date": "2026-03-13",
"dayLabel": "Day 3",
"exercises": [
{
"exerciseId": "ex_jumping_jacks",
"targetSets": 3,
"targetReps": 20,
"targetDurationSec": 60,
"plannedRestSec": 20,
"sortOrder": 1
}
]
}
]
}
}'Example Response
{ "status": "ok", "data": {} }