Quote PDF generation API

Generate a sales quote PDF from a template and your pricing JSON in a single call. Docweave binds the customer, line items, discounts, and validity date into an HTML quote template and returns a ready-to-send PDF — no headless browser to run yourself.

Generate a sales quote PDF via the API

POST your template and data to /api/v1/pdf:

curl https://docweave.dev/api/v1/pdf \
  -H "Authorization: Bearer dw_live_your_key" \
  -H "Content-Type: application/json" \
  -H "Accept: application/pdf" \
  --output quote-2031.pdf \
  -d '{
    "source": {
      "type": "template",
      "template": "<h1>Quote {{ quote_number }}</h1><p>Prepared for {{ customer }}</p><p>Valid until: {{ valid_until }}</p><p>Total: {{ total }}</p>",
      "data": {
        "quote_number": "Q-2031",
        "customer": "Northwind Traders",
        "valid_until": "2026-08-14",
        "total": "$14,750.00"
      }
    },
    "options": { "format": "A4" },
    "idempotencyKey": "quote-2031"
  }'

…or from an AI agent

Add the Docweave MCP server and your agent gets a generate_pdf tool — the same orchestration, no HTTP boilerplate:

// From an AI agent over MCP — no HTTP plumbing:
generate_pdf({
  source: {
    type: "template",
    template: "<h1>Quote {{ quote_number }}</h1><p>Prepared for {{ customer }}</p><p>Valid until: {{ valid_until }}</p><p>Total: {{ total }}</p>",
    data: { quote_number: "Q-2031", customer: "Northwind Traders", valid_until: "2026-08-14", total: "$14,750.00" }
  },
  outputPath: "/tmp/quote-2031.pdf"
})

Template example

Any HTML works as a template. Use {{ placeholders }} for the values you pass in data:

<article style="font-family: sans-serif;">
  <header style="display:flex; justify-content:space-between;">
    <h1>Sales Quote {{ quote_number }}</h1>
    <div>Issued {{ issued_date }}</div>
  </header>

  <p>Prepared for: {{ customer }}</p>
  <p>Sales rep: {{ sales_rep }}</p>
  <p>Valid until: {{ valid_until }}</p>

  <table style="width:100%; border-collapse:collapse;">
    {{{ line_items }}}
  </table>

  <p style="text-align:right;">Subtotal: {{ subtotal }}</p>
  <p style="text-align:right;">Discount: {{ discount }}</p>
  <p style="text-align:right;">Tax: {{ tax }}</p>
  <p style="text-align:right;"><strong>Total: {{ total }}</strong></p>

  <p style="margin-top: 24px; font-size: 12px; color: #666;">{{ terms }}</p>
</article>

FAQ

How do I generate a sales quote PDF from the API?

Send a POST to /api/v1/pdf with a source of type "template": pass your sales quote HTML template and a data object with the quote number, customer, line items, and totals. Docweave binds the JSON into the {{ placeholders }} and returns the quote PDF.

Can I reuse the same quote template across sales reps and deals?

Yes. Send the template inline on each request, or store a template and reference it, then pass only the per-quote JSON. The layout, branding, and terms stay identical while the customer, line items, and pricing change per call.

How do I avoid generating a duplicate quote PDF when a rep resubmits?

Include an idempotencyKey (for example the quote number). A repeat request with the same key returns the stored result instead of re-rendering or re-billing, so retries from a CRM workflow or a flaky network are always safe.

How is sales quote PDF generation priced?

Pricing is per document, not per page. A one-page quote and a multi-page quote itemizing dozens of SKUs count the same, so a long, detailed proposal never costs extra.

Ready to generate sales quote PDFs in production?

Get an API key