> ## 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 an existing schedule's config, name, archive state, and/or its timebounds, in one call. Ownership is checked against the caller's business — a schedule belonging to another business returns `401`, and an unknown `scheduleId` returns `404`.

Archiving a schedule cannot be combined with timebound additions/deletions or a product assignment in the same request (`409`). Mutating an already-archived schedule also returns `409`. The same `booking_id` cannot appear 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 an existing schedule's config, name, archive state, and/or its
        timebounds, in one call. Ownership is checked against the caller's
        business — a schedule belonging to another business returns `401`, and
        an unknown `scheduleId` returns `404`.


        Archiving a schedule cannot be combined with timebound
        additions/deletions or a product assignment in the same request (`409`).
        Mutating an already-archived schedule also returns `409`. The same
        `booking_id` cannot appear 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/unarchive the schedule. Cannot be combined with
                    `timebounds`, `deleteTimebounds`, or a `productMap`
                    assignment.
                entity_id:
                  type: string
                location_id:
                  type: string
                config:
                  type: object
                  properties:
                    overbooking_limit:
                      type: integer
                      minimum: 1
                    block_over_existing_bookings:
                      type: boolean
                    schedule_slot_config_enabled:
                      type: boolean
                    slot_durations:
                      type: array
                      items:
                        type: integer
                        minimum: 1
                        maximum: 1440
                      maxItems: 10
                timebounds:
                  type: object
                  description: >-
                    Rows to create or update. Same shape as on `POST /schedule`,
                    except `daily`/`repeat-weekly`/`repeat-daily`/`block`
                    entries may include a `booking_id` to update that existing
                    row in place instead of creating 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: >-
                    booking_ids to delete, keyed by rule type. A booking_id used
                    here cannot also appear in `timebounds` in the same request.
                  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
                productMap:
                  type: object
                  description: >-
                    Assigns/unassigns this schedule to products. Keys are
                    `product-emr` or `product-widget`, values are
                    `true`/`false`. Requires `entity_id` and `location_id` to
                    also be present in the request.
                  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: >-
                          Report of timebound rows created/updated, keyed by
                          rule type.
                      deleted:
                        type: object
                        description: Report of timebound rows deleted, keyed by rule type.
                      assignment:
                        type: object
                        properties:
                          products:
                            type: array
                            items:
                              type: string
                          error:
                            type: string
                      confs_created:
                        type: array
                        items:
                          type: string
                      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, or invalid/conflicting fields
          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 combined with other mutations, mutating an
            archived schedule, duration-mode vs product-widget conflict, or
            widget already assigned elsewhere
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
      deprecated: false

````