> ## 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.

# Create Schedule

> ### Overview
Creates a schedule for a doctor at a clinic: `entity_id` is the doctor id, `location_id` is the clinic id. For a clinic schedule (no doctor), put the clinic id in both.

The same call can add the schedule's time windows (`timebounds`: weekly, daily, repeat-weekly, repeat-daily, block) and set who can book on it (`bookable_by`).

### Service schedules vs duration schedules
`config.schedule_slot_config_enabled` decides how slots are cut.

- **Service schedule** (`false` or left out): each window lists the services bookable in it (`conf_ids`). A slot is as long as its service's `duration`, so two services in one window can give different slot lengths. Get the ids from [List Services](/api-sdk/emr/appointment-api/get-service-conf-list).
- **Duration schedule** (`true`): needs at least one length in `config.slot_durations`. Slots are cut at the length the caller asks for; a length not in `slot_durations` gets the shortest one. `conf_ids` in its windows are ignored.

`conf_ids` are not checked when you save. An id that belongs to another doctor or clinic in your business is copied to this doctor (`confs_created`). A window with no valid `conf_ids` gives no slots.

### Who can book
`bookable_by` takes `patient` (patients book by themselves: website, booking page, app), `front_desk` (anyone booking from the clinic side: your reception, front desk, doctor, clinic staff, or your own EMR) and `ipd` (bookings for admitted patients).

`productMap` is deprecated and will be removed soon; it still works. Send `bookable_by` instead, never both in one call (`400`).

- Only one schedule per doctor and clinic can be bookable by patients. A second one returns `409`.
- A duration schedule can't be bookable by patients (`409`).

Get slots for any schedule with [Get Slots](/api-sdk/emr/appointment-api/get-slots).



## OpenAPI

````yaml post /schedule
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:
    post:
      tags:
        - Appointment API
      summary: Create Schedule
      description: >-
        ### Overview

        Creates a schedule for a doctor at a clinic: `entity_id` is the doctor
        id, `location_id` is the clinic id. For a clinic schedule (no doctor),
        put the clinic id in both.


        The same call can add the schedule's time windows (`timebounds`: weekly,
        daily, repeat-weekly, repeat-daily, block) and set who can book on it
        (`bookable_by`).


        ### Service schedules vs duration schedules

        `config.schedule_slot_config_enabled` decides how slots are cut.


        - **Service schedule** (`false` or left out): each window lists the
        services bookable in it (`conf_ids`). A slot is as long as its service's
        `duration`, so two services in one window can give different slot
        lengths. Get the ids from [List
        Services](/api-sdk/emr/appointment-api/get-service-conf-list).

        - **Duration schedule** (`true`): needs at least one length in
        `config.slot_durations`. Slots are cut at the length the caller asks
        for; a length not in `slot_durations` gets the shortest one. `conf_ids`
        in its windows are ignored.


        `conf_ids` are not checked when you save. An id that belongs to another
        doctor or clinic in your business is copied to this doctor
        (`confs_created`). A window with no valid `conf_ids` gives no slots.


        ### Who can book

        `bookable_by` takes `patient` (patients book by themselves: website,
        booking page, app), `front_desk` (anyone booking from the clinic side:
        your reception, front desk, doctor, clinic staff, or your own EMR) and
        `ipd` (bookings for admitted patients).


        `productMap` is deprecated and will be removed soon; it still works.
        Send `bookable_by` instead, never both in one call (`400`).


        - Only one schedule per doctor and clinic can be bookable by patients. A
        second one returns `409`.

        - A duration schedule can't be bookable by patients (`409`).


        Get slots for any schedule with [Get
        Slots](/api-sdk/emr/appointment-api/get-slots).
      operationId: CreateSchedule
      parameters:
        - name: auth
          in: header
          description: ''
          required: true
          style: simple
          schema:
            type: string
            example: auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: Schedule name. Required, non-empty.
                entity_id:
                  type: string
                  description: Doctor id. For a clinic schedule, the clinic id.
                location_id:
                  type: string
                  description: Clinic id.
                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.
                        If `true`, `slot_durations` must not be empty.
                    slot_durations:
                      type: array
                      items:
                        type: integer
                        minimum: 1
                        maximum: 1440
                      maxItems: 10
                      description: >-
                        Allowed slot durations in minutes (deduplicated and
                        sorted).
                timebounds:
                  type: object
                  description: >-
                    Availability rules to create alongside the schedule. Each
                    block below is independent — include only the rule types you
                    need.
                  properties:
                    weekly:
                      type: object
                      description: >-
                        Map keyed by weekday, `0`(Sunday)–`6`(Saturday), to that
                        day's bounds.
                      additionalProperties:
                        type: object
                        properties:
                          is_enabled:
                            type: boolean
                          bounds:
                            type: array
                            items:
                              type: object
                              properties:
                                s:
                                  type: integer
                                  description: >-
                                    Start time as an HHMM number: `900` = 09:00,
                                    `1330` = 13:30.
                                e:
                                  type: integer
                                  description: 'End time as an HHMM number: `1300` = 13:00.'
                                conf_ids:
                                  type: array
                                  items:
                                    type: string
                                  description: >-
                                    Services bookable in this window (`conf_id`
                                    from List Services). Ignored in a duration
                                    schedule.
                    daily:
                      type: object
                      description: >-
                        One-off, date-specific bounds. Keyed by ISO date
                        (`YYYY-MM-DD`).
                      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
                    repeat-weekly:
                      type: array
                      description: >-
                        Recurring weekly rules — a cycle of `repeat_every`
                        weeks, each with its own bounds via `phases`.
                      items:
                        type: object
                        properties:
                          repeat_every:
                            type: integer
                            description: >-
                              Cycle length in weeks. `phases` must have this
                              many entries.
                          anchor_date:
                            type: string
                            description: >-
                              ISO date the cycle is anchored to (phase 0 starts
                              here).
                          start_date:
                            type: string
                          end_date:
                            type: string
                            description: Optional. Omit for an indefinitely recurring rule.
                          phases:
                            type: array
                            description: >-
                              One weekly schedule per cycle week, same shape as
                              `weekly`.
                            items:
                              type: object
                    repeat-daily:
                      type: array
                      description: >-
                        Recurring daily rules — a cycle of `repeat_every` days
                        where phase `phase_index` is active.
                      items:
                        type: object
                        properties:
                          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
                      description: Blackout windows — no slots are resolved inside these.
                      items:
                        type: object
                        properties:
                          start_date:
                            type: string
                            description: ISO date.
                          end_date:
                            type: string
                            description: ISO date.
                          start_time:
                            type: string
                            description: '`HH:mm`, 24h.'
                          end_time:
                            type: string
                            description: '`HH:mm`, 24h.'
                bookable_by:
                  type: object
                  description: >-
                    Who can book on this schedule. `true` adds the group,
                    `false` removes it. Needs `entity_id` and `location_id`
                    (`400` without them).
                  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:
                name: Dr. Sharma - OPD
                entity_id: doc_12345
                location_id: c-98765
                config:
                  overbooking_limit: 2
                  schedule_slot_config_enabled: true
                  slot_durations:
                    - 15
                    - 30
                timebounds:
                  weekly:
                    '1':
                      is_enabled: true
                      bounds:
                        - s: 900
                          e: 1300
                          conf_ids:
                            - conf_abc123
                        - s: 1400
                          e: 1800
                          conf_ids:
                            - conf_abc123
                    '2':
                      is_enabled: true
                      bounds:
                        - s: 900
                          e: 1300
                          conf_ids:
                            - conf_abc123
                  daily:
                    '2026-10-15':
                      is_enabled: true
                      bounds:
                        - s: 1000
                          e: 1200
                          conf_ids:
                            - conf_abc123
                  repeat-weekly:
                    - repeat_every: 2
                      anchor_date: '2026-09-21'
                      start_date: '2026-09-21'
                      end_date: '2027-03-21'
                      phases:
                        - '3':
                            is_enabled: true
                            bounds:
                              - s: 1600
                                e: 1900
                                conf_ids:
                                  - conf_abc123
                        - '3':
                            is_enabled: false
                            bounds: []
                  repeat-daily:
                    - phase_index: 0
                      repeat_every: 3
                      anchor_date: '2026-09-21'
                      start_date: '2026-09-21'
                      end_date: '2026-12-31'
                      is_enabled: true
                      bounds:
                        - s: 900
                          e: 1100
                          conf_ids:
                            - conf_abc123
                  block:
                    - start_date: '2026-10-20'
                      end_date: '2026-10-22'
                      start_time: '09:00'
                      end_time: '18:00'
                bookable_by:
                  front_desk: true
      responses:
        '201':
          description: Created
          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
                      default:
                        type: boolean
                      userCreatedDefault:
                        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
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                      timebounds:
                        type: object
                        description: Time windows saved, per rule type.
                      assignment:
                        type: object
                        properties:
                          bookable_by:
                            type: array
                            items:
                              type: string
                              enum:
                                - patient
                                - front_desk
                                - ipd
                            description: Groups that can now book on this schedule.
                          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.
        '400':
          description: >-
            Bad Request — validation failure (e.g. missing `name`, invalid
            `config`/`timebounds`, 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
                    example: name is required
        '409':
          description: >-
            Conflict — another schedule is already bookable by patients for this
            doctor and clinic, or a duration schedule was made bookable by
            patients
          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.