Convert HTML content to professionally formatted Microsoft Word documents
Send a POST request to /convert with HTML content in the request body:
💡 Tip: The service automatically handles HTML tables with rowspan/colspan, applies formatting presets, and returns a ready-to-use DOCX file.
Convert HTML content to DOCX format with optional formatting presets.
| Parameter | Type | Required | Description |
|---|---|---|---|
html |
string | Required | HTML content to convert. Supports standard HTML tags, tables, lists, etc. |
fileName |
string | Optional | Output filename (default: "document.docx"). Extension .docx is automatically added if missing. |
formatPreset |
string | Optional | Name of formatting preset to apply (e.g., "Fusion Insure"). See Format Presets section. |
On success (HTTP 200), returns a DOCX file with headers:
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.documentContent-Disposition: attachment; filename="[your-filename].docx"X-Request-ID: [unique-request-id] - Use this for tracking and debuggingService health check. Returns status, version, and dependency checks.
This documentation page. Add ?format=json for JSON response.
Format presets apply consistent styling, branding, and formatting to your documents.
📋 What the preset does:
Automatically handles HTML rowspan and colspan attributes, creating properly merged cells in Word tables.
Apply brand-specific fonts, colors, and styling through format presets.
Automatically insert logos in document headers with configurable alignment and size.
Every request gets a unique X-Request-ID header for debugging and log correlation.
Supports standard HTML: headings, paragraphs, tables, lists, bold, italic, links, and more.
Built with gunicorn, structured logging, health checks, and error handling.
Cause: Missing or invalid HTML content in request body.
Response: {"error": "HTML content is required in JSON body with key 'html'"}
Fix: Ensure your request body is valid JSON with an "html" key containing the HTML content.
Cause: Conversion failed due to malformed HTML, missing dependencies, or internal error.
Response: {"error": "[error message]", "request_id": "[unique-id]"}
Fix: Check the error message. Use the request_id to search logs for detailed debugging information.
| Issue | Solution |
|---|---|
| Table cells not merging correctly | Ensure rowspan/colspan attributes are properly set in HTML. The service processes these automatically. |
| Format preset not applied | Check spelling of formatPreset name (case-sensitive). Use /health endpoint to see available presets. |
| Special characters corrupted | Ensure HTML is properly UTF-8 encoded and special characters are HTML-encoded. |
| Logo not appearing in header | Check /health endpoint to verify logo asset is available. Contact admin if asset is missing. |
🔍 Debugging Tips:
X-Request-ID header - save this for support requests