Update Quotes

This tutorial describes a quote update process via API. This way, you can update your quote based on the external information, for example, from a CRM.

Quote update demo

Updating a quote

You can only update a quote in a document where a quote placeholder already exists - whether it's a document created from a template including a quote or a quote block set on the UI.

Call Document Details to retrieve the id and the structure of your existing quote. You can then pass a sections object in a Update Quote payload. The example below showcases the fields you can update via API:

{
    "sections":
    [
        {
            "id": "c51d7cc2-e0d3-4401-bf77-ef4ef02d618c",
            "name": "section 2",
            "items":
            [
                {
                    "id": "d0483d00-c765-4baf-beda-fd9070e867bc",
                    "sku": "coffee_mug",
                    "name": "Coffee Magic Mug",
                    "description": "Meticulously crafted in Italy these classic glass coffee mugs or tea cups will complete any barware collection. Contemporary sleek drinking glasses designed to enhance any décor.",
                    "qty": "30",
                    "price": "20",
                    "cost": "5",
                    "billing_frequency": "annually",
                    "contract_term": 2,
                    "pricing_method": "volume_based_flat",
                    "type": "product",
                    "reference_type": "catalog",
                    "reference_id": "091481df-9c57-7d94-43f3-389e6efc404a",
                    "options":
                    {
                        "qty_editable": true,
                        "selected": true
                    },
                    "custom_columns":
                    {},
                    "multipliers":
                    {},
                    "discounts":
                    {},
                    "fees":
                    {},
                    "taxes":
                    {},
                    "total": "600"
                }
            ],
            "settings":
            {
                "selection_type": "custom",
                "optional": false,
                "selected": true
            }
        }
    ]
}

Quote update caveats

You can update a quote multiple times. There are two important points to remember when updating a quote:

  1. To preserve a section or an item as is, always pass its id, otherwise the section or item will be deleted in the update version of the quote.

For example, you have two sections and you want to rename an item in one them. For this, pass the following request body:

{
    "sections":
    [
        {
            "id": "c51d7cc2-e0d3-4401-bf77-ef4ef02d618c",
            "name": "Section 1"
            "items": [
                {
                    "id": "3758f0a0-3cb0-4d94-abb5-4c7b7d2013b3"
                },
                {
                    "id": "c5604762-369a-424c-b387-15650e63f032",
                    "name": "New name"
                }

            ]
        },
        {
            "id": "ec79f600-480c-4731-b15c-2d19f0476b4b"
        }
    ]
}

Notice how you only need to pass the id of the structures that stay the same.

This also means that to delete an item, you can omit it in the payload.

  1. The order of sections and items you pass in the quote reflects the order in which they will appear in the updated version. This means that changing the order of the items in the payload will change the items order in the document as well.