Integrate
Using DocxAPI outside n8n
It is a plain JSON endpoint over HTTPS. Any language and any automation tool that can make a POST request will work.
Reading this with an AI agent?
The entire documentation lives in one Markdown file, built to be fetched and read by an LLM. Copy the prompt below and paste it into ChatGPT, Claude, Cursor or any agent with web access — it asks the agent to read the file before helping you.
Code snippets
curl -X POST https://api.searchops.io/v1/generate \
-H "Content-Type: application/json" \
-H "x-api-key: sk_live_YOUR_KEY" \
-d '{
"input_type": "markdown",
"content": "# Hello\n\nThis is **bold** text.",
"response_format": "file",
"filename": "hello"
}' \
--output hello.docxconst res = await fetch('https://api.searchops.io/v1/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.DOCXAPI_KEY,
},
body: JSON.stringify({
input_type: 'markdown',
content: '# Hello\n\nThis is **bold** text.',
response_format: 'file',
filename: 'hello',
}),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { writeFile } = await import('node:fs/promises');
await writeFile('hello.docx', Buffer.from(await res.arrayBuffer()));import os, requests
r = requests.post(
"https://api.searchops.io/v1/generate",
headers={"x-api-key": os.environ["DOCXAPI_KEY"]},
json={
"input_type": "markdown",
"content": "# Hello\n\nThis is **bold** text.",
"response_format": "file",
"filename": "hello",
},
timeout=60,
)
r.raise_for_status()
open("hello.docx", "wb").write(r.content)There is no SDK to install and no client library to keep in sync. The contract is one endpoint with five fields.
Make and Zapier
Use a generic HTTP module:
- Method
POST, URLhttps://api.searchops.io/v1/generate - Header
x-api-keywith your key - JSON body with
content,input_typeandresponse_format - When using
format: "file", set the module to parse the response as a binary file, not as JSON
If your tool cannot handle binary responses, use base64 and decode it in a following step, or use url and let the tool download the link.
Picking a response format in code
- Writing to disk or piping onward →
file. No decoding, lowest overhead. - Storing in a database or queue →
base64. It travels as JSON. - Emailing a link or showing it in a UI →
url. Valid for 24 hours; treat the URL as a secret, because the UUID is the only thing protecting it.
Errors and retries
Errors always use the same envelope, so one handler covers every case:
{ "error": { "code": "CREDITS_EXHAUSTED", "message": "Monthly credit limit reached." } }async function generate(body, attempt = 1) {
const res = await fetch('https://api.searchops.io/v1/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': KEY },
body: JSON.stringify(body),
});
if (res.ok) return Buffer.from(await res.arrayBuffer());
// Transient: back off and retry. Everything else needs a fix, not a retry.
if ([429, 503, 504].includes(res.status) && attempt < 4) {
await new Promise(r => setTimeout(r, 2 ** attempt * 500));
return generate(body, attempt + 1);
}
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message}`);
}Every response carries an X-Request-Id header. Log it — it is what identifies a specific request if you need to report a problem.
Keeping the key safe
- Call the API from a server, a serverless function or your n8n instance — never from a browser.
- Keep the key in an environment variable, not in source control.
- Rotate it from the dashboard if it leaks; rotation issues a new secret and invalidates the old one immediately.
- Domain restrictions on a key only affect requests that carry an
OriginorRefererheader. Server-to-server calls are unaffected by design.