---
title: "Preview ConsolidatedInvoice"
method: POST
path: "/api/v1/sale/consolidate/preview/{consolidatingSale}"
tags: ["Sales"]
---

# Preview ConsolidatedInvoice

`POST /api/v1/sale/consolidate/preview/{consolidatingSale}`

Permissions needed: NONE

 This end point is used to preview the consolidated invoice for selected sales, if no sale is selected all customer sales eligible for consolidation are used - create flow.<br>
 If ID of a already consoliated sale is provided (in body an in path also!!!)then preview of existing consolidated invoice is returned - update flow.<br>
 property <i>notConsolidatedSalesDetails</i> from response Contains details for all customer sales eligibe for consolidation process.<br>
 property <i>selectedSalesDetails</i> from response Contains details of selected sales for consolidation process. null - if the request is made with empty <i>sales_ids</i> parameter<br>

## Path parameters

- `consolidatingSale` integer, required

## Request body

- object
  - `customer_id` integer, required
  - `consolidating_sale_id` integer — Required for a existing consolidated invoice preview - on update flow
  - `invoice_date` string, required
  - `sales_ids` integer[]

## Response `200`

successful operation

- object
  - `consolidatingSaleId` integer — Consolidating sale id for existing consolidated invoice preview - on update flow
  - `invoicePreview` string — HTML string of invoice
  - `notConsolidatedSalesDetails` object[] — Contains details for all customer sales eligibe for consolidation process
    - `date` string — Sale date
    - `id` integer — Sale record or counter sale id
    - `number` string — Sale record number, null for counter sale
    - `pet` object — Pet details - if sale is from a pet record
    - `sale` object — Sale details
    - `sale_id` integer — Sale id
  - `selectedSalesDetails` object[] — Contains details of selected sales for consolidation process. null - if the request is made with empty sales_ids parameter
    - `date` string — Sale date
    - `id` integer — Sale record or counter sale id
    - `number` string — Sale record number, null for counter sale
    - `pet` object — Pet details - if sale is from a pet record
    - `sale` object — Sale details
    - `sale_id` integer — Sale id

## Other responses

- `400` — unresolved $ref
- `401` — unresolved $ref
- `403` — unresolved $ref
- `422` — Bad request
- `429` — unresolved $ref

---

[API](https://skmtc.net/digitail/apis/digitail-api.md) · [All operations](https://skmtc.net/digitail/apis/digitail-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/digitail/digitail-api/revisions/bd9694db5fce/schema)
