Generate a Word document

Markdown
POST /v1/documents

Use this endpoint when you already have structured findings and impression and want to format them as a Word document. It fills an owned, saved template using the report text you provide. It does not transcribe audio or generate a Technique section for you.

Read your template to obtain template_id and template_revision. Send these with a report object containing ordered findings and impression arrays. Include an active API key and a new Idempotency-Key. The successful response is a .docx attachment, not a JSON object.

Fill the optional fields

Optional top-level patient_name, date_of_birth, referring_physician, patient_id, and date_of_study fields override the matching values from report for this Word document only. If omitted, the values from report are used. Optional technique, exam_title, clinical_history, and comparison fields fill their matching placeholders. Pass the Technique result’s technique text when you have generated it separately. Include review_flags from your source report so they remain visible in the document.

The saved template revision supplies the document layout and Findings/Impression formatting controls. List items become Word paragraphs, and the rest of the template retains its formatting. The API preserves review flags even if the template has no designated placeholder for them.

Save the response and handle retries

Save a successful response body directly as a Word file, up to 4,000,000 bytes. Check the status and Content-Type first so an error JSON response is not saved as a .docx. Identical retries with the same API key and Idempotency-Key can download the saved document for 24 hours after completion, even if the template has since changed or been deleted.

Changing any input requires a new request key. After the recovery window, the original key cannot start another generation. Request status with operation=documents.render reports state only; it does not return the Word file.

Working with Word templates

Requests, retries, and downloads

Authentication

Create a named API key in your workspace’s API keys tab, then send it in the Authorization header on each API request. Your key connects the integration to that workspace’s saved settings and Word templates. Signing into the website does not replace this header in an API integration.

Authorization: Bearer <API_KEY>

Keep the key in your application’s server-side secret configuration. It is shown only once when created, so save it securely then. Do not place it in browser code, logs, version control, or a prompt sent to your coding agent. You can revoke an integration’s key from the workspace without changing the other keys.

Parameters

NameTypeRequiredConstraintsDescription
Idempotency-Keyheader: stringYes——

Request

application/json
NameTypeRequiredConstraintsDescription
template_idstringYespattern="^[a-f0-9]{32}$"ID of a Word template owned by your workspace, returned by upload or listing.
template_revisionintegerYesminimum=1.0Saved template revision to use. Read the template to obtain its current revision.
reportDocumentReportYes—The structured findings, impression, and review flags to place into the Word document.
techniquestringNomaxLength=20000; default=""Optional Technique text to fill the matching placeholder; this endpoint does not generate it.
patient_namestring | nullNo—Optional override for the patient name in this Word document. When omitted, uses report.patient_name.
date_of_birthstring | nullNo—Optional override for the date of birth in this Word document. When omitted, uses report.date_of_birth.
referring_physicianstring | nullNo—Optional override for the referring physician in this Word document. When omitted, uses report.referring_physician.
patient_idstring | nullNo—Optional override for the patient ID in this Word document. When omitted, uses report.patient_id.
date_of_studystring | nullNo—Optional override for the date of study in this Word document. When omitted, uses report.date_of_study.
exam_titlestringNomaxLength=20000; default=""Optional examination title for the Exam title placeholder.
clinical_historystringNomaxLength=20000; default=""Optional supplied clinical history for the matching placeholder.
comparisonstringNomaxLength=20000; default=""Optional supplied comparison wording for the matching placeholder.

Request examples

{
  "exam_title": "Example exam",
  "report": {
    "findings": [
      "Example finding."
    ],
    "impression": [
      "Example impression."
    ]
  },
  "template_id": "00000000000000000000000000000000",
  "template_revision": 1
}

Example

BASE_URL=https://radiologydictation.com

curl --request POST "$BASE_URL/v1/documents" \
  --header "Authorization: Bearer $API_KEY" \
  --header "Idempotency-Key: $REQUEST_ID" \
  --header "Content-Type: application/json" \
  --data '{"exam_title": "Example exam", "report": {"findings": ["Example finding."], "impression": ["Example impression."]}, "template_id": "00000000000000000000000000000000", "template_revision": 1}' \
  --output report.docx

Responses

StatusDescriptionType
200Successful Responsestring (binary) · application/vnd.openxmlformats-officedocument.wordprocessingml.document
401Invalid or missing API keyobject · application/json
429Too many attempts. Please try again later.object · application/json
503Service is unavailable. Please try again.object · application/json
404Template not found.object · application/json
409This idempotency key was already used for different input.object · application/json
413Word template exceeds the configured limits.object · application/json
422Invalid Word template.object · application/json
400Idempotency-Key header requiredobject · application/json
415JSON request required.object · application/json
500Document generation failed.object · application/json
502Document generation failed.object · application/json

Response headers · 200

HeaderTypeDescription
Content-Dispositionstring—
X-Request-Idstring—
X-Template-Versionstring—
X-Template-Hashstring—
X-Review-Flagsstring—

Response headers · 429

HeaderTypeDescription
Retry-Afterstring—

Response headers · 502

HeaderTypeDescription
X-Request-IdstringServer request identifier for support.
X-Request-StatusstringRequest outcome status.

Schemas

DocumentReport

NameTypeRequiredConstraintsDescription
schema_versionstringNodefault="1.2"—
standard_idstring | nullNo——
techniquestringNomaxLength=20000; default="Not provided."—
patient_namestringNomaxLength=20000; default="Not provided."—
date_of_birthstringNomaxLength=20000; default="Not provided."—
referring_physicianstringNomaxLength=20000; default="Not provided."—
patient_idstringNomaxLength=20000; default="Not provided."—
date_of_studystringNomaxLength=20000; default="Not provided."—
findingsarray<string>YesmaxItems=200—
impressionarray<string>YesmaxItems=100—
review_flagsarray<ReviewFlag>NomaxItems=100—
transcriptionTimestampedTranscript | nullNo——

DocumentRequest

NameTypeRequiredConstraintsDescription
template_idstringYespattern="^[a-f0-9]{32}$"ID of a Word template owned by your workspace, returned by upload or listing.
template_revisionintegerYesminimum=1.0Saved template revision to use. Read the template to obtain its current revision.
reportDocumentReportYes—The structured findings, impression, and review flags to place into the Word document.
techniquestringNomaxLength=20000; default=""Optional Technique text to fill the matching placeholder; this endpoint does not generate it.
patient_namestring | nullNo—Optional override for the patient name in this Word document. When omitted, uses report.patient_name.
date_of_birthstring | nullNo—Optional override for the date of birth in this Word document. When omitted, uses report.date_of_birth.
referring_physicianstring | nullNo—Optional override for the referring physician in this Word document. When omitted, uses report.referring_physician.
patient_idstring | nullNo—Optional override for the patient ID in this Word document. When omitted, uses report.patient_id.
date_of_studystring | nullNo—Optional override for the date of study in this Word document. When omitted, uses report.date_of_study.
exam_titlestringNomaxLength=20000; default=""Optional examination title for the Exam title placeholder.
clinical_historystringNomaxLength=20000; default=""Optional supplied clinical history for the matching placeholder.
comparisonstringNomaxLength=20000; default=""Optional supplied comparison wording for the matching placeholder.

ReviewFlag

NameTypeRequiredConstraintsDescription
issuestringYes—What needs review.
transcript_excerptstringYes—Relevant source transcript text.
audio_start_secondsnumber | nullNo—Start time in seconds, when available.
audio_end_secondsnumber | nullNo—End time in seconds, when available.

TimestampedTranscript

NameTypeRequiredConstraintsDescription
textstringYes——
wordsarray<TranscriptWord>Yes—Word timestamps in seconds from the beginning of the audio.

TranscriptWord

NameTypeRequiredConstraintsDescription
wordstringYes——
startnumberYesminimum=0.0Word start time in seconds from the beginning of the audio.
endnumberYesexclusiveMinimum=0.0Word end time in seconds from the beginning of the audio.

Select and copy