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

# Mark Pharmacy Clearance Cleared

> 
### Overview

This API records that **one pharmacy has closed its dues** for a patient being discharged from your workspace. The pharmacy must already have been notified about the discharge for this admission; otherwise the request fails with `400`.

When this was the **last pharmacy still pending**, the admission's pharmacy clearance is completed automatically and the response returns `clearanceCompleted: true`.

For the in-house pharmacy (`provider: dawakhana`, `pharmacyId: dawakhana`), the admission is also removed from [List Dawakhana Pending Clearances](/api-reference/doc-tool/ipd-api/dawakhana/list-dawakhana-clearances). The user making the request is recorded as the person who cleared it.



## OpenAPI

````yaml post /ipd/v1/service/pharmacies/clearance-clear
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/pharmacies/clearance-clear:
    post:
      tags:
        - IPD API
      summary: Mark Pharmacy Clearance Cleared
      description: >-

        ### Overview


        This API records that **one pharmacy has closed its dues** for a patient
        being discharged from your workspace. The pharmacy must already have
        been notified about the discharge for this admission; otherwise the
        request fails with `400`.


        When this was the **last pharmacy still pending**, the admission's
        pharmacy clearance is completed automatically and the response returns
        `clearanceCompleted: true`.


        For the in-house pharmacy (`provider: dawakhana`, `pharmacyId:
        dawakhana`), the admission is also removed from [List Dawakhana Pending
        Clearances](/api-reference/doc-tool/ipd-api/dawakhana/list-dawakhana-clearances).
        The user making the request is recorded as the person who cleared it.
      operationId: ClearIpdPharmacyClearance
      parameters:
        - name: auth
          in: header
          required: true
          schema:
            type: string
          example: >-
            eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiX2lkIjoiMTIzNDU2IiwiY2xpZW50X2lkIjoiNzg5MCIsImV4dHJhX2ZpZWxkIjoiZXh0cmFfZmllbGRfZGF0YSJ9.q9KzBI6f4l3OyM_EkB5Quq0l9EEMFh5JS-fx3F_PHUM
      requestBody:
        description: The pharmacy that has closed its dues.
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - admissionId
                - provider
                - pharmacyId
              properties:
                admissionId:
                  type: string
                  description: Id of the IPD admission being discharged.
                provider:
                  type: string
                  enum:
                    - evital
                    - dawakhana
                  description: Provider of the pharmacy that cleared.
                pharmacyId:
                  type: string
                  description: >-
                    Id of the pharmacy that cleared (`dawakhana` for the
                    in-house pharmacy).
                note:
                  type: string
                  description: Optional note stored with the clearance.
            example:
              admissionId: a1b2c3d4-5678-90ab-cdef-1234567890ab
              provider: dawakhana
              pharmacyId: dawakhana
              note: All dues settled
      responses:
        '200':
          description: OK — the pharmacy was marked cleared.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      clearanceCompleted:
                        type: boolean
                        description: >-
                          `true` when this was the last pending pharmacy and the
                          pharmacy clearance was completed.
              example:
                success: true
                data:
                  clearanceCompleted: true
        '400':
          description: >-
            Bad Request. Returns `{ success: false, error }` when the pharmacy
            was not notified for this admission or the clearance could not be
            saved, or `{ message }` when the request body failed schema
            validation (for example a required field is missing or `provider` is
            not allowed; the `message` is currently empty).
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/IpdServiceFailure'
                  - $ref: '#/components/schemas/IpdServiceError'
              example:
                success: false
                error: >-
                  Unknown pharmacy notify target dawakhana/dawakhana on
                  admission a1b2c3d4-5678-90ab-cdef-1234567890ab
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IpdServiceError'
      deprecated: false
components:
  schemas:
    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.

````

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