πŸ“

HTML β†’ DOCX API

Send any HTML payload to our endpoint and receive a temporary link to download a native Word (.docx) file β€” converted by Pandoc, with real headings, lists, tables and formatting.

Free β€” 20/week, or $20/mo unlimited β†’

Endpoints

POST https://trilogicppp.com/api/html-to-docx

Converts HTML to a .docx file and returns a temporary download link (valid for 1 hour, single-use).

GET https://trilogicppp.com/api/download-docx/:token

Streams the generated .docx file. Link expires after 1 hour or upon first download.

Request

Headers

HeaderValue
Content-Typeapplication/json
X-API-KeyYour API key (required)

Body (JSON)

FieldTypeDescription
html string Full HTML string to convert. Max 5 MB. Headings, paragraphs, bold/italic, lists, tables and inline (data-URI) images are supported.

Example Request

curl -X POST https://trilogicppp.com/api/html-to-docx \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-key" \
  -d '{
    "html": "<h1>Hello Word</h1><p>Generated from <b>HTML</b>.</p>"
  }'

Response

200 OK

{
  "url":        "https://trilogicppp.com/api/download-docx/550e8400-e29b-41d4-a716-...",
  "expires_at": "2026-02-28T14:30:00.000Z",
  "token":      "550e8400-e29b-41d4-a716-446655440000"
}

Errors

StatusMeaning
400Missing or invalid html field
401Missing or invalid API key
404Download token not found or expired
413HTML payload exceeds 5 MB
429Weekly free limit or paid rate limit reached
500Conversion failure β€” see detail field

Code Samples

JavaScript (fetch)

const res = await fetch('https://trilogicppp.com/api/html-to-docx', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-key',
  },
  body: JSON.stringify({ html: '<h1>Hello</h1>' }),
});
const { url } = await res.json();
window.open(url); // opens the .docx download

Python (requests)

import requests

r = requests.post(
    'https://trilogicppp.com/api/html-to-docx',
    headers={'X-API-Key': 'your-key'},
    json={'html': '<h1>Hello</h1>'},
)
print(r.json()['url'])  # temporary download link

PHP

$ch = curl_init('https://trilogicppp.com/api/html-to-docx');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json', 'X-API-Key: your-key'],
    CURLOPT_POSTFIELDS     => json_encode(['html' => '<h1>Hello</h1>']),
]);
$data = json_decode(curl_exec($ch), true);
echo $data['url'];

Try it live