---
title: "Link a pre-existing open estimate to an appointment. Honors the unique index on
    `treatment_plans.appointment_id` (one estimate per appointment):
    * No estimate on the appointment yet → set AppointmentId on the chosen one.
* The appointment's auto-created estimate is empty → drop it and re-point the chosen
    estimate (preserves the chosen estimate's identity + consent history).
* The appointment's estimate already has lines → merge the chosen estimate's lines into
    it and remove the chosen estimate.
    Returns the resulting estimate the Services tab should render."
method: POST
path: "/Estimates/{id}/link-appointment"
tags: ["Estimates"]
---

# Link a pre-existing open estimate to an appointment. Honors the unique index on
    `treatment_plans.appointment_id` (one estimate per appointment):
    * No estimate on the appointment yet → set AppointmentId on the chosen one.
* The appointment's auto-created estimate is empty → drop it and re-point the chosen
    estimate (preserves the chosen estimate's identity + consent history).
* The appointment's estimate already has lines → merge the chosen estimate's lines into
    it and remove the chosen estimate.
    Returns the resulting estimate the Services tab should render.

`POST /Estimates/{id}/link-appointment`

## Path parameters

- `id` string, required

## Request body

- LinkAppointmentRequest — Link a pre-existing open estimate to an appointment (chronicle Services tab).
  - `appointmentId` string

## Response `200`

OK

- EstimateDto
  - `id` string
  - `estimateNumber` string
  - `clientId` string, nullable
  - `clientName` string, nullable
  - `patientId` string, nullable
  - `patientName` string, nullable
  - `appointmentId` string, nullable
  - `status` string
  - `selectedTier` string, nullable
  - `invoiceId` string, nullable
  - `notes` string, nullable
  - `createdById` string, nullable
  - `createdByName` string, nullable
  - `createdAt` string, date-time
  - `updatedAt` string, date-time
  - `items` EstimateLineItemDto[]
    - `id` string
    - `serviceCatalogItemId` string, nullable
    - `retailItemId` string, nullable
    - `inventoryItemId` string, nullable
    - `billableItemId` string, nullable — Source BillableItem ("Charge") id when this line is a charge.
    - `code` string
    - `description` string
    - `unitPrice` union
      - number, double
      - string, double
    - `qtyMode` string
    - `qtyLow` union
      - number, double
      - string, double
    - `qtyMed` union
      - number, double
      - string, double
    - `qtyHigh` union
      - number, double
      - string, double
    - `quantity` union — Working quantity (tier collapses into this; execution dispenses it).
      - number, double
      - string, double
    - `isTaxable` boolean
    - `note` string, nullable
    - `displayOrder` union
      - integer
      - string, int32
    - `serviceType` string — "Procedure" | "Inventory" | "Retail" — derived from the source FK.
    - `inventoryItemCategory` string, nullable — InventoryItemCategory ("Vaccine", "Medication", …) for an inventory-backed line; routes the perform flow (e.g. vaccine administration).
    - `executionStatus` string — Pending | Performed | Declined.
    - `disposition` string, nullable — Persisted dispense disposition: InHouse | TakeHomeLabelNow | TakeHomeLabelLater (null for non-dispensing lines).
    - `requiresSig` boolean — True when this performed take-home line still needs its SIG / medication details filled (blocks convert). Drives the per-line "Fill instructions" affordance. In-house lines are never required.
    - `markedForBilling` boolean
    - `dispenseFee` union — Flat per-dispense fee on the line (once per unique inventory item on the estimate).
      - number, double
      - string, double
    - `unitCost` union — Snapshotted lot cost for a dispensed inventory line.
      - number, double
      - string, double
    - `inventoryTransactionId` string, nullable — Set once an inventory line is dispensed in-visit. The void reversal anchors on this.
    - `performedById` string, nullable
    - `performedByName` string, nullable
    - `performedAt` string, date-time, nullable
    - `declinedReason` string, nullable
    - `declinedAt` string, date-time, nullable
    - `isControlledSubstance` boolean — True for a controlled-substance inventory line (gates the void-reason requirement).
    - `lineTotal` union — Computed line total: (UnitPrice × Quantity) + DispenseFee.
      - number, double
      - string, double

---

[API](https://skmtc.net/clinicos/apis/pawthosx-business-api-v1.md) · [All operations](https://skmtc.net/clinicos/apis/pawthosx-business-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/clinicos/pawthosx-business-api-v1/versions/a905bde4e796/schema)
