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

# Save Admission Estimates

> 
### Overview

This API adds, changes and removes **estimate lines** of an IPD admission of your workspace in one call, then recalculates the admission's billed total and returns it.

All three lists are optional:

- `creates` — new estimate lines.
- `updates` — replace an existing line (`estimateId`) with `payload`.
- `deletes` — ids of lines to remove.



## OpenAPI

````yaml post /ipd/v1/service/admissions/{admission_id}/fs-estimates
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/admissions/{admission_id}/fs-estimates:
    post:
      tags:
        - IPD API
      summary: Save Admission Estimates
      description: >-

        ### Overview


        This API adds, changes and removes **estimate lines** of an IPD
        admission of your workspace in one call, then recalculates the
        admission's billed total and returns it.


        All three lists are optional:


        - `creates` — new estimate lines.

        - `updates` — replace an existing line (`estimateId`) with `payload`.

        - `deletes` — ids of lines to remove.
      operationId: SaveIpdAdmissionEstimates
      parameters:
        - name: auth
          in: header
          required: true
          schema:
            type: string
          example: >-
            eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiX2lkIjoiMTIzNDU2IiwiY2xpZW50X2lkIjoiNzg5MCIsImV4dHJhX2ZpZWxkIjoiZXh0cmFfZmllbGRfZGF0YSJ9.q9KzBI6f4l3OyM_EkB5Quq0l9EEMFh5JS-fx3F_PHUM
        - name: admission_id
          in: path
          description: Id of the IPD admission.
          required: true
          style: simple
          schema:
            type: string
          example: a1b2c3d4-5678-90ab-cdef-1234567890ab
      requestBody:
        description: The estimate changes.
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                creates:
                  type: array
                  description: Estimate lines to add.
                  items:
                    $ref: '#/components/schemas/IpdEstimateInput'
                updates:
                  type: array
                  description: Estimate lines to replace.
                  items:
                    type: object
                    additionalProperties: false
                    required:
                      - estimateId
                      - payload
                    properties:
                      estimateId:
                        type: string
                        description: Id of the estimate line to replace.
                      payload:
                        $ref: '#/components/schemas/IpdEstimateInput'
                deletes:
                  type: array
                  description: Ids of the estimate lines to remove.
                  items:
                    type: string
            example:
              creates:
                - name: X-Ray Chest
                  service_id: svc-xray-chest
                  rate: 800
                  quantity: 1
                  discount:
                    category: percentage
                    value: 10
                  remarks: PA view
      responses:
        '200':
          description: OK — the recalculated billed total.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      totalBilled:
                        type: number
                        description: Billed total of the admission after the changes.
              example:
                success: true
                data:
                  totalBilled: 8265
        '400':
          description: >-
            Bad Request. Returns `{ success: false, error }` when the changes
            could not be saved, or `{ message }` when the request body failed
            schema validation (for example a line is missing `name`,
            `service_id`, `rate` or `quantity`; the `message` is currently
            empty).
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/IpdServiceFailure'
                  - $ref: '#/components/schemas/IpdServiceError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IpdServiceError'
      deprecated: false
components:
  schemas:
    IpdEstimateInput:
      title: IpdEstimateInput
      type: object
      additionalProperties: false
      required:
        - name
        - service_id
        - rate
        - quantity
      properties:
        name:
          type: string
          description: Name of the line.
        service_id:
          type: string
          description: Id of the billed service.
        rate:
          type: number
          description: Price per unit.
        quantity:
          type: number
          description: Quantity.
        discount:
          type: object
          additionalProperties: false
          required:
            - category
            - value
          properties:
            category:
              type: string
              enum:
                - percentage
                - fixed
              description: '`percentage` of the line amount, or a `fixed` amount.'
            value:
              type: number
              description: Discount value.
          description: Optional discount on the line.
        remarks:
          type: string
          description: Optional remarks.
    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.