Skip to main content
The placeholder replacement tool lets you upload a DOCX or ODT template containing {{placeholder}} tags and replace them with dynamic values — text, images, lists, or even full table rows.

How it works

  1. Upload your template file (DOCX or ODT) via the file upload endpoint
  2. Upload any image files you want to use in placeholders
  3. Create a job via POST /tools/docx/replace-placeholders with the file ID and a variables object
  4. Poll the job via GET /tools/jobs/{jobId} until status is COMPLETED
  5. Download the result via GET /tools/files/{fileId}/download

Request body

Top-level properties

Variable types

Text variable

A simple string value. In your template, use {{name}} and the text will be replaced directly.

Image variable

Replaces a {{placeholder}} tag with an image. The image must first be uploaded via the file upload endpoint — pass the file ID as src.
Upload the image via POST /tools/files/upload (the tools file upload), then use the returned id as the src value. Do not use the temporary image upload endpoint (POST /images/upload) — that is only for render jobs (JSON/Markdown rendering). The two upload endpoints use separate storage systems.

List variable

Replaces a {{placeholder}} tag with a formatted list — either bulleted or numbered.
Lists are rendered as formatted text in the document. Each item appears on a new line with the appropriate prefix.

Table variable

Expands a single template row into multiple rows with dynamic data. This is the most powerful variable type — it duplicates a table row in your DOCX/ODT template for each entry in the rows array.

How to set up the template

In your DOCX or ODT file, create a real table with a header row and one data row. In each cell of the data row, use dot-notation placeholders: The property names after the dot (plan, price, credits) must match the keys in each row object exactly.
The header row is static text — only the data row containing the {{varName.property}} placeholders is duplicated. Make sure each cell in the data row contains exactly one placeholder.

Output format

By default, the output format matches the input (DOCX in → DOCX out, ODT in → ODT out). Use outputFormat to convert:

Complete example

1. Upload the template

Response:

2. Upload an image (optional)

Response:

3. Create the replacement job

Response:

4. Poll for completion

Response (when completed):

5. Download the result

Supported file types

For best results, use DOCX templates.