
210 × 297 mm
Purchase orders
Standard purchase order
An A4 purchase order with buyer, supplier and delivery addresses, a required-by date calculated from the lead time, numbered order lines, subtotal, VAT and total derived from the lines, delivery instructions and an approval block that adds finance sign-off above a threshold.
PDFA4 portraitLocale en-GBHTML + JinjaHeader & footer
Opens Dynamic Document API with this template preloaded in a free workspace.
Template language features
- Loops
- Conditionals
- Macros
- Filters
- Currency formatting
- Date formatting
- Repeating table headers
- Header & footer
- Page numbers
Filters such as format_currency and qrcode are described in the template language reference.
Variables
Derived from the sample data: 9 top-level fields, 44 paths in total. Send the same shape as data.
| Path | Type | Example |
|---|---|---|
| buyer | object | |
| buyer.name | string | "Stackyard Brewing Co. Ltd" |
| buyer.address | string | "The Maltings, 7 Stackyard Lane ⏎ Kendal LA9 4T…" |
| buyer.vat_id | string | "GB 318 2264 50" |
| buyer.invoice_email | string | "payables@stackyard.example.com" |
| buyer_contact | object | |
| buyer_contact.name | string | "Rhiannon Tuckett" |
| buyer_contact.role | string | "Procurement Lead" |
| buyer_contact.email | string | "rhiannon.tuckett@stackyard.example.com" |
| buyer_contact.phone | string | "+44 20 7946 0852" |
| supplier | object | |
| supplier.name | string | "Pellow & Grange Packaging Ltd" |
| supplier.account | string | "SUP-00412" |
| supplier.address | string | "Unit 14, Brindley Road Industrial Estate ⏎ War…" |
| supplier.email | string | "orders@pellowgrange.example.com" |
| deliver_to | object | |
| deliver_to.name | string | "Stackyard Brewing, Goods In" |
| deliver_to.address | string | "Bay 3, Kentmere Works, Quarry Row ⏎ Kendal LA9…" |
| deliver_to.hours | string | "Monday to Friday, 07:30–14:30" |
| deliver_to.contact | string | "Warehouse team, +44 20 7946 0853" |
| order | object | |
| order.number | string | "PO-SB-2026-0388" |
| order.date | date | "2026-09-15" |
| order.lead_time_days | number | 21 |
| order.supplier_quote | string | "Q-PG-11873" |
| order.payment_terms | string | "30 days from the end of the invoice month" |
| order.cost_centre | string | "OPS-PACK" |
| order.currency | string | "GBP" |
| order.vat_rate | number | 0.2 |
| lines | array<object> · 8 | |
| lines[].code | string | "PG-CAN-440-MB" |
| lines[].description | string | "Aluminium cans, 440 ml, matt black, unprinted" |
| lines[].unit | string | "pallet of 8,280" |
| lines[].quantity | number | 6 |
| lines[].unit_price | number | 812.4 |
| lines[].amount | number | 4874.4 |
| delivery_instructions | array<string> · 4 | "Book a delivery slot with the warehouse team a…" |
| conditions | string | "Quote the PO number on every delivery note and…" |
| approvals | array<object> · 3 | |
| approvals[].step | string | "Requested by" |
| approvals[].name | string | "Rhiannon Tuckett" |
| approvals[].role | string | "Procurement Lead" |
| approvals[].date | date | "2026-09-14" |
| approvals[].required_above | number | 5000 |
Render it with the API
After adding the template to your workspace, render it by ID and pass your data. Arrays are shortened here.
curl -X POST https://api-eu.dynamicdocumentapi.com/v1/renders \
-H "Authorization: Bearer $DYNAMIC_DOCUMENT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"input": {
"type": "template",
"template_id": "tpl_01J9ZK3M7Q8V5W2X4Y6Z8A0B1C"
},
"data": {
"buyer": {
"name": "Stackyard Brewing Co. Ltd",
"address": "The Maltings, 7 Stackyard Lane\nKendal LA9 4TR\nUnited Kingdom",
"vat_id": "GB 318 2264 50",
"invoice_email": "payables@stackyard.example.com"
},
"buyer_contact": {
"name": "Rhiannon Tuckett",
"role": "Procurement Lead",
"email": "rhiannon.tuckett@stackyard.example.com",
"phone": "+44 20 7946 0852"
},
"supplier": {
"name": "Pellow & Grange Packaging Ltd",
"account": "SUP-00412",
"address": "Unit 14, Brindley Road Industrial Estate\nWarrington WA2 8QZ\nUnited Kingdom",
"email": "orders@pellowgrange.example.com"
},
"deliver_to": {
"name": "Stackyard Brewing, Goods In",
"address": "Bay 3, Kentmere Works, Quarry Row\nKendal LA9 6QQ\nUnited Kingdom",
"hours": "Monday to Friday, 07:30–14:30",
"contact": "Warehouse team, +44 20 7946 0853"
},
"order": {
"number": "PO-SB-2026-0388",
"date": "2026-09-15",
"lead_time_days": 21,
"supplier_quote": "Q-PG-11873",
"payment_terms": "30 days from the end of the invoice month",
"cost_centre": "OPS-PACK",
"currency": "GBP",
"vat_rate": 0.2
},
"lines": [
{
"code": "PG-CAN-440-MB",
"description": "Aluminium cans, 440 ml, matt black, unprinted",
"unit": "pallet of 8,280",
"quantity": 6,
"unit_price": 812.4,
"amount": 4874.4
},
{
"code": "PG-END-202-SL",
"description": "Can ends, 202 diameter, silver",
"unit": "box of 6,000",
"quantity": 8,
"unit_price": 96,
"amount": 768
}
],
"delivery_instructions": [
"Book a delivery slot with the warehouse team at least 48 hours in advance.",
"Deliver on standard 1,200 × 1,000 mm pallets, stretch-wrapped, no higher than 1.8 m."
],
"conditions": "Quote the PO number on every delivery note and invoice. Part deliveries only by prior agreement. All goods are inspected on arrival and may be returned if they do not match this order.",
"approvals": [
{
"step": "Requested by",
"name": "Rhiannon Tuckett",
"role": "Procurement Lead",
"date": "2026-09-14",
"required_above": null
},
{
"step": "Budget holder",
"name": "Callum Everingham",
"role": "Head of Operations",
"date": "2026-09-15",
"required_above": null
}
]
},
"output": {
"format": "pdf",
"filename": "purchase-order-standard.pdf"
}
}'const response = await fetch("https://api-eu.dynamicdocumentapi.com/v1/renders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DYNAMIC_DOCUMENT_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
"input": {
"type": "template",
"template_id": "tpl_01J9ZK3M7Q8V5W2X4Y6Z8A0B1C"
},
"data": {
"buyer": {
"name": "Stackyard Brewing Co. Ltd",
"address": "The Maltings, 7 Stackyard Lane\nKendal LA9 4TR\nUnited Kingdom",
"vat_id": "GB 318 2264 50",
"invoice_email": "payables@stackyard.example.com"
},
"buyer_contact": {
"name": "Rhiannon Tuckett",
"role": "Procurement Lead",
"email": "rhiannon.tuckett@stackyard.example.com",
"phone": "+44 20 7946 0852"
},
"supplier": {
"name": "Pellow & Grange Packaging Ltd",
"account": "SUP-00412",
"address": "Unit 14, Brindley Road Industrial Estate\nWarrington WA2 8QZ\nUnited Kingdom",
"email": "orders@pellowgrange.example.com"
},
"deliver_to": {
"name": "Stackyard Brewing, Goods In",
"address": "Bay 3, Kentmere Works, Quarry Row\nKendal LA9 6QQ\nUnited Kingdom",
"hours": "Monday to Friday, 07:30–14:30",
"contact": "Warehouse team, +44 20 7946 0853"
},
"order": {
"number": "PO-SB-2026-0388",
"date": "2026-09-15",
"lead_time_days": 21,
"supplier_quote": "Q-PG-11873",
"payment_terms": "30 days from the end of the invoice month",
"cost_centre": "OPS-PACK",
"currency": "GBP",
"vat_rate": 0.2
},
"lines": [
{
"code": "PG-CAN-440-MB",
"description": "Aluminium cans, 440 ml, matt black, unprinted",
"unit": "pallet of 8,280",
"quantity": 6,
"unit_price": 812.4,
"amount": 4874.4
},
{
"code": "PG-END-202-SL",
"description": "Can ends, 202 diameter, silver",
"unit": "box of 6,000",
"quantity": 8,
"unit_price": 96,
"amount": 768
}
],
"delivery_instructions": [
"Book a delivery slot with the warehouse team at least 48 hours in advance.",
"Deliver on standard 1,200 × 1,000 mm pallets, stretch-wrapped, no higher than 1.8 m."
],
"conditions": "Quote the PO number on every delivery note and invoice. Part deliveries only by prior agreement. All goods are inspected on arrival and may be returned if they do not match this order.",
"approvals": [
{
"step": "Requested by",
"name": "Rhiannon Tuckett",
"role": "Procurement Lead",
"date": "2026-09-14",
"required_above": null
},
{
"step": "Budget holder",
"name": "Callum Everingham",
"role": "Head of Operations",
"date": "2026-09-15",
"required_above": null
}
]
},
"output": {
"format": "pdf",
"filename": "purchase-order-standard.pdf"
}
}),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const result = await response.json();
console.log(result);import os
import uuid
import requests
response = requests.post(
"https://api-eu.dynamicdocumentapi.com/v1/renders",
headers={
"Authorization": f"Bearer {os.environ['DYNAMIC_DOCUMENT_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"input": {
"type": "template",
"template_id": "tpl_01J9ZK3M7Q8V5W2X4Y6Z8A0B1C",
},
"data": {
"buyer": {
"name": "Stackyard Brewing Co. Ltd",
"address": "The Maltings, 7 Stackyard Lane\nKendal LA9 4TR\nUnited Kingdom",
"vat_id": "GB 318 2264 50",
"invoice_email": "payables@stackyard.example.com",
},
"buyer_contact": {
"name": "Rhiannon Tuckett",
"role": "Procurement Lead",
"email": "rhiannon.tuckett@stackyard.example.com",
"phone": "+44 20 7946 0852",
},
"supplier": {
"name": "Pellow & Grange Packaging Ltd",
"account": "SUP-00412",
"address": "Unit 14, Brindley Road Industrial Estate\nWarrington WA2 8QZ\nUnited Kingdom",
"email": "orders@pellowgrange.example.com",
},
"deliver_to": {
"name": "Stackyard Brewing, Goods In",
"address": "Bay 3, Kentmere Works, Quarry Row\nKendal LA9 6QQ\nUnited Kingdom",
"hours": "Monday to Friday, 07:30–14:30",
"contact": "Warehouse team, +44 20 7946 0853",
},
"order": {
"number": "PO-SB-2026-0388",
"date": "2026-09-15",
"lead_time_days": 21,
"supplier_quote": "Q-PG-11873",
"payment_terms": "30 days from the end of the invoice month",
"cost_centre": "OPS-PACK",
"currency": "GBP",
"vat_rate": 0.2,
},
"lines": [
{
"code": "PG-CAN-440-MB",
"description": "Aluminium cans, 440 ml, matt black, unprinted",
"unit": "pallet of 8,280",
"quantity": 6,
"unit_price": 812.4,
"amount": 4874.4,
},
{
"code": "PG-END-202-SL",
"description": "Can ends, 202 diameter, silver",
"unit": "box of 6,000",
"quantity": 8,
"unit_price": 96,
"amount": 768,
},
],
"delivery_instructions": ["Book a delivery slot with the warehouse team at least 48 hours in advance.", "Deliver on standard 1,200 × 1,000 mm pallets, stretch-wrapped, no higher than 1.8 m."],
"conditions": "Quote the PO number on every delivery note and invoice. Part deliveries only by prior agreement. All goods are inspected on arrival and may be returned if they do not match this order.",
"approvals": [
{
"step": "Requested by",
"name": "Rhiannon Tuckett",
"role": "Procurement Lead",
"date": "2026-09-14",
"required_above": None,
},
{
"step": "Budget holder",
"name": "Callum Everingham",
"role": "Head of Operations",
"date": "2026-09-15",
"required_above": None,
},
],
},
"output": {
"format": "pdf",
"filename": "purchase-order-standard.pdf",
},
},
timeout=90,
)
response.raise_for_status()
print(response.json())