EndpointsDoctor Weekly Schedule

Doctor Weekly Schedule

Function-calling namespace: doctorWeeklySchedule

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

create

Source: backend/endpoints/doctor-weekly-schedule/create

Input Fields

FieldTypeRequiredConstraints
doctorProfileIdstringYes-
doctorIdstringYes-
organizationIdstringYes-
organizationBranchIdstringNooptional for single schedule; omit when using branchSchedules[]
dayOfWeekintegerYesmin: 0; max: 6
sessionsarray<object>Nosingle-schedule sessions; required when isActive is true and branchSchedules[] is omitted
branchSchedulesarray<object>Nooptional; use this to create separate schedules for multiple branches in one request
startTimestringNoformat: HH:mm; legacy single-session input; prefer sessions[]
endTimestringNoformat: HH:mm; legacy single-session input; prefer sessions[]
slotDurationMinutesintegerYes5-120
isActivebooleanNonullable; default: false when omitted
breakEnabledbooleanNonullable
breakFrequencyMinutesintegerNorequired when breakEnabled is true; nullable
breakDurationMinutesintegerNorequired when breakEnabled is true; must be less than breakFrequencyMinutes; nullable

Nested Field Structures

sessions item

FieldTypeRequiredConstraints
startTimestringYesformat: HH:mm
endTimestringYesformat: HH:mm

branchSchedules item

FieldTypeRequiredConstraints
organizationBranchIdstringYes-
sessionsarray<object>Yes-
startTimestringNoformat: HH:mm
endTimestringNoformat: 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

FieldTypeRequiredConstraints
doctorIdstringYes-
organizationIdstringYes-
organizationBranchIdstringNooptional; include it to fetch a branch-specific schedule
dayOfWeekintegerYesmin: 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

FieldTypeRequiredConstraints
doctorProfileIdstringNorequired_without: UserID
userIdstringNorequired_without: DoctorProfileID
organizationIdstringYes-

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

FieldTypeRequiredConstraints
doctorProfileIdstringNorequired_without: UserID
userIdstringNorequired_without: DoctorProfileID
organizationIdstringYes-
organizationBranchIdstringNooptional for single schedule; omit when using branchSchedules[]
dayOfWeekintegerYesmin: 0; max: 6; nullable
sessionsarray<object>Nosingle-schedule sessions; required when isActive is true and branchSchedules[] is omitted
branchSchedulesarray<object>Nooptional; use this to replace separate sessions for multiple branches in one request
startTimestringNoformat: HH:mm; legacy single-session input; prefer sessions[]
endTimestringNoformat: HH:mm; legacy single-session input; prefer sessions[]
slotDurationMinutesintegerNo5-120; nullable
isActivebooleanNonullable
breakEnabledbooleanNonullable
breakFrequencyMinutesintegerNorequired when breakEnabled is true; nullable
breakDurationMinutesintegerNorequired when breakEnabled is true; must be less than breakFrequencyMinutes; nullable

Nested Field Structures

sessions item

FieldTypeRequiredConstraints
startTimestringYesformat: HH:mm
endTimestringYesformat: HH:mm

branchSchedules item

FieldTypeRequiredConstraints
organizationBranchIdstringYes-
sessionsarray<object>Yes-
startTimestringNoformat: HH:mm
endTimestringNoformat: 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
      }
    ]
  }
}