105 × 148 mm
Shipping labels
Return label (A6)
An A6 prepaid return label for online retailers. The upper part carries the returns centre address, the sender and a Code 128 barcode of the RMA number; below a cut line, the customer keeps a summary with the return reason, return-by date and packing instructions.
Opens Dynamic Document API with this template preloaded in a free workspace.
Template language features
- Loops
- Conditionals
- Filters
- Barcode
- Date formatting
- Number formatting
Filters such as format_currency and qrcode are described in the template language reference.
Variables
Derived from the sample data: 6 top-level fields, 30 paths in total. Send the same shape as data.
| Path | Type | Example |
|---|---|---|
| retailer | object | |
| retailer.name | string | "Fellside Outfitters" |
| retailer.website | string | "fellside.example.com" |
| retailer.returns_email | string | "returns@fellside.example.com" |
| returns_centre | object | |
| returns_centre.name | string | "Fellside Outfitters Returns" |
| returns_centre.address_lines | array<string> · 2 | "Unit 12, Beckside Distribution Park" |
| returns_centre.town | string | "Kendal" |
| returns_centre.postcode | string | "LA9 6XY" |
| returns_centre.country | string | "United Kingdom" |
| customer | object | |
| customer.name | string | "Oluwaseun Pryce" |
| customer.address_lines | array<string> · 1 | "5 Thistle Row" |
| customer.town | string | "Stirling" |
| customer.postcode | string | "FK8 2XY" |
| rma | object | |
| rma.number | string | "RMA-FSO-083145" |
| rma.order_number | string | "FSO-2026-557102" |
| rma.created_on | date | "2026-09-16" |
| rma.return_window_days | number | 14 |
| rma.service | string | "Prepaid tracked return" |
| rma.reason | string | "Wrong size: too small" |
| rma.resolution | string | "Exchange for size L" |
| rma.parcel_weight_kg | number | 0.9 |
| rma.locale | string | "en-GB" |
| items | array<object> · 1 | |
| items[].sku | string | "FSO-TSJ-M-SLT" |
| items[].name | string | "Trail shell jacket, men's, M, slate" |
| items[].quantity | number | 1 |
| instructions | array<string> · 4 | "Pack the item unworn, with its tags attached." |
Sample data
Fictional records used for previews. Replace them with your own data when you call the API.
{
"retailer": {
"name": "Fellside Outfitters",
"website": "fellside.example.com",
"returns_email": "returns@fellside.example.com"
},
"returns_centre": {
"name": "Fellside Outfitters Returns",
"address_lines": [
"Unit 12, Beckside Distribution Park",
"Heronbrook Way"
],
"town": "Kendal",
"postcode": "LA9 6XY",
"country": "United Kingdom"
},
"customer": {
"name": "Oluwaseun Pryce",
"address_lines": [
"5 Thistle Row"
],
"town": "Stirling",
"postcode": "FK8 2XY"
},
"rma": {
"number": "RMA-FSO-083145",
"order_number": "FSO-2026-557102",
"created_on": "2026-09-16",
"return_window_days": 14,
"service": "Prepaid tracked return",
"reason": "Wrong size: too small",
"resolution": "Exchange for size L",
"parcel_weight_kg": 0.9,
"locale": "en-GB"
},
"items": [
{ "sku": "FSO-TSJ-M-SLT", "name": "Trail shell jacket, men's, M, slate", "quantity": 1 }
],
"instructions": [
"Pack the item unworn, with its tags attached.",
"Cut along the dashed line and keep this lower part.",
"Stick the label to the parcel, covering any old barcodes.",
"Drop the parcel at a parcel shop or post office by the return date."
]
}Source
The body markup with Jinja, the stylesheet placed in <head>.
{#- A6 return label in two parts: the upper part goes on the parcel (returns centre address, sender and
an RMA barcode), the lower part stays with the customer (return summary and instructions).
The return-by date is calculated from the date the return was created. -#}
{%- set locale = rma.locale | default("en-GB") -%}
{%- set return_by = rma.created_on | date_add(days=rma.return_window_days) -%}
{%- set item_count = items | sum_by("quantity") | int -%}
<div class="sheet">
<section class="parcel-part">
<header class="banner">
<span class="banner-title">Return</span>
<span class="banner-service">{{ rma.service }}</span>
</header>
<div class="deliver">
<p class="small-label">Deliver to</p>
<p class="deliver-name">{{ returns_centre.name }}</p>
{% for line in returns_centre.address_lines %}<p class="deliver-line">{{ line }}</p>{% endfor %}
<p class="deliver-town">{{ returns_centre.town | upper }} {{ returns_centre.postcode }}</p>
</div>
<div class="from-row">
<div class="from">
<p class="small-label">From</p>
<p>{{ customer.name }}, {{ customer.address_lines | join(", ") }}</p>
<p>{{ customer.town }} {{ customer.postcode }}</p>
</div>
<div class="weight">
<p class="small-label">Weight</p>
<p class="weight-value">{{ rma.parcel_weight_kg | format_number(locale, 1) }} kg</p>
</div>
</div>
<div class="rma">
<div class="rma-barcode">{{ rma.number | barcode("code128", alt="Barcode " ~ rma.number) }}</div>
<p class="rma-text">{{ rma.number }}</p>
</div>
<div class="parcel-foot">
<span>Order {{ rma.order_number }}</span>
<span>Return by {{ return_by | format_date("medium", locale) }}</span>
</div>
</section>
<div class="cut">
<svg class="scissors" viewBox="0 0 24 24" aria-hidden="true">
<circle cx="5" cy="7" r="3" fill="none" stroke="#000000" stroke-width="1.6"/>
<circle cx="5" cy="17" r="3" fill="none" stroke="#000000" stroke-width="1.6"/>
<path d="M7.5 8.5L22 17M7.5 15.5L22 7" stroke="#000000" stroke-width="1.6" stroke-linecap="round"/>
</svg>
<span>Cut here · keep the lower part</span>
</div>
<section class="keep-part">
<div class="keep-head">
<p class="keep-title">Your return summary</p>
<p class="keep-brand">{{ retailer.name }}</p>
</div>
<dl class="summary">
<div><dt>RMA</dt><dd>{{ rma.number }}</dd></div>
<div><dt>Return by</dt><dd>{{ return_by | format_date("long", locale) }}</dd></div>
<div><dt>Reason</dt><dd>{{ rma.reason }}</dd></div>
<div><dt>We will</dt><dd>{{ rma.resolution }}</dd></div>
<div class="wide">
<dt>Item{{ "s" if item_count != 1 else "" }}</dt>
<dd>{% for item in items %}{{ item.quantity }} × {{ item.name }} <span class="sku">{{ item.sku }}</span>{% if not loop.last %}<br>{% endif %}{% endfor %}</dd>
</div>
</dl>
<ol class="steps">
{% for step in instructions %}<li><span class="step-no">{{ loop.index }}</span>{{ step }}</li>{% endfor %}
</ol>
<p class="help">Questions? {{ retailer.returns_email }} · quote {{ rma.number }}</p>
</section>
</div><title>Return label {{ rma.number }} – {{ retailer.name }}</title>
<style>
* { box-sizing: border-box; }
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body {
margin: 0;
color: #000000;
font-family: "Liberation Sans", Arial, "DejaVu Sans", sans-serif;
font-size: 7pt;
line-height: 1.25;
}
p { margin: 0; }
.small-label { font-size: 5.5pt; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
/* A6 (105 × 148 mm) minus 5 mm margins; fixed heights keep everything on one sheet. */
.sheet { display: flex; flex-direction: column; width: 95mm; height: 137.5mm; overflow: hidden; }
/* Parcel part */
.parcel-part { display: flex; flex: none; flex-direction: column; height: 80mm; border: 0.7mm solid #000000; }
.banner { display: flex; flex: none; justify-content: space-between; align-items: center; height: 9mm; padding: 0 3mm; background: #000000; color: #ffffff; }
.banner-title { font-size: 15pt; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.banner-service { font-size: 6.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.deliver { flex: none; height: 25mm; padding: 2mm 3mm 0; }
.deliver-name { margin-top: 0.5mm; font-size: 11pt; font-weight: 700; line-height: 1.2; }
.deliver-line { font-size: 9.5pt; font-weight: 700; line-height: 1.2; }
.deliver-town { font-size: 12pt; font-weight: 700; line-height: 1.25; }
.from-row { display: flex; flex: none; height: 11mm; border-top: 0.4mm solid #000000; }
.from { flex: 1; padding: 1.2mm 3mm; font-size: 6.5pt; }
.weight { flex: none; width: 21mm; padding: 1.2mm 2.5mm; border-left: 0.4mm solid #000000; }
.weight-value { font-size: 9pt; font-weight: 700; }
.rma { flex: 1; padding: 1.8mm 3mm 1mm; border-top: 0.4mm solid #000000; text-align: center; }
.rma-barcode img { display: block; width: 84mm; height: 17mm; margin: 0 auto; }
.rma-text { margin-top: 0.8mm; font-family: "Liberation Mono", "DejaVu Sans Mono", monospace; font-size: 10pt; font-weight: 700; letter-spacing: 0.06em; }
.parcel-foot { display: flex; flex: none; justify-content: space-between; align-items: center; height: 6.5mm; padding: 0 3mm; border-top: 0.4mm solid #000000; font-size: 6.5pt; font-weight: 700; }
/* Cut line */
.cut { display: flex; flex: none; align-items: center; gap: 1.5mm; height: 7mm; }
.cut::after { content: ""; flex: 1; border-top: 0.35mm dashed #000000; }
.scissors { flex: none; width: 4.5mm; height: 4.5mm; }
.cut span { flex: none; font-size: 5.5pt; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
/* Customer part */
.keep-part { flex: 1; padding: 2mm 3mm; border: 0.3mm solid #7a7a7a; border-radius: 1.2mm; background: #f2f2f2; overflow: hidden; }
.keep-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1mm; }
.keep-title { font-size: 8.5pt; font-weight: 700; }
.keep-brand { font-size: 6.5pt; color: #444444; }
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8mm 3mm; margin: 0 0 1.5mm; }
.summary div.wide { grid-column: 1 / -1; }
.summary dt { font-size: 5.5pt; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #444444; }
.summary dd { margin: 0; font-size: 7pt; font-weight: 700; }
.sku { font-family: "Liberation Mono", "DejaVu Sans Mono", monospace; font-size: 6pt; font-weight: 400; }
.steps { margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 1.5mm; margin-bottom: 0.5mm; font-size: 6.5pt; line-height: 1.25; }
.step-no {
flex: none; width: 3.4mm; height: 3.4mm; border-radius: 50%; background: #000000; color: #ffffff;
font-size: 5.5pt; font-weight: 700; line-height: 3.4mm; text-align: center;
}
.help { margin-top: 1mm; font-size: 6pt; color: #444444; }
</style>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": {
"retailer": {
"name": "Fellside Outfitters",
"website": "fellside.example.com",
"returns_email": "returns@fellside.example.com"
},
"returns_centre": {
"name": "Fellside Outfitters Returns",
"address_lines": [
"Unit 12, Beckside Distribution Park",
"Heronbrook Way"
],
"town": "Kendal",
"postcode": "LA9 6XY",
"country": "United Kingdom"
},
"customer": {
"name": "Oluwaseun Pryce",
"address_lines": [
"5 Thistle Row"
],
"town": "Stirling",
"postcode": "FK8 2XY"
},
"rma": {
"number": "RMA-FSO-083145",
"order_number": "FSO-2026-557102",
"created_on": "2026-09-16",
"return_window_days": 14,
"service": "Prepaid tracked return",
"reason": "Wrong size: too small",
"resolution": "Exchange for size L",
"parcel_weight_kg": 0.9,
"locale": "en-GB"
},
"items": [
{
"sku": "FSO-TSJ-M-SLT",
"name": "Trail shell jacket, men'\''s, M, slate",
"quantity": 1
}
],
"instructions": [
"Pack the item unworn, with its tags attached.",
"Cut along the dashed line and keep this lower part."
]
},
"output": {
"format": "pdf",
"filename": "shipping-label-return-a6.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": {
"retailer": {
"name": "Fellside Outfitters",
"website": "fellside.example.com",
"returns_email": "returns@fellside.example.com"
},
"returns_centre": {
"name": "Fellside Outfitters Returns",
"address_lines": [
"Unit 12, Beckside Distribution Park",
"Heronbrook Way"
],
"town": "Kendal",
"postcode": "LA9 6XY",
"country": "United Kingdom"
},
"customer": {
"name": "Oluwaseun Pryce",
"address_lines": [
"5 Thistle Row"
],
"town": "Stirling",
"postcode": "FK8 2XY"
},
"rma": {
"number": "RMA-FSO-083145",
"order_number": "FSO-2026-557102",
"created_on": "2026-09-16",
"return_window_days": 14,
"service": "Prepaid tracked return",
"reason": "Wrong size: too small",
"resolution": "Exchange for size L",
"parcel_weight_kg": 0.9,
"locale": "en-GB"
},
"items": [
{
"sku": "FSO-TSJ-M-SLT",
"name": "Trail shell jacket, men's, M, slate",
"quantity": 1
}
],
"instructions": [
"Pack the item unworn, with its tags attached.",
"Cut along the dashed line and keep this lower part."
]
},
"output": {
"format": "pdf",
"filename": "shipping-label-return-a6.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": {
"retailer": {
"name": "Fellside Outfitters",
"website": "fellside.example.com",
"returns_email": "returns@fellside.example.com",
},
"returns_centre": {
"name": "Fellside Outfitters Returns",
"address_lines": ["Unit 12, Beckside Distribution Park", "Heronbrook Way"],
"town": "Kendal",
"postcode": "LA9 6XY",
"country": "United Kingdom",
},
"customer": {
"name": "Oluwaseun Pryce",
"address_lines": ["5 Thistle Row"],
"town": "Stirling",
"postcode": "FK8 2XY",
},
"rma": {
"number": "RMA-FSO-083145",
"order_number": "FSO-2026-557102",
"created_on": "2026-09-16",
"return_window_days": 14,
"service": "Prepaid tracked return",
"reason": "Wrong size: too small",
"resolution": "Exchange for size L",
"parcel_weight_kg": 0.9,
"locale": "en-GB",
},
"items": [
{
"sku": "FSO-TSJ-M-SLT",
"name": "Trail shell jacket, men's, M, slate",
"quantity": 1,
},
],
"instructions": ["Pack the item unworn, with its tags attached.", "Cut along the dashed line and keep this lower part."],
},
"output": {
"format": "pdf",
"filename": "shipping-label-return-a6.pdf",
},
},
timeout=90,
)
response.raise_for_status()
print(response.json())