Formats

JSON → DOCX

For documents assembled by code. You describe the structure and the API renders it — no string concatenation and no Markdown escaping.

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.

Open the Markdown

https://api.searchops.io/doc/docxapi.md

content must be a string

This trips up most first attempts. content is always a string, even for JSON input — stringify your object before sending it.

JavaScript
body: JSON.stringify({
  input_type: 'json',
  content: JSON.stringify(myDocument),   // ← stringify the document itself
  response_format: 'file',
})

Passing an object directly is the usual cause of an empty document or a PANDOC_ERROR with Invalid JSON content.

Block format (recommended)

Explicit and predictable — every element is a block with a type.

document.blocks
{
  "document": {
    "title": "Project Status",
    "blocks": [
      { "type": "heading", "level": 2, "text": "Overview" },
      { "type": "paragraph", "text": "The migration finished ahead of schedule." },
      { "type": "list", "ordered": false,
        "items": ["API deployed", "DNS switched", "Monitoring active"] },
      { "type": "table",
        "headers": ["Milestone", "Status"],
        "rows": [["Migration", "Done"], ["Load test", "Pending"]] },
      { "type": "quote", "text": "Zero downtime during the cutover." },
      { "type": "page_break" },
      { "type": "heading", "level": 2, "text": "Appendix" },
      { "type": "markdown", "content": "See the **full log** in the attachment." }
    ]
  }
}
typeFieldsNotes
headinglevel (1–6, default 2), textOut-of-range level is rejected
paragraphtextPlain text
markdowncontentEscape hatch for anything no block covers
listitems, orderedordered: true gives 1. 2. 3.
tableheaders, rowsRows are arrays; missing cells become empty
quotetextMulti-line supported
page_break—Forces a new page

An unrecognised type fails the whole request with PANDOC_ERROR. That is deliberate — a silently dropped block would be worse than an explicit error.

Section format (legacy)

Simpler and still fully supported.

sections
{
  "title": "Sales Report",
  "subtitle": "January 2024",
  "sections": [
    { "heading": "Summary", "content": "Revenue grew 18% year over year." },
    { "heading": "Highlights", "items": ["New enterprise account", "Churn down 2pp"] },
    { "heading": "By region",
      "table": [
        { "Region": "North", "Total": 42000 },
        { "Region": "South", "Total": 31000 }
      ] }
  ]
}

Here table rows are objects, and the keys of the first row define the columns. Pipe characters are escaped and line breaks become <br> automatically, so values containing | will not break the table.

Which one to use

Use blocks for new work: it supports quotes, page breaks, ordered lists and mixed Markdown, and every element is explicit. The section format is shorter for simple title-plus-sections reports and remains supported for existing integrations.