> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decodahealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview Merge Medications

> Return what would move if `source_ids` were merged into `keep_id`. No-op on data.



## OpenAPI

````yaml post /medications/merge/preview
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /medications/merge/preview:
    post:
      tags:
        - Medications
      summary: Preview Merge Medications
      description: >-
        Return what would move if `source_ids` were merged into `keep_id`. No-op
        on data.
      operationId: preview_merge_medications_medications_merge_preview_post
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergeMedicationsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeMedicationsPreview'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MergeMedicationsRequest:
      properties:
        keepId:
          type: string
          title: Keepid
        sourceIds:
          items:
            type: string
          type: array
          maxItems: 50
          minItems: 1
          title: Sourceids
      type: object
      required:
        - keepId
        - sourceIds
      title: MergeMedicationsRequest
      description: Merge one or more source medications into a kept medication.
    MergeMedicationsPreview:
      properties:
        keep:
          $ref: '#/components/schemas/MedicationMergeSide'
        sources:
          items:
            $ref: '#/components/schemas/MedicationMergeSide'
          type: array
          title: Sources
      type: object
      required:
        - keep
        - sources
      title: MergeMedicationsPreview
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MedicationMergeSide:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        unit:
          anyOf:
            - $ref: '#/components/schemas/Unit'
            - type: 'null'
        isArchived:
          type: boolean
          title: Isarchived
          default: false
        doseCount:
          type: integer
          title: Dosecount
          default: 0
        lastDoseDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Lastdosedate
        chargeItemCount:
          type: integer
          title: Chargeitemcount
          default: 0
        templateCount:
          type: integer
          title: Templatecount
          default: 0
        carePlanStepCount:
          type: integer
          title: Careplanstepcount
          default: 0
        carePlanTemplateStepCount:
          type: integer
          title: Careplantemplatestepcount
          default: 0
        stockLinkCount:
          type: integer
          title: Stocklinkcount
          default: 0
        inventoryLogCount:
          type: integer
          title: Inventorylogcount
          default: 0
      type: object
      required:
        - id
        - name
      title: MedicationMergeSide
      description: Per-medication counts surfaced in the merge preview.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    Unit:
      type: string
      enum:
        - AMPOULES
        - APPLICATORS
        - BOTTLES
        - BOXES
        - CAPSULES
        - CUPS
        - DOSES
        - G_PER_ML
        - GRAMS
        - IU
        - IU_PER_ML
        - OUNCES
        - FLUID_OUNCES
        - KG
        - KITS
        - LITERS
        - MCG
        - MG
        - MG_PER_ML
        - ML
        - MMOL
        - MICROGRAM_PER_ML
        - PACKS
        - PAIRS
        - PATCHES
        - PERCENTAGE
        - PIECES
        - POUCHES
        - ROLLS
        - SACHETS
        - SHEETS
        - SPRAYS
        - STRIPS
        - SYRINGES
        - TABLETS
        - TABLETS_PER_DAY
        - TESTS
        - TROCHES
        - TUBES
        - UNITS
        - VIALS
        - TREATMENTS
        - SESSIONS
        - PULSES
        - JOULES
        - CENTIMETERS
        - THREAD_COUNT
        - INJECTIONS
        - WRINKLE_UNITS
        - POUNDS
        - FEET
        - INCHES
      title: Unit

````