Code examples
Replace ck_YOUR_API_KEY with your organization API key and update templateId / variables for your template.
Render template to HTML (synchronous)
Resolves an **approved** template version and returns rendered HTML as a streamed response. - `templateId` is required. - `templateVersionId` is optional; when omitted, the latest approved version is used. - `variables` supplies values for `{{placeholder}}` syntax in the template.
POST /api/v1/render/html
curl -sS -X POST 'https://api.commspliant.com/api/v1/render/html' \
-H 'X-Api-Key: ck_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"variables": {
"title": "Monthly Report",
"user": {
"name": "Jane Doe"
}
}
}' \
--output document.htmlRender template to PDF (synchronous)
Resolves an **approved** template version, renders HTML with `variables`, converts to PDF, and returns the PDF as a streamed response. Same auth rules as `POST /api/v1/render/html`.
POST /api/v1/render/pdf
curl -sS -X POST 'https://api.commspliant.com/api/v1/render/pdf' \
-H 'X-Api-Key: ck_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"variables": {
"title": "Invoice",
"amount": "99.00"
}
}' \
--output document.pdf