Input Parameters
| Field | Type | Required / Default | Description & Constraints |
|---|---|---|---|
fileBase64 |
string |
Required | Base64-encoded .docx or .pptx OOXML template file (accepts raw Base64 or data:...;base64, URI). (minLength: 16) |
format |
string |
Default: "auto" |
Template format ('auto' inspects internal OOXML ZIP entries). (enum: auto | docx | pptx) |
variables |
object |
Optional | Key-value map for {{placeholder}} variables across body, headers, footers, and slides. Multi-line '\n' values expand to <w:br/> / <a:br/>. |
tableLoops |
object |
Optional | Repeating table row arrays keyed by loop name (matching {{#items}}...{{/items}} inside a Word or PowerPoint table row). |
REST Example (curl)
curl -X POST "https://office-template.apikeg.com/v1/merge-office-template" \
-H "Content-Type: application/json" \
-d '{
"fileBase64": "UEsDBBQAAAAIA...",
"format": "docx",
"variables": {
"customer_name": "Acme Robotics, Inc.",
"billing_address": "500 Market St\nSuite 1200\nSan Francisco, CA",
"contract_id": "MSA-2026-089"
},
"tableLoops": {
"items": [
{
"sku": "ENT-SEAT",
"description": "Enterprise Agent Seat",
"qty": 25,
"total": "$2,500"
},
{
"sku": "DED-EDGE",
"description": "Dedicated Edge Worker",
"qty": 1,
"total": "$500"
}
]
}
}'
MCP tools/call Payload
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "merge_office_template",
"arguments": {
"fileBase64": "UEsDBBQAAAAIA...",
"format": "docx",
"variables": {
"customer_name": "Acme Robotics, Inc.",
"billing_address": "500 Market St\nSuite 1200\nSan Francisco, CA",
"contract_id": "MSA-2026-089"
},
"tableLoops": {
"items": [
{
"sku": "ENT-SEAT",
"description": "Enterprise Agent Seat",
"qty": 25,
"total": "$2,500"
},
{
"sku": "DED-EDGE",
"description": "Dedicated Edge Worker",
"qty": 1,
"total": "$500"
}
]
}
}
}
}