jstodocx.com API
Use the jstodocx.com API to create Word .docx files from controlled inputs. The API is useful for agents that need a downloadable DOCX without installing document-generation dependencies locally.
Read references/api.md when you need exact request schemas, examples, status codes, or response headers.
Workflow
- Choose one mode:
html: convert basic HTML headings, paragraphs, lists, and tables into DOCX.
js-source: archive JavaScript source text as a readable Word document. Do not treat this as code execution.
template: create a report, invoice, proposal, resume, or meeting-notes DOCX from structured fields.
- Send
POST https://jstodocx.com/api/v1/docx with content-type: application/json.
- If the endpoint returns
401, ask the user for an API key or use the browser-local website instead. Do not guess credentials.
- Save the binary response to a
.docx file.
- Verify the result when possible by checking the response
content-type, filename, and ZIP magic bytes PK.
Safety Rules
- Do not execute arbitrary JavaScript through this API. The
js-source mode treats JavaScript as text only.
- Do not send protected, confidential, or high-risk content unless the user explicitly confirms it is acceptable to send it to the API.
- Do not print, log, commit, or store API keys.
- Do not include raw user document content in logs or final summaries. Summarize mode, byte size, filename, and status instead.
- Do not claim pixel-perfect HTML fidelity. The API supports basic document formatting.
Minimal Example
curl -X POST "https://jstodocx.com/api/v1/docx" \
-H "content-type: application/json" \
--output release-plan.docx \
--data '{
"mode": "html",
"title": "Release Plan",
"html": "<h1>Release Plan</h1><p>Hello <strong>team</strong>.</p>"
}'
If the user provides an API key:
curl -X POST "https://jstodocx.com/api/v1/docx" \
-H "content-type: application/json" \
-H "authorization: Bearer $JSTODOCX_API_KEY" \
--output source-archive.docx \
--data '{
"mode": "js-source",
"title": "Widget Export Code",
"code": "function exportWidget() {\n return 42;\n}",
"options": { "lineNumbers": true }
}'
1---2name: jstodocx-api3description: Generate Microsoft Word DOCX files through the jstodocx.com API. Use when Codex needs to create or download .docx files from basic HTML, JavaScript source text, or controlled document template fields; when a user asks for HTML to DOCX, JS source to Word, or template-based DOCX generation via an API; or when integrating a lightweight Cloudflare Worker DOCX conversion endpoint into scripts, tests, or agent workflows.4---5
6# jstodocx.com API
7
8Use the jstodocx.com API to create Word `.docx` files from controlled inputs. The API is useful for agents that need a downloadable DOCX without installing document-generation dependencies locally.
9
10Read [references/api.md](references/api.md) when you need exact request schemas, examples, status codes, or response headers.
11
12## Workflow
13
141. Choose one mode:
15 - `html`: convert basic HTML headings, paragraphs, lists, and tables into DOCX.
16 - `js-source`: archive JavaScript source text as a readable Word document. Do not treat this as code execution.
17 - `template`: create a report, invoice, proposal, resume, or meeting-notes DOCX from structured fields.
182. Send `POST https://jstodocx.com/api/v1/docx` with `content-type: application/json`.
193. If the endpoint returns `401`, ask the user for an API key or use the browser-local website instead. Do not guess credentials.
204. Save the binary response to a `.docx` file.
215. Verify the result when possible by checking the response `content-type`, filename, and ZIP magic bytes `PK`.
22
23## Safety Rules
24
25- Do not execute arbitrary JavaScript through this API. The `js-source` mode treats JavaScript as text only.
26- Do not send protected, confidential, or high-risk content unless the user explicitly confirms it is acceptable to send it to the API.
27- Do not print, log, commit, or store API keys.
28- Do not include raw user document content in logs or final summaries. Summarize mode, byte size, filename, and status instead.
29- Do not claim pixel-perfect HTML fidelity. The API supports basic document formatting.
30
31## Minimal Example
32
33```bash
34curl -X POST "https://jstodocx.com/api/v1/docx" \
35 -H "content-type: application/json" \
36 --output release-plan.docx \
37 --data '{
38 "mode": "html",
39 "title": "Release Plan",
40 "html": "<h1>Release Plan</h1><p>Hello <strong>team</strong>.</p>"
41 }'
42```
43
44If the user provides an API key:
45
46```bash
47curl -X POST "https://jstodocx.com/api/v1/docx" \
48 -H "content-type: application/json" \
49 -H "authorization: Bearer $JSTODOCX_API_KEY" \
50 --output source-archive.docx \
51 --data '{
52 "mode": "js-source",
53 "title": "Widget Export Code",
54 "code": "function exportWidget() {\n return 42;\n}",
55 "options": { "lineNumbers": true }
56 }'
57```