Skip to main content

Generate DOCX Markup

This workflow produces a redlined Word document that highlights the differences between two versions of a contract — a benchmark (your reference) and a target (the document under review).

DOCX only

Both documents must be .docx files. PDFs, scanned documents, and other formats are not supported by this endpoint.

Overview

1. Generate the redlined DOCX → POST /reports/instant (returns a .docx)
2. (Optional) Convert to PDF → POST /reports/instant/export (returns a .pdf)

All requests require x-api-key, x-workspace-id, and x-app-name headers. See Authentication.


Step 1 — Generate the redlined DOCX

Submit a benchmark document and a target document. The endpoint compares them and returns the redlined DOCX directly as the response body.

API Reference: POST /reports/instant

POST /reports/instant
Content-Type: multipart/form-data

For each slot you must provide exactly one of: an uploaded file or an existing workspace document ID.

FieldTypeDescription
benchmarkDocumentfile (.docx)The reference document — uploaded directly
benchmarkDocumentIdstringID of a benchmark already in the workspace
targetDocumentfile (.docx)The document under review — uploaded directly
targetDocumentIdstringID of a target already in the workspace

Option A — upload both files directly

curl -X POST https://api.your-domain.com/reports/instant \
-H "x-api-key: YOUR_API_KEY" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "x-app-name: my-app" \
-F "benchmarkDocument=@benchmark.docx" \
-F "targetDocument=@target.docx" \
--output redlined.docx

Response (200): The response body is the redlined DOCX as a binary stream. Use --output redlined.docx (curl) or equivalent to save it.

Option B — reference existing workspace documents

curl -X POST https://api.your-domain.com/reports/instant \
-H "x-api-key: YOUR_API_KEY" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "x-app-name: my-app" \
-F "benchmarkDocumentId=10234" \
-F "targetDocumentId=10567"

Option C — mix upload and workspace document

curl -X POST https://api.your-domain.com/reports/instant \
-H "x-api-key: YOUR_API_KEY" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "x-app-name: my-app" \
-F "benchmarkDocumentId=10234" \
-F "targetDocument=@negotiated-draft.docx"

Step 2 — Convert to PDF (optional)

Step 1 already gives you the redlined DOCX. If you also need a PDF, pass that DOCX to the export endpoint. It always returns a PDF — either the full document or only the pages containing tracked changes.

API Reference: POST /reports/instant/export

POST /reports/instant/export
Content-Type: multipart/form-data
FieldTypeDescription
documentfile (.docx)The redlined DOCX from Step 1
formatstringpdf (default) or pdf_changed_pages
format valueDescription
pdfFull document rendered as PDF
pdf_changed_pagesOnly pages containing tracked insertions or deletions
curl -X POST https://api.your-domain.com/reports/instant/export \
-H "x-api-key: YOUR_API_KEY" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "x-app-name: my-app" \
-F "document=@redlined.docx" \
-F "format=pdf_changed_pages" \
--output changes.pdf

Response (200): The response body is the PDF as a binary stream. Use --output (curl) or equivalent to save it to disk.