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

# Link Bed to Clinic

> 
### Overview

This API links an **IPD bed** to a **clinic** of your workspace, so the bed is available at that clinic. A bed can be linked to more than one clinic.

The link is unique per `bed` and `clinic_id`: calling this API again for the same pair updates the existing link instead of creating a new one. `archived` defaults to `false`, so calling it for a previously removed link makes it active again.

Returns `400` with `Bed not found` when the `bed` does not exist or belongs to another workspace.



## OpenAPI

````yaml post /ipd/v1/service/bed-clinic-relations
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:
  /ipd/v1/service/bed-clinic-relations:
    post:
      tags:
        - IPD API
      summary: Link Bed to Clinic
      description: >-

        ### Overview


        This API links an **IPD bed** to a **clinic** of your workspace, so the
        bed is available at that clinic. A bed can be linked to more than one
        clinic.


        The link is unique per `bed` and `clinic_id`: calling this API again for
        the same pair updates the existing link instead of creating a new one.
        `archived` defaults to `false`, so calling it for a previously removed
        link makes it active again.


        Returns `400` with `Bed not found` when the `bed` does not exist or
        belongs to another workspace.
      operationId: CreateIpdBedClinicRelation
      parameters:
        - name: auth
          in: header
          required: true
          schema:
            type: string
          example: >-
            eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiX2lkIjoiMTIzNDU2IiwiY2xpZW50X2lkIjoiNzg5MCIsImV4dHJhX2ZpZWxkIjoiZXh0cmFfZmllbGRfZGF0YSJ9.q9KzBI6f4l3OyM_EkB5Quq0l9EEMFh5JS-fx3F_PHUM
      requestBody:
        description: The bed and clinic to link.
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - bed
                - clinic_id
              properties:
                bed:
                  type: string
                  description: Id of the bed to link.
                clinic_id:
                  type: string
                  description: Id of the clinic to link the bed to.
                archived:
                  type: boolean
                  default: false
                  description: >-
                    Set to `true` to store the link as removed. Defaults to
                    `false`.
            example:
              bed: 66f1c4d2e4b0a1b2c3d4e702
              clinic_id: clinic-01
      responses:
        '200':
          description: OK — the bed-clinic link.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IpdBedClinicRelationResponse'
              example:
                success: true
                data:
                  id: 66f1c5e8e4b0a1b2c3d4e803
                  bed: 66f1c4d2e4b0a1b2c3d4e702
                  clinic_id: clinic-01
                  archived: false
                  updatedAt: '2026-10-07T09:55:00.000Z'
        '400':
          description: >-
            Bad Request. Returns `{ success: false, error }` when the `bed` is
            not a valid id or the bed was not found, or `{ message }` when the
            request body failed schema validation (for example `bed` or
            `clinic_id` is missing, or an unknown field was sent; the `message`
            is currently empty).
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/IpdServiceFailure'
                  - $ref: '#/components/schemas/IpdServiceError'
              example:
                success: false
                error: Bed not found
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IpdServiceError'
      deprecated: false
components:
  schemas:
    IpdBedClinicRelationResponse:
      title: IpdBedClinicRelationResponse
      type: object
      properties:
        success:
          type: boolean
        data:
          $ref: '#/components/schemas/IpdBedClinicRelation'
    IpdServiceFailure:
      title: IpdServiceFailure
      type: object
      properties:
        success:
          type: boolean
          description: Always `false`.
        error:
          type: string
          description: Human-readable error message.
    IpdServiceError:
      title: IpdServiceError
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message.
    IpdBedClinicRelation:
      title: IpdBedClinicRelation
      type: object
      properties:
        id:
          type: string
          description: Bed-clinic link id.
        bed:
          type: string
          description: Id of the linked bed.
        clinic_id:
          type: string
          description: Id of the linked clinic.
        archived:
          type: boolean
          description: '`true` when the link has been removed.'
        updatedAt:
          type: string
          description: Last-updated date-time as an ISO-8601 string.

````

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