Doctor Weekly Schedule
Function-calling namespace: doctorWeeklySchedule
- 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.
create
Source: backend/endpoints/doctor-weekly-schedule/create
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
doctorProfileId | string | Yes | - |
doctorId | string | Yes | - |
organizationId | string | Yes | - |
organizationBranchId | string | No | optional for single schedule; omit when using branchSchedules[] |
dayOfWeek | integer | Yes | min: 0; max: 6 |
sessions | array<object> | No | single-schedule sessions; required when isActive is true and branchSchedules[] is omitted |
branchSchedules | array<object> | No | optional; use this to create separate schedules for multiple branches in one request |
startTime | string | No | format: HH:mm; legacy single-session input; prefer sessions[] |
endTime | string | No | format: HH:mm; legacy single-session input; prefer sessions[] |
slotDurationMinutes | integer | Yes | 5-120 |
isActive | boolean | No | nullable; default: false when omitted |
breakEnabled | boolean | No | nullable |
breakFrequencyMinutes | integer | No | required when breakEnabled is true; nullable |
breakDurationMinutes | integer | No | required when breakEnabled is true; must be less than breakFrequencyMinutes; nullable |
Nested Field Structures
sessions item
| Field | Type | Required | Constraints |
|---|---|---|---|
startTime | string | Yes | format: HH:mm |
endTime | string | Yes | format: HH:mm |
branchSchedules item
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationBranchId | string | Yes | - |
sessions | array<object> | Yes | - |
startTime | string | No | format: HH:mm |
endTime | string | No | format: HH:mm |
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": "doctorWeeklySchedule",
"apiName": "create",
"data": {
"doctorProfileId": "doctor_profile_123",
"doctorId": "doctor_123",
"organizationId": "org_123",
"dayOfWeek": 1,
"branchSchedules": [
{
"organizationBranchId": "branch_1",
"sessions": [
{
"startTime": "09:00",
"endTime": "12:00"
},
{
"startTime": "14:00",
"endTime": "17:00"
}
]
},
{
"organizationBranchId": "branch_2",
"sessions": [
{
"startTime": "10:00",
"endTime": "13:00"
},
{
"startTime": "15:00",
"endTime": "18:00"
}
]
}
],
"slotDurationMinutes": 30,
"isActive": true,
"breakEnabled": true,
"breakFrequencyMinutes": 120,
"breakDurationMinutes": 15
}
}'Example Response
{
"status": "ok",
"data": {
"ids": [
"doctor_weekly_schedule_branch_1",
"doctor_weekly_schedule_branch_2"
]
}
}getByDoctorAndDay
Source: backend/endpoints/doctor-weekly-schedule/get-by-doctor-and-day
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
doctorId | string | Yes | - |
organizationId | string | Yes | - |
organizationBranchId | string | No | optional; include it to fetch a branch-specific schedule |
dayOfWeek | integer | Yes | min: 0; max: 6; nullable |
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": "doctorWeeklySchedule",
"apiName": "getByDoctorAndDay",
"data": {
"doctorId": "doctor_123",
"organizationId": "org_123",
"organizationBranchId": "branch_123",
"dayOfWeek": 1
}
}'Example Response
{
"status": "ok",
"data": {
"item": {
"id": "doctor_weekly_schedule_123",
"doctorProfileId": "doctor_profile_123",
"doctorId": "doctor_123",
"organizationId": "org_123",
"organizationBranchId": "branch_123",
"dayOfWeek": 1,
"sessions": [
{
"id": "doctor_weekly_schedule_session_123",
"weeklyScheduleId": "doctor_weekly_schedule_123",
"startTime": "09:00",
"endTime": "12:00",
"displayOrder": 1,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
},
{
"id": "doctor_weekly_schedule_session_124",
"weeklyScheduleId": "doctor_weekly_schedule_123",
"startTime": "14:00",
"endTime": "17:00",
"displayOrder": 2,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
}
],
"slotDurationMinutes": 30,
"isActive": true,
"breakEnabled": true,
"breakFrequencyMinutes": 120,
"breakDurationMinutes": 15,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
}
}
}listByDoctor
Source: backend/endpoints/doctor-weekly-schedule/list-by-doctor
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
doctorProfileId | string | No | required_without: UserID |
userId | string | No | required_without: DoctorProfileID |
organizationId | string | Yes | - |
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": "doctorWeeklySchedule",
"apiName": "listByDoctor",
"data": {
"doctorProfileId": "doctor_profile_123",
"organizationId": "org_123"
}
}'Example Response
{
"status": "ok",
"data": {
"items": [
{
"id": "doctor_weekly_schedule_123",
"doctorProfileId": "doctor_profile_123",
"doctorId": "doctor_123",
"organizationId": "org_123",
"organizationBranchId": "branch_123",
"dayOfWeek": 1,
"sessions": [
{
"id": "doctor_weekly_schedule_session_123",
"weeklyScheduleId": "doctor_weekly_schedule_123",
"startTime": "09:00",
"endTime": "12:00",
"displayOrder": 1,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
},
{
"id": "doctor_weekly_schedule_session_124",
"weeklyScheduleId": "doctor_weekly_schedule_123",
"startTime": "14:00",
"endTime": "17:00",
"displayOrder": 2,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
}
],
"slotDurationMinutes": 30,
"isActive": true,
"breakEnabled": true,
"breakFrequencyMinutes": 120,
"breakDurationMinutes": 15,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
}
]
}
}updateByDoctorAndDay
Source: backend/endpoints/doctor-weekly-schedule/update-by-doctor-and-day
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
doctorProfileId | string | No | required_without: UserID |
userId | string | No | required_without: DoctorProfileID |
organizationId | string | Yes | - |
organizationBranchId | string | No | optional for single schedule; omit when using branchSchedules[] |
dayOfWeek | integer | Yes | min: 0; max: 6; nullable |
sessions | array<object> | No | single-schedule sessions; required when isActive is true and branchSchedules[] is omitted |
branchSchedules | array<object> | No | optional; use this to replace separate sessions for multiple branches in one request |
startTime | string | No | format: HH:mm; legacy single-session input; prefer sessions[] |
endTime | string | No | format: HH:mm; legacy single-session input; prefer sessions[] |
slotDurationMinutes | integer | No | 5-120; nullable |
isActive | boolean | No | nullable |
breakEnabled | boolean | No | nullable |
breakFrequencyMinutes | integer | No | required when breakEnabled is true; nullable |
breakDurationMinutes | integer | No | required when breakEnabled is true; must be less than breakFrequencyMinutes; nullable |
Nested Field Structures
sessions item
| Field | Type | Required | Constraints |
|---|---|---|---|
startTime | string | Yes | format: HH:mm |
endTime | string | Yes | format: HH:mm |
branchSchedules item
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationBranchId | string | Yes | - |
sessions | array<object> | Yes | - |
startTime | string | No | format: HH:mm |
endTime | string | No | format: HH:mm |
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": "doctorWeeklySchedule",
"apiName": "updateByDoctorAndDay",
"data": {
"doctorProfileId": "doctor_profile_123",
"organizationId": "org_123",
"dayOfWeek": 1,
"branchSchedules": [
{
"organizationBranchId": "branch_1",
"sessions": [
{
"startTime": "10:00",
"endTime": "13:00"
},
{
"startTime": "15:00",
"endTime": "18:00"
}
]
},
{
"organizationBranchId": "branch_2",
"sessions": [
{
"startTime": "09:30",
"endTime": "12:30"
},
{
"startTime": "14:30",
"endTime": "17:30"
}
]
}
],
"slotDurationMinutes": 30,
"isActive": true,
"breakEnabled": false
}
}'Example Response
{
"status": "ok",
"data": {
"found": true,
"items": [
{
"id": "doctor_weekly_schedule_branch_1",
"doctorProfileId": "doctor_profile_123",
"doctorId": "doctor_123",
"organizationId": "org_123",
"organizationBranchId": "branch_1",
"dayOfWeek": 1,
"sessions": [
{
"id": "doctor_weekly_schedule_session_123",
"weeklyScheduleId": "doctor_weekly_schedule_branch_1",
"startTime": "10:00",
"endTime": "13:00",
"displayOrder": 1,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
},
{
"id": "doctor_weekly_schedule_session_124",
"weeklyScheduleId": "doctor_weekly_schedule_branch_1",
"startTime": "15:00",
"endTime": "18:00",
"displayOrder": 2,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
}
],
"slotDurationMinutes": 30,
"isActive": true,
"breakEnabled": false,
"createdAt": 1779971037247,
"updatedAt": 1779972037247
},
{
"id": "doctor_weekly_schedule_branch_2",
"doctorProfileId": "doctor_profile_123",
"doctorId": "doctor_123",
"organizationId": "org_123",
"organizationBranchId": "branch_2",
"dayOfWeek": 1,
"sessions": [
{
"id": "doctor_weekly_schedule_session_125",
"weeklyScheduleId": "doctor_weekly_schedule_branch_2",
"startTime": "09:30",
"endTime": "12:30",
"displayOrder": 1,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
},
{
"id": "doctor_weekly_schedule_session_126",
"weeklyScheduleId": "doctor_weekly_schedule_branch_2",
"startTime": "14:30",
"endTime": "17:30",
"displayOrder": 2,
"createdAt": 1779971037247,
"updatedAt": 1779971037247
}
],
"slotDurationMinutes": 30,
"isActive": true,
"breakEnabled": false,
"createdAt": 1779971037247,
"updatedAt": 1779972037247
}
]
}
}