HTML Templates & Variables

HTML Templates & Variables


ZipZign renders document content from HTML using Handlebars for dynamic data injection.


Basic structure


Pass your HTML in the content field:


{
"content": "<h1>Invoice #{{invoiceNumber}}</h1><p>Dear {{clientName}},</p><p>Amount due: ${{amount}}</p>",
"variables": {
"invoiceNumber": "1042",
"clientName": "Acme Corp",
"amount": "500.00"
}
}


Handlebars syntax: {{variableName}}


Supported Handlebars features


<!-- Basic substitution -->
<p>Hello, {{name}}!</p>

<!-- Conditionals -->
{{#if isPremium}}
<p>Thank you for being a premium member.</p>
{{/if}}

<!-- Loops -->
<ul>
{{#each items}}
<li>{{this.description}} — ${{this.price}}</li>
{{/each}}
</ul>

<!-- Nested objects -->
<p>{{client.firstName}} {{client.lastName}}</p>


Limits


Limit

Value

Max HTML size

500 KB

Max metadata pairs

50 key-value pairs


Styling tips


ZipZign renders HTML to PDF using a headless browser. For best results:


  • Use inline styles or <style> blocks — external stylesheets won't load
  • Use pt or px units; avoid vw/vh
  • Prefer @page CSS rules for margins:


<style>
@page {
margin: 60px 60px;
}
body {
font-family: Arial, sans-serif;
font-size: 12pt;
color: #111;
}
h1 { font-size: 20pt; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 8px; border: 1px solid #ddd; }
</style>


Full example


{
"type": "signable",
"title": "Service Agreement — {{clientName}}",
"content": "<style>body{font-family:sans-serif;font-size:12pt}</style><h1>Service Agreement</h1><p>This agreement is made between <strong>Acme Corp</strong> and <strong>{{clientName}}</strong> on {{date}}.</p><h2>Scope of Work</h2><ul>{{#each services}}<li>{{this}}</li>{{/each}}</ul><p>Total fee: ${{totalFee}}</p>",
"variables": {
"clientName": "Widget Inc",
"date": "April 15, 2026",
"services": ["Web design", "SEO audit", "3 months support"],
"totalFee": "4,500.00"
},
"signers": [
{ "name": "Widget Inc Rep", "email": "rep@widgetinc.com" }
]
}


Updating content


After creation, you can replace a document's HTML (if it hasn't been signed yet):


curl -X PATCH https://zipzign.com/api/documents/doc_abc123 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "content": "<h1>Updated content</h1>" }'

Updated on: 16/04/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!