> ## Documentation Index
> Fetch the complete documentation index at: https://developer.eka.care/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Schedule

> ### Overview
Edits a schedule's name, settings (`config`), archive state, time windows and who can book on it, in one call. A schedule from another business returns `401`. An unknown `scheduleId` returns `404`.

- Archiving deletes the schedule's time windows, blocks and `bookable_by` groups, the same as Delete Schedule. Unarchiving does not bring them back.
- Archiving can't be mixed with time-window or `bookable_by` changes in the same call (`409`). Editing an archived schedule returns `409`.
- `booking_id` is the id of one saved time-window row, not an appointment. The same `booking_id` can't be in both `timebounds` and `deleteTimebounds` (`400`).



## OpenAPI

````yaml patch /schedule/{scheduleId}
openapi: 3.0.0
info:
  title: Ekacare API & Webhook Documentation
  contact: {}
  version: '1.0'
servers:
  - description: Production
    url: https://api.eka.care
  - description: Stage/Sandbox
    url: https://api.dev.eka.care
security: []
paths:
  /schedule/{scheduleId}:
    patch:
      tags:
        - Appointment API
      summary: Update Schedule
      description: >-
        ### Overview

        Edits a schedule's name, settings (`config`), archive state, time
        windows and who can book on it, in one call. A schedule from another
        business returns `401`. An unknown `scheduleId` returns `404`.


        - Archiving deletes the schedule's time windows, blocks and
        `bookable_by` groups, the same as Delete Schedule. Unarchiving does not
        bring them back.

        - Archiving can't be mixed with time-window or `bookable_by` changes in
        the same call (`409`). Editing an archived schedule returns `409`.

        - `booking_id` is the id of one saved time-window row, not an
        appointment. The same `booking_id` can't be in both `timebounds` and
        `deleteTimebounds` (`400`).
      operationId: UpdateSchedule
      parameters:
        - name: auth
          in: header
          description: ''
          required: true
          style: simple
          schema:
            type: string
            example: auth
        - name: scheduleId
          in: path
          description: Id of the schedule to update.
          required: true
          style: simple
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: At least one field must be provided.
              properties:
                name:
                  type: string
                  description: New schedule name. If provided, must be non-empty.
                archive:
                  type: boolean
                  description: >-
                    Archive or unarchive. Archiving deletes the time windows,
                    blocks and `bookable_by` groups. Can't be mixed with
                    `timebounds`, `deleteTimebounds` or `bookable_by`.
                entity_id:
                  type: string
                  description: >-
                    Doctor id (clinic id for a clinic schedule). Needed with
                    `bookable_by`.
                location_id:
                  type: string
                  description: Clinic id. Needed with `bookable_by`.
                config:
                  type: object
                  properties:
                    overbooking_limit:
                      type: integer
                      minimum: 1
                      description: >-
                        Most appointments one slot can take. `1` = no
                        overbooking.
                    block_over_existing_bookings:
                      type: boolean
                      description: >-
                        Saved with the schedule. Not used when slots are made
                        yet.
                    schedule_slot_config_enabled:
                      type: boolean
                      description: '`true` = duration schedule, `false` = service schedule.'
                    slot_durations:
                      type: array
                      items:
                        type: integer
                        minimum: 1
                        maximum: 1440
                      maxItems: 10
                timebounds:
                  type: object
                  description: >-
                    Time windows to add or change. Same shape as on Create
                    Schedule. A `daily`, `repeat-weekly`, `repeat-daily` or
                    `block` entry with a `booking_id` changes that saved row
                    instead of adding a new one.
                  properties:
                    weekly:
                      type: object
                      description: >-
                        Map keyed by weekday, `0`(Sunday)–`6`(Saturday). Always
                        replaces the day's bounds outright (no `booking_id` —
                        weekly is a single doc per schedule).
                      additionalProperties:
                        type: object
                        properties:
                          is_enabled:
                            type: boolean
                          bounds:
                            type: array
                            items:
                              type: object
                              properties:
                                s:
                                  type: integer
                                e:
                                  type: integer
                                conf_ids:
                                  type: array
                                  items:
                                    type: string
                    daily:
                      type: object
                      description: >-
                        Keyed by ISO date. Include `booking_id` to update an
                        existing row for that date instead of creating a new
                        one.
                      additionalProperties:
                        type: object
                        properties:
                          booking_id:
                            type: string
                          is_enabled:
                            type: boolean
                          bounds:
                            type: array
                            items:
                              type: object
                              properties:
                                s:
                                  type: integer
                                e:
                                  type: integer
                                conf_ids:
                                  type: array
                                  items:
                                    type: string
                    repeat-weekly:
                      type: array
                      items:
                        type: object
                        properties:
                          booking_id:
                            type: string
                          repeat_every:
                            type: integer
                          anchor_date:
                            type: string
                          start_date:
                            type: string
                          end_date:
                            type: string
                          phases:
                            type: array
                            items:
                              type: object
                    repeat-daily:
                      type: array
                      items:
                        type: object
                        properties:
                          booking_id:
                            type: string
                          phase_index:
                            type: integer
                          repeat_every:
                            type: integer
                          anchor_date:
                            type: string
                          start_date:
                            type: string
                          end_date:
                            type: string
                          is_enabled:
                            type: boolean
                          bounds:
                            type: array
                            items:
                              type: object
                              properties:
                                s:
                                  type: integer
                                e:
                                  type: integer
                                conf_ids:
                                  type: array
                                  items:
                                    type: string
                    block:
                      type: array
                      items:
                        type: object
                        properties:
                          booking_id:
                            type: string
                          start_date:
                            type: string
                          end_date:
                            type: string
                          start_time:
                            type: string
                          end_time:
                            type: string
                deleteTimebounds:
                  type: object
                  description: >-
                    Saved rows to delete, as `booking_id`s per rule type. A
                    `booking_id` here can't also be in `timebounds` in the same
                    call.
                  properties:
                    daily:
                      type: array
                      items:
                        type: string
                    repeat-weekly:
                      type: array
                      items:
                        type: string
                    repeat-daily:
                      type: array
                      items:
                        type: string
                    block:
                      type: array
                      items:
                        type: string
                bookable_by:
                  type: object
                  description: >-
                    Who can book on this schedule. `true` adds the group,
                    `false` removes it. Needs `entity_id` and `location_id` in
                    the same call.
                  properties:
                    patient:
                      type: boolean
                      description: >-
                        Patients book by themselves: website, booking page, app.
                        Only one schedule per doctor and clinic.
                    front_desk:
                      type: boolean
                      description: >-
                        Anyone booking from the clinic side: your reception,
                        front desk, doctor, clinic staff, or your own EMR.
                    ipd:
                      type: boolean
                      description: Bookings for admitted (in-patient) patients.
                productMap:
                  type: object
                  deprecated: true
                  description: >-
                    Deprecated, will be removed soon. Use `bookable_by`. Same
                    thing with internal keys: `product-widget` = `patient`,
                    `product-emr` = `front_desk`, `product-ipd` = `ipd`. Sending
                    it with `bookable_by` returns `400`.
                  additionalProperties:
                    type: boolean
              example:
                config:
                  overbooking_limit: 3
                timebounds:
                  daily:
                    '2026-10-16':
                      booking_id: bk_9f31c2
                      is_enabled: true
                      bounds:
                        - s: 1000
                          e: 1300
                          conf_ids:
                            - conf_abc123
                deleteTimebounds:
                  block:
                    - bk_5a01e7
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      schedule_id:
                        type: string
                      business_id:
                        type: string
                      name:
                        type: string
                      archive:
                        type: boolean
                      config:
                        type: object
                        properties:
                          overbooking_limit:
                            type: integer
                          block_over_existing_bookings:
                            type: boolean
                          schedule_slot_config_enabled:
                            type: boolean
                          slot_durations:
                            type: array
                            items:
                              type: integer
                      timebounds:
                        type: object
                        description: Time windows added or changed, per rule type.
                      deleted:
                        type: object
                        description: Time windows deleted, per rule type.
                      assignment:
                        type: object
                        properties:
                          bookable_by:
                            type: array
                            items:
                              type: string
                              enum:
                                - patient
                                - front_desk
                                - ipd
                            description: >-
                              Groups that can book on this schedule after this
                              call.
                          products:
                            type: array
                            deprecated: true
                            items:
                              type: string
                            description: >-
                              Deprecated, will be removed soon. Read
                              `bookable_by`. Same groups as internal ids
                              (`product-widget`, `product-emr`, `product-ipd`).
                          error:
                            type: string
                      confs_created:
                        type: array
                        items:
                          type: string
                        description: >-
                          Services (`conf_id`) copied to this doctor so the
                          schedule can use them.
                      failed_tasks:
                        type: array
                        items:
                          type: string
                        description: >-
                          Present only if a sub-task (e.g. one timebound write)
                          failed. The overall request still returns 200 — this
                          reports partial failure.
        '400':
          description: >-
            Bad Request — nothing to update, invalid/conflicting fields, invalid
            `bookable_by`, `bookable_by` without `entity_id` and `location_id`,
            or `bookable_by` sent with `productMap`
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
        '401':
          description: Unauthorised — schedule does not belong to the caller's business
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Unauthorised
        '404':
          description: Not Found — unknown scheduleId
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: schedule not found
        '409':
          description: >-
            Conflict — archiving mixed with other changes, editing an archived
            schedule, making a duration schedule bookable by patients, or
            another schedule is already bookable by patients for this doctor and
            clinic
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
      deprecated: false

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.