Documents
Compose a multi-part document
Combines multiple document parts (each with its own template, HTML, fields, images, etc.) into a single output document. Supports page breaks between parts, global page settings, watermarks, password protection, and ZUGFeRD invoice embedding.
post/api/documents/compose
Request
- Base URL: https://api.dokmatiq.com
- URL: https://api.dokmatiq.com/api/documents/compose
- Auth: API key in header X-API-Key
Headers
X-DocGen-Validatestring
Request body
Example request
{
"documents": [
{
"templateName": "cover-page.odt",
"templateFilename": "deckblatt.odt",
"markdownStyles": {
"heading1": "Heading 1",
"heading2": "Heading 2",
"heading3": "Heading 3",
"heading4": "Heading 4",
"heading5": "Heading 5",
"heading6": "Heading 6",
"paragraph": "Text Body",
"listBullet": "List Bullet",
"listNumber": "List Number",
"listBullet2": "List Bullet 2",
"listNumber2": "List Number 2",
"codeBlock": "Preformatted Text",
"blockQuote": "Quotations",
"codeSpan": "Source Text",
"codeFontName": "Liberation Mono"
}
}
],
"pageSettings": {
"headerLeft": "Company Name",
"headerCenter": "Document Title",
"headerRight": "{{PAGE}}/{{PAGES}}",
"footerCenter": "Page {{PAGE}} of {{PAGES}}",
"header": {
"left": "Company Name",
"center": "Document Title",
"right": "{{PAGE}} / {{PAGES}}",
"height": 15,
"spacing": 5,
"fontName": "Helvetica",
"fontSize": 9,
"color": "#666666"
},
"footer": {
"left": "Company Name",
"center": "Document Title",
"right": "{{PAGE}} / {{PAGES}}",
"height": 15,
"spacing": 5,
"fontName": "Helvetica",
"fontSize": 9,
"color": "#666666"
},
"headerFirstPage": {
"left": "Company Name",
"center": "Document Title",
"right": "{{PAGE}} / {{PAGES}}",
"height": 15,
"spacing": 5,
"fontName": "Helvetica",
"fontSize": 9,
"color": "#666666"
},
"footerFirstPage": {
"left": "Company Name",
"center": "Document Title",
"right": "{{PAGE}} / {{PAGES}}",
"height": 15,
"spacing": 5,
"fontName": "Helvetica",
"fontSize": 9,
"color": "#666666"
},
"headerEvenPages": {
"left": "Company Name",
"center": "Document Title",
"right": "{{PAGE}} / {{PAGES}}",
"height": 15,
"spacing": 5,
"fontName": "Helvetica",
"fontSize": 9,
"color": "#666666"
},
"footerEvenPages": {
"left": "Company Name",
"center": "Document Title",
"right": "{{PAGE}} / {{PAGES}}",
"height": 15,
"spacing": 5,
"fontName": "Helvetica",
"fontSize": 9,
"color": "#666666"
},
"headerFooterFontName": "Helvetica",
"headerFooterFontSize": 9,
"headerFooterColor": "#666666",
"marginTop": 20,
"marginBottom": 20,
"marginLeft": 25,
"marginRight": 25,
"pageNumberOffset": 1
},
"watermark": {
"text": "DRAFT",
"fontSize": 120,
"opacity": 0.15
},
"contentAreas": [
{
"content": "**Firma Beispiel GmbH**\nFrau Anna Müller\nMusterstraße 42\n*12345 Berlin*",
"x": 25,
"y": 50,
"width": 80,
"height": 35,
"fontName": "OpenSans",
"customFonts": {
"regular": "AAEAAAARAQ...",
"bold": "AAEAAAARAQ..."
},
"fontSize": 10,
"lineHeight": 1.4,
"color": "#333333",
"alignment": "LEFT",
"barcode": {
"format": "EAN13",
"width": 60,
"height": 25
},
"imageBase64": "iVBORw0KGgoAAAANS..."
}
],
"stationery": {
"pdf": "JVBERi0xLjQK...",
"firstPagePdf": "JVBERi0xLjQK..."
},
"invoice": {
"number": "RE-2026-001",
"date": "2026-03-25",
"dueDate": "2026-04-25",
"currency": "EUR",
"seller": {
"name": "Muster GmbH",
"street": "Musterstraße 1",
"city": "Berlin",
"country": "DE",
"vatId": "DE123456789",
"email": "info@muster.de",
"phone": "+49 30 1234567"
},
"buyer": {
"name": "Muster GmbH",
"street": "Musterstraße 1",
"city": "Berlin",
"country": "DE",
"vatId": "DE123456789",
"email": "info@muster.de",
"phone": "+49 30 1234567"
},
"items": [
{
"description": "Software Development",
"quantity": 10,
"unit": "HUR",
"unitPrice": 150,
"vatRate": 19
}
],
"paymentTerms": "Net 30 days",
"bankAccount": {
"iban": "DE89370400440532013000",
"bic": "COBADEFFXXX",
"accountHolder": "Muster GmbH"
},
"referenceNumber": "04011000-12345-67",
"buyerReference": "04011000-12345-67",
"sellerTaxNumber": "27/123/12345"
}
}Response
Composed document
Changes
No recorded changes to this operation across all 1 revision of this API.