---
title: Preview ConsolidatedInvoice
slug: preview-consolidatedinvoice
docTags: 
createdAt: 2026-06-25T12:23:38.036Z
---

{
  "id": "uEv5cGBRtU1lHpVr4uokD",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://developer.digitail.io/api/v1/sale/consolidate/preview/{consolidatingSale}",
    "servers": [
      {
        "url": "https://developer.digitail.io/api/v1/sale/consolidate/preview/{consolidatingSale}",
        "description": "Sandbox server (uses test data)"
      },
      {
        "url": "https://vet.digitail.io/api/v1/sale/consolidate/preview/{consolidatingSale}",
        "description": "Production server (uses live data)"
      }
    ],
    "name": "Preview ConsolidatedInvoice",
    "description": "<p>Permissions needed: NONE</p>\n<p>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.\n\nIf ID of a already consoliated sale is provided (in body an in path also!!!)then preview of existing consolidated invoice is returned - update flow.\n\nproperty notConsolidatedSalesDetails from response Contains details for all customer sales eligibe for consolidation process.\n\nproperty selectedSalesDetails from response Contains details of selected sales for consolidation process. null - if the request is made with empty sales_ids parameter\n</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "consolidatingSale",
          "type": "integer",
          "description": "The consolidating sale id"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "schema": [
            {
              "name": "customer_id",
              "kind": "required",
              "type": "integer",
              "description": ""
            },
            {
              "name": "consolidating_sale_id",
              "kind": "optional",
              "type": "integer",
              "description": "<p>Required for a existing consolidated invoice preview - on update flow</p>"
            },
            {
              "name": "invoice_date",
              "kind": "required",
              "type": "string",
              "description": ""
            },
            {
              "name": "sales_ids",
              "kind": "optional",
              "type": "array",
              "description": "",
              "example": "",
              "itemType": "integer",
              "customType": "integer[]",
              "itemExample": "",
              "itemDefault": ""
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "passport",
          "name": "passport",
          "kind": "optional",
          "type": "oauth2",
          "description": "Laravel passport oauth2 security.",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://digitail.test/oauth/authorize",
              "tokenUrl": "https://digitail.test/oauth/token",
              "refreshUrl": "https://digitail.test/oauth/token"
            }
          }
        },
        {
          "id": "Bearer",
          "name": "Bearer",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "consolidatingSaleId",
                "kind": "optional",
                "type": "integer",
                "description": "<p>Consolidating sale id for existing consolidated invoice preview - on update flow</p>"
              },
              {
                "name": "invoicePreview",
                "kind": "optional",
                "type": "string",
                "description": "HTML string of invoice"
              },
              {
                "name": "notConsolidatedSalesDetails",
                "kind": "optional",
                "type": "array",
                "description": "Contains details for all customer sales eligibe for consolidation process",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "date",
                    "kind": "optional",
                    "type": "string",
                    "description": "Sale date"
                  },
                  {
                    "name": "id",
                    "kind": "optional",
                    "type": "integer",
                    "description": "Sale record or counter sale id"
                  },
                  {
                    "name": "number",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Sale record number, null for counter sale</p>"
                  },
                  {
                    "name": "pet",
                    "kind": "optional",
                    "type": "object",
                    "description": "<p>Pet details - if sale is from a pet record</p>",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "sale",
                    "kind": "optional",
                    "type": "object",
                    "description": "Sale details",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "sale_id",
                    "kind": "optional",
                    "type": "integer",
                    "description": "Sale id"
                  }
                ]
              },
              {
                "name": "selectedSalesDetails",
                "kind": "optional",
                "type": "array",
                "description": "<p>Contains details of selected sales for consolidation process. null - if the request is made with empty sales_ids parameter</p>",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "date",
                    "kind": "optional",
                    "type": "string",
                    "description": "Sale date"
                  },
                  {
                    "name": "id",
                    "kind": "optional",
                    "type": "integer",
                    "description": "Sale record or counter sale id"
                  },
                  {
                    "name": "number",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Sale record number, null for counter sale</p>"
                  },
                  {
                    "name": "pet",
                    "kind": "optional",
                    "type": "object",
                    "description": "<p>Pet details - if sale is from a pet record</p>",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "sale",
                    "kind": "optional",
                    "type": "object",
                    "description": "Sale details",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "sale_id",
                    "kind": "optional",
                    "type": "integer",
                    "description": "Sale id"
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Bad request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "undefined",
            "example": "{\"key\":\"labels.consolidate_invoice.errors.sales_have_payments\",\"message\":\"exceptions.labels.consolidate_invoice.errors.sales_have_payments\",\"meta\":[]}",
            "description": "",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "i-5VddEyRLa81KiAjr6u3",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://developer.digitail.io/api/v1/sale/consolidate/preview/{consolidatingSale} \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"customer_id\": \"\",\n     \"invoice_date\": \"\"\n     }'"
        },
        {
          "id": "qlfLvXfzsI2KBSmeN8Fmj",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"customer_id\": \"\",\n   \"invoice_date\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://developer.digitail.io/api/v1/sale/consolidate/preview/{consolidatingSale}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "zjskv3Pc84vRx4cEsvF0l",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://developer.digitail.io/api/v1/sale/consolidate/preview/{consolidatingSale}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"customer_id\": \"\",\n   \"invoice_date\": \"\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "PDDYj-UwXG0WUSnDR8jby",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://developer.digitail.io/api/v1/sale/consolidate/preview/{consolidatingSale}\"\n\npayload = json.dumps({\n   \"customer_id\": \"\",\n   \"invoice_date\": \"\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "i-5VddEyRLa81KiAjr6u3"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// successful operation\n{\n  \"consolidatingSaleId\": 0,\n  \"invoicePreview\": \"\",\n  \"notConsolidatedSalesDetails\": [\n    {\n      \"date\": \"\",\n      \"id\": 0,\n      \"number\": \"\",\n      \"pet\": {},\n      \"sale\": {},\n      \"sale_id\": 0\n    }\n  ],\n  \"selectedSalesDetails\": [\n    {\n      \"date\": \"\",\n      \"id\": 0,\n      \"number\": \"\",\n      \"pet\": {},\n      \"sale\": {},\n      \"sale_id\": 0\n    }\n  ]\n}"
        },
        {
          "id": "response-1-422",
          "language": "422",
          "code": "// Bad request\n\"{\\\"key\\\":\\\"labels.consolidate_invoice.errors.sales_have_payments\\\",\\\"message\\\":\\\"exceptions.labels.consolidate_invoice.errors.sales_have_payments\\\",\\\"meta\\\":[]}\""
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}