Populate fields inside a DOCX template using SuperDoc annotations.
Send a JSON request body with:
document: object containing either base64 or urlfields: array of field objects (id/group, type, value, optional options)Note: Each field requires either
idorgroup:
- id: Targets a single specific field in the template
- group: Targets multiple fields with the same group identifier
The response returns the annotated DOCX/PDF file as a base64 data URI.
{
"document": {
"url": "https://example.com/template.docx"
},
"fields": [
{
"id": "customer_name",
"type": "text",
"value": "John Doe"
},
{
"id": "author",
"type": "image",
"value": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"options": {
"dimensions": {
"width": 200,
"height": 100
}
}
}
]
}
Alternative using base64 document input:
{
"document": {
"base64": "UEsDBBQAAAAIAL+H..."
},
"fields": [
{
"id": "title",
"type": "text",
"value": "Annual Report 2024"
}
]
}
Using group to populate multiple fields:
{
"document": {
"url": "https://example.com/template.docx"
},
"fields": [
{
"group": "company_logo",
"type": "image",
"value": "https://example.com/logo.png"
}
]
}
API key authentication. Keys start with sd_
Output format for the annotated document (defaults to docx)
docx, pdf Annotated DOCX output encoded as a base64 data URI
Annotated DOCX output encoded as a base64 data URI