doc. render_ docx
Generate an editable Word document.
25 credits. Per document.
Example prompt
Send this to your AI app when Heelo is connected:
Create a Word document with this summary and table
Input fields
| Field | Type | Description |
|---|---|---|
blocksRequired | array of object | Document content in order. Types: heading, paragraph, list, table, image (base64 data only), page_break, toc. |
title | string | Document title property. |
return_data | boolean | Also return the file as base64 in `data`. |
end_user_id | string | Which of your end users the render is stored for; doc.extract_* must pass the same one to read it. |
Output fields
The fields in data when status is success.
| Field | Type | Description |
|---|---|---|
asset_id | string | Readable by doc.extract_* as source.asset_id for 30 days. Null when not stored. |
bytes | integer | Size of the rendered document. |
pages | integer | Page count for a PDF. Null for DOCX/XLSX, which have no layout. |
content_type | string | |
filename | string | |
engine_used | string | |
engine_reason | string | Why that engine was chosen (PDF only). |
render_ms | integer | |
stored | boolean | False when the document could not be stored for this caller; see `data`. |
data | string | The document as base64, when not stored or when asked for. |
warnings | array of string | |
limitations | array of string |
Code
The call with the input fields that the tool needs. Set HEELO_API_KEY to your API key.
import os
import requests
response = requests.post(
"https://toolsprimitives.uk/v1/tools/doc.render_docx/invoke",
headers={"Authorization": f"Bearer {os.environ['HEELO_API_KEY']}"},
json={"input": {
"blocks": [{"type": "heading", "text": "Invoice 1001", "level": 1}, {"type": "paragraph", "text": "Total: $120.50"}],
}},
timeout=120,
)
response.raise_for_status()
print(response.json())// Node.js 18 or newer, in an ES module.
const response = await fetch("https://toolsprimitives.uk/v1/tools/doc.render_docx/invoke", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HEELO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
input: {
"blocks": [
{
"type": "heading",
"text": "Invoice 1001",
"level": 1
},
{
"type": "paragraph",
"text": "Total: $120.50"
}
]
},
}),
signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());