How to Update Quotes via API

Update quote sections, items, and pricing in PandaDoc documents via the API using data from a CRM or other external system.

Problem

You need to update the pricing, items, or structure of a quote in an existing PandaDoc document -- for example, syncing product data from a CRM into a document's quote section via the API.

Prerequisites

  • A document with an existing quote placeholder (from a template that includes a quote, or a quote block added through the UI)
  • A PandaDoc API key or OAuth token

Solution

Step 1: Retrieve the quote structure

Call Document Details to get the id and structure of the existing quote. You'll need section and item IDs to update specific parts without losing existing data.

Step 2: Build the update payload

Pass a sections object in the Update Quote request. The example below shows the fields you can update:

{
    "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.",
                    "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
            }
        }
    ]
}

Step 3: Send the update

PUT the payload to the Update Quote endpoint for your document.

Demo

Troubleshooting

Sections or items disappear after update

To preserve a section or item, always pass its id in the payload. Any section or item omitted from the payload will be deleted. To keep an item unchanged, pass just its id:

{
    "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"
        }
    ]
}

To delete an item, omit it from the payload entirely.

Item order changed unexpectedly

The order of sections and items in the payload determines their order in the document. If you rearrange items in the JSON, they will be reordered in the document.

Verification

  1. After updating, open the document in the PandaDoc web app and verify that quote items, pricing, and sections reflect the changes.
  2. Call Document Details again to confirm the updated quote structure matches your intent.

Related