Template API

← Back to help

Placeholders

Two constructs are supported inside an uploaded .docx template:

  • {{ Type.Field }} — single-value replace. Exactly one space on each side, no dotted paths beyond Type.Field.
  • {% for Type in AnyWord %} … {% endfor %} — loops. Can nest, and work row-wise inside Word tables.

A placeholder with no matching entry in the request is left verbatim in the output — the most common reason a generated document doesn't look right.

Generating a document

POST /api/generate, header X-API-Key: <your key>.

{
  "config": { "id": "...", "type": "...", "actions": [...], "children": [...] },
  "payload": "<base64-encoded .docx template>",
  "salesforce_org_id": "optional"
}

Response:

{
  "status": "ok",
  "message": "...",
  "payload": "<base64-encoded rendered .docx>"
}

Errors

StatusMeaning
400Malformed request, or an org mismatch on a scoped key.
401Missing or invalid API key.
500Server-side rendering failure.

Keys & usage limits

Each API key can be scoped to a single Salesforce org and carries a monthly call limit. Request access to get a key for your organisation.