Generation
Produce a finished document from structured input.
Generation runs the pipeline in reverse. Where extraction reads a document and returns data, generation takes data — sections, styling, a document type — and returns a rendered file with a download URL.
/generate is asynchronous and answers 201 with an ID; /generate/sync returns the document on the same connection; GET /generate/{_id} retrieves a job you started earlier, including its downloadUrl and storage details once it completes.
Generated endpoint reference
The generated reference is the source of truth for schemas and responses.
This guide keeps product-specific behavior and known endpoint limitations.
Generation is the one capability whose request carries its own webhookUrl. You can point an individual generation job at an endpoint without touching account settings — which the extraction and classification requests do not let you do.
For the templates, sections and styling options as they appear in the product, see Document Generation.
Generate document (Async)
POST /generate
Requires the X-Api-Key header. See Authentication.
Request body — application/json, required: GenerateRequest
data
array<SectionItem>
Yes
Array of sections (minimum 1 required)
format
string
"docx"
Output format (currently only 'docx' supported)
metadata
object | null
Business context metadata
style
StyleConfig | null
Styling configuration
webhookUrl
string | null
Completion webhook URL (must be HTTPS)
Nested objects
SectionItem
sectionData
object
Yes
Section-specific data
sectionKey
string
Yes
Section identifier (must be unique within the data array)
StyleConfig
fontFamily
string | null
"Calibri"
Font family
fontSize
integer | null
11
Font size (8-72)
headerFooter
boolean | null
true
Include header and footer
lenderName
string | null
Lender/company name
pageNumbers
boolean | null
true
Include page numbers
primaryColor
string | null
"1F4E79"
Primary color (hex with or without #)
secondaryColor
string | null
Secondary color (hex with or without #)
tableOfContents
boolean | null
false
Include table of contents
Responses
201
Created
GenerateResponse
400
Bad Request
ValidationError
401
Authentication required — the X-Api-Key header is missing or invalid.
Example
Synchronous document generation
POST /generate/sync
Requires the X-Api-Key header. See Authentication.
Request body — application/json, required: GenerateRequest
data
array<SectionItem>
Yes
Array of sections (minimum 1 required)
format
string
"docx"
Output format (currently only 'docx' supported)
metadata
object | null
Business context metadata
style
StyleConfig | null
Styling configuration
webhookUrl
string | null
Completion webhook URL (must be HTTPS)
Nested objects
SectionItem
sectionData
object
Yes
Section-specific data
sectionKey
string
Yes
Section identifier (must be unique within the data array)
StyleConfig
fontFamily
string | null
"Calibri"
Font family
fontSize
integer | null
11
Font size (8-72)
headerFooter
boolean | null
true
Include header and footer
lenderName
string | null
Lender/company name
pageNumbers
boolean | null
true
Include page numbers
primaryColor
string | null
"1F4E79"
Primary color (hex with or without #)
secondaryColor
string | null
Secondary color (hex with or without #)
tableOfContents
boolean | null
false
Include table of contents
Responses
200
The generated document itself, returned as application/vnd.openxmlformats-officedocument.wordprocessingml.document with Content-Disposition: attachment; filename="document.docx". This response is a binary file, not JSON — write the body to disk rather than parsing it.
400
The request body is missing or invalid.
401
Authentication required — the X-Api-Key header is missing or invalid.
Example
Get document generation details
GET /generate/{_id}
Requires the X-Api-Key header. See Authentication.
Path and query parameters
_id
path
string
Yes
Responses
200
OK
GetGenerationResponse
400
Bad Request
ValidationError
401
Authentication required — the X-Api-Key header is missing or invalid.
500
Returned for every input, with "Invalid generation ID format" — including the exact generationId returned by POST /generate. Verified against the issued UUID, a hyphen-stripped form, a prefixed form and a nil UUID. This endpoint is currently unusable; collect generated documents via POST /generate/sync or a completion webhook. Known defect.
Example
Related pages
Document Generation — the same capability through the UI.
Generate a document — a working call, end to end.
Webhook payloads — the generation completion payload and its
downloadUrl.Errors — including the unknown-ID behaviour specific to
GET /generate/{_id}.
Last updated

