
4 × 6 in
Shipping labels
Shipping label 4 × 6 in
A carrier-neutral 4 × 6 inch shipping label in high-contrast black and white for thermal printers. It has a large ship-to address, service level, weight, package count, a bold routing code, Code 128 barcodes for the tracking number and postal code, and a QR code with the shipment summary.
PDFCustom sizeLocale en-USHTML + Jinja
Opens Dynamic Document API with this template preloaded in a free workspace.
Template language features
- Loops
- Conditionals
- Macros
- Filters
- Barcode
- QR code
- Date formatting
- Number formatting
Filters such as format_currency and qrcode are described in the template language reference.
Variables
Derived from the sample data: 3 top-level fields, 37 paths in total. Send the same shape as data.
| Path | Type | Example |
|---|---|---|
| shipment | object | |
| shipment.tracking_number | string | "ND48273019665502" |
| shipment.service_level | string | "Ground" |
| shipment.service_code | string | "GND" |
| shipment.transit | string | "3–5 business days" |
| shipment.ship_date | date | "2026-09-17" |
| shipment.weight_lb | number | 12.4 |
| shipment.dimensions_in | object | |
| shipment.dimensions_in.length | number | 14 |
| shipment.dimensions_in.width | number | 10 |
| shipment.dimensions_in.height | number | 8 |
| shipment.package_number | number | 2 |
| shipment.package_count | number | 3 |
| shipment.routing_code | string | "AZ 860 9-07" |
| shipment.hub | string | "PHX-3" |
| shipment.reference | string | "SO-58213" |
| shipment.po_number | string | "7730-114" |
| shipment.billing | string | "Prepaid" |
| shipment.signature_required | boolean | true |
| shipment.locale | string | "en-US" |
| sender | object | |
| sender.name | string | "Driftwood Supply Co." |
| sender.attention | string | "Shipping Dept." |
| sender.address_lines | array<string> · 1 | "480 Harbor Industrial Way, Unit C" |
| sender.city | string | "Portland" |
| sender.state | string | "OR" |
| sender.postal_code | string | "97217" |
| sender.phone | string | "+1 202-555-0119" |
| recipient | object | |
| recipient.name | string | "Rosalind Achebe-Morrow" |
| recipient.company | string | "Tamarack Ceramics Studio" |
| recipient.address_lines | array<string> · 2 | "2215 W Juniper Ave" |
| recipient.city | string | "Flagstaff" |
| recipient.state | string | "AZ" |
| recipient.postal_code | string | "86001" |
| recipient.country | string | "United States" |
| recipient.phone | string | "+1 202-555-0182" |
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": {
"shipment": {
"tracking_number": "ND48273019665502",
"service_level": "Ground",
"service_code": "GND",
"transit": "3–5 business days",
"ship_date": "2026-09-17",
"weight_lb": 12.4,
"dimensions_in": {
"length": 14,
"width": 10,
"height": 8
},
"package_number": 2,
"package_count": 3,
"routing_code": "AZ 860 9-07",
"hub": "PHX-3",
"reference": "SO-58213",
"po_number": "7730-114",
"billing": "Prepaid",
"signature_required": true,
"locale": "en-US"
},
"sender": {
"name": "Driftwood Supply Co.",
"attention": "Shipping Dept.",
"address_lines": [
"480 Harbor Industrial Way, Unit C"
],
"city": "Portland",
"state": "OR",
"postal_code": "97217",
"phone": "+1 202-555-0119"
},
"recipient": {
"name": "Rosalind Achebe-Morrow",
"company": "Tamarack Ceramics Studio",
"address_lines": [
"2215 W Juniper Ave",
"Suite 110"
],
"city": "Flagstaff",
"state": "AZ",
"postal_code": "86001",
"country": "United States",
"phone": "+1 202-555-0182"
}
},
"output": {
"format": "pdf",
"filename": "shipping-label-4x6.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": {
"shipment": {
"tracking_number": "ND48273019665502",
"service_level": "Ground",
"service_code": "GND",
"transit": "3–5 business days",
"ship_date": "2026-09-17",
"weight_lb": 12.4,
"dimensions_in": {
"length": 14,
"width": 10,
"height": 8
},
"package_number": 2,
"package_count": 3,
"routing_code": "AZ 860 9-07",
"hub": "PHX-3",
"reference": "SO-58213",
"po_number": "7730-114",
"billing": "Prepaid",
"signature_required": true,
"locale": "en-US"
},
"sender": {
"name": "Driftwood Supply Co.",
"attention": "Shipping Dept.",
"address_lines": [
"480 Harbor Industrial Way, Unit C"
],
"city": "Portland",
"state": "OR",
"postal_code": "97217",
"phone": "+1 202-555-0119"
},
"recipient": {
"name": "Rosalind Achebe-Morrow",
"company": "Tamarack Ceramics Studio",
"address_lines": [
"2215 W Juniper Ave",
"Suite 110"
],
"city": "Flagstaff",
"state": "AZ",
"postal_code": "86001",
"country": "United States",
"phone": "+1 202-555-0182"
}
},
"output": {
"format": "pdf",
"filename": "shipping-label-4x6.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": {
"shipment": {
"tracking_number": "ND48273019665502",
"service_level": "Ground",
"service_code": "GND",
"transit": "3–5 business days",
"ship_date": "2026-09-17",
"weight_lb": 12.4,
"dimensions_in": {
"length": 14,
"width": 10,
"height": 8,
},
"package_number": 2,
"package_count": 3,
"routing_code": "AZ 860 9-07",
"hub": "PHX-3",
"reference": "SO-58213",
"po_number": "7730-114",
"billing": "Prepaid",
"signature_required": True,
"locale": "en-US",
},
"sender": {
"name": "Driftwood Supply Co.",
"attention": "Shipping Dept.",
"address_lines": ["480 Harbor Industrial Way, Unit C"],
"city": "Portland",
"state": "OR",
"postal_code": "97217",
"phone": "+1 202-555-0119",
},
"recipient": {
"name": "Rosalind Achebe-Morrow",
"company": "Tamarack Ceramics Studio",
"address_lines": ["2215 W Juniper Ave", "Suite 110"],
"city": "Flagstaff",
"state": "AZ",
"postal_code": "86001",
"country": "United States",
"phone": "+1 202-555-0182",
},
},
"output": {
"format": "pdf",
"filename": "shipping-label-4x6.pdf",
},
},
timeout=90,
)
response.raise_for_status()
print(response.json())