Skip to content
hushvert

DOCX to PDF conversion API

Convert DOCX to PDF on the server with one HTTP call, instead of running a headless LibreOffice or Gotenberg office runtime yourself. Submit, poll, download. 50 free conversions a month, then pay per use.

Convert DOCX to PDF in three requests

Authenticate with a bearer key from your backend (never ship the key to the browser). Submit the conversion, upload the file to the presigned URL, poll until it is done, and download the result.

curl

# 1. Submit the conversion
curl -X POST https://hushvert.com/api/v1/conversions \
  -H "Authorization: Bearer $HUSHVERT_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "pair": "docx-to-pdf", "bytes": '$(wc -c < input.docx)' }'
# -> { "jobId": "...", "uploadUrl": "...", "pollUrl": "/api/v1/conversions/..." }

# 2. Upload the file to the presigned uploadUrl
curl -X PUT "$UPLOAD_URL" --data-binary @input.docx

# 3. Poll until done, then download
curl https://hushvert.com/api/v1/conversions/$JOB_ID \
  -H "Authorization: Bearer $HUSHVERT_KEY"
# -> { "status": "done", "downloadUrl": "...", "expiresAt": "..." }
curl -o output.pdf "$DOWNLOAD_URL"

Node.js

import { readFile, writeFile } from 'node:fs/promises'

const KEY = process.env.HUSHVERT_KEY
const bytes = await readFile('input.docx')

// 1. Submit
const submit = await fetch('https://hushvert.com/api/v1/conversions', {
  method: 'POST',
  headers: { authorization: `Bearer ${KEY}`, 'content-type': 'application/json' },
  body: JSON.stringify({ pair: 'docx-to-pdf', bytes: bytes.byteLength }),
}).then((r) => r.json())

// 2. Upload to the presigned URL
await fetch(submit.uploadUrl, { method: 'PUT', body: bytes })

// 3. Poll until done
let job
do {
  await new Promise((r) => setTimeout(r, 1500))
  job = await fetch(`https://hushvert.com${submit.pollUrl}`, {
    headers: { authorization: `Bearer ${KEY}` },
  }).then((r) => r.json())
} while (job.status !== 'done' && job.status !== 'failed')

// 4. Download
const out = await fetch(job.downloadUrl).then((r) => r.arrayBuffer())
await writeFile('output.pdf', Buffer.from(out))

Python

import os, time, requests

KEY = os.environ["HUSHVERT_KEY"]
data = open("input.docx", "rb").read()

# 1. Submit
submit = requests.post("https://hushvert.com/api/v1/conversions",
    headers={"Authorization": f"Bearer {KEY}"},
    json={"pair": "docx-to-pdf", "bytes": len(data)}).json()

# 2. Upload to the presigned URL
requests.put(submit["uploadUrl"], data=data)

# 3. Poll until done
job = {}
while job.get("status") not in ("done", "failed"):
    time.sleep(1.5)
    job = requests.get(f"https://hushvert.com{submit['pollUrl']}",
        headers={"Authorization": f"Bearer {KEY}"}).json()

# 4. Download
out = requests.get(job["downloadUrl"]).content
open("output.pdf", "wb").write(out)

Limits and pricing

Free per month50 conversions per account, then pay per use from account credits.
Max file size50 MB
PrivacyInput deleted the moment the conversion finishes; output kept about an hour, then deleted.

See the full request, error codes, and idempotency reference on the API keys page, and the plans on pricing.

Why an API for this?

Rendering office documents to PDF needs a full office engine with the right fonts. Running one headless and reliably (cold starts, font packs, the occasional crash on a malformed file) is real infrastructure. The API gives you that as a single HTTP call, so you never ship LibreOffice in your own image.

Everything a browser can do (images, HEIC, audio, archives, PDF page operations) runs free and on-device in the open-source @hushvert/engine SDK - no upload, no key. This API is only for DOCX to PDF and the other server-only formats.

What is DOCX?

DOCX is Microsoft Word's default document format since Word 2007: technically a ZIP container full of XML describing text, styles, tables and embedded media. Nearly every word processor can read it, but viewing one without Office installed, or on a locked-down machine, is still a recurring annoyance. Because it is structured markup rather than fixed layout, faithful conversion is about content and structure, not pixel-perfect appearance.

What is PDF?

PDF (Portable Document Format) is the 1993 Adobe format that froze documents into a fixed, device-independent layout, and it has since become the legal and professional standard for anything that must look the same everywhere: contracts, invoices, forms, papers. A PDF can contain vector text, images, fonts and annotations. Editing one is famously awkward, which is exactly the point; it is a final-form format.

DOCX to PDF API FAQ

How do I convert DOCX to PDF with an API?

Send a POST to /api/v1/conversions with the pair and the byte count, upload the file to the presigned URL it returns, then poll until the job is done and download the result. It is three short requests; full code is above in curl, Node, and Python.

Why not just convert DOCX to PDF myself?

You can, if you want to run and maintain a headless LibreOffice or Gotenberg office runtime. Rendering office documents to PDF needs a full office engine with the right fonts. Running one headless and reliably (cold starts, font packs, the occasional crash on a malformed file) is real infrastructure. The API gives you that as a single HTTP call, so you never ship LibreOffice in your own image.

What does it cost?

Every account gets 50 free conversions per month across all of its keys. Beyond that, the API draws on account credits, billed per conversion. Everything a browser can do is free and keyless in the open-source SDK.

What happens to my file?

The file uploads over an encrypted connection. The input is deleted the moment the conversion finishes; the converted output is kept for about an hour so you can download it, then deleted too.

Can my AI agent do this conversion?

Yes. The @hushvert/mcp Model Context Protocol server gives Claude Code, Cursor, and other agents a convert_file tool over this same API, so an agent can run the conversion in one call.

Related conversion APIs