Skip to content

Queue render job

POST/office/render-jobs

Queues a new asynchronous document render job for a published template. The job is processed by the background worker; poll /render-jobs/{id} until status is "completed" or "failed". On completion, the resulting artifact is available via /documents/{id}/download.

Request

Request body

Content type application/json (required).

FieldTypeRequiredDescription
template_idintegerYes

ID of the published template to render.

binding_dataobjectYes

Key-value merge data matching the template's declared merge fields.

output_formatsarray of stringNo

Output formats to produce. Defaults to the template's default output formats.

reference_idstringNo

Optional external reference (e.g. "invoice:42") used to associate this job with a source record.

reference_typestringNo

Type of the referenced record (e.g. "invoice", "contract").

Example

{
  "template_id": 3,
  "binding_data": {
    "invoice_number": "INV-2026-0042",
    "client_name": "Acme Corp",
    "issue_date": "2026-04-08",
    "due_date": "2026-04-22",
    "line_items": [
      {
        "description": "Enterprise CRM licence",
        "quantity": 5,
        "unit_price": 800.0
      }
    ],
    "total": 4000.0
  },
  "output_formats": [
    "pdf"
  ],
  "reference_id": "invoice:42",
  "reference_type": "invoice"
}

Responses

202 Render job queued successfully

Content type application/json, object · OfficeRenderJobV1.

FieldTypeRequiredDescription
idintegerNo

Auto-incremented primary key.

template_idintegerNo

ID of the template used for this render job.

statusstringNo

Current lifecycle status of the render job.

One of: "queued", "processing", "completed", "failed"

output_formatsarray of stringNo

List of output formats requested for this job.

reference_idstring, nullableNo

Optional external reference identifier (e.g. "invoice:42") for linking the job to a source record.

reference_typestring, nullableNo

The type of the referenced record (e.g. "invoice", "contract").

artifactsarray of object, nullableNo

Output artifacts produced by a completed job. Null while still queued or processing.

artifacts[].formatstringNo

The output format of this artifact.

artifacts[].document_idintegerNo

ID of the document artifact (use for /documents/{id}/download).

artifacts[].size_bytesintegerNo

File size of the artifact in bytes.

error_messagestring, nullableNo

Human-readable error reason when status is "failed".

queued_atstring (date-time)No
completed_atstring (date-time), nullableNo

Example

{
  "id": 88,
  "template_id": 3,
  "status": "queued",
  "output_formats": [
    "pdf"
  ],
  "reference_id": "invoice:42",
  "queued_at": "2026-04-08T12:00:00Z",
  "completed_at": null
}

422 Validation failed — check template_id, binding_data keys, or output_formats

503 Office worker is unavailable — check /office/runtime/health

Example request

curl -X POST "https://{tenant}.faciotech.net/api/v1/office/render-jobs" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"template_id": 3, "binding_data": {"invoice_number": "INV-2026-0042", "client_name": "Acme Corp", "issue_date": "2026-04-08", "due_date": "2026-04-22", "line_items": [{"description": "Enterprise CRM licence", "quantity": 5, "unit_price": 800.0}], "total": 4000.0}, "output_formats": ["pdf"], "reference_id": "invoice:42", "reference_type": "invoice"}'
Loading