DocLab API reference

Use your deployment’s API origin with the paths below. Send one credential: X-Api-Key: <key> or Authorization: Bearer <access-token>. See authentication.

Endpoints

Method Path Request Permission
GET /api/v1/capabilities None documents.read
POST /api/v1/templates/inspect JSON template documents.read
POST /api/v1/templates/inspect-upload Multipart template, format documents.read
POST /api/v1/documents/generate JSON template, options documents.generate
POST /api/v1/documents/generate-upload Multipart template, format, options JSON documents.generate
POST /api/v1/documents/convert JSON document, options documents.generate
POST /api/v1/documents/convert-upload Multipart document, format, options JSON documents.generate
POST /api/v1/connector/generate Base64 content, format settings, fieldsJson string documents.generate

Inspect a template

{
  "template": {
    "contentBase64": "<base64-encoded file bytes>",
    "format": "Docx"
  }
}
                

format is Docx, Xlsx, or Pdf and must match the actual file. Inspection does not modify the template. For multipart inspection, send the file as template and the format as format.

Generate a document

{
  "template": {
    "contentBase64": "<base64-encoded DOCX template>",
    "format": "Docx"
  },
  "options": {
    "outputFormat": "Docx",
    "delivery": "Binary",
    "disposition": "Attachment",
    "fileName": "invoice",
    "missingFields": "Preserve",
    "fields": [
      { "name": "CustomerName", "kind": "Text", "text": "Cloudwell" }
    ]
  }
}
                

Send to /api/v1/documents/generate. Use names discovered by inspection, with the correct typed values. The multipart equivalent accepts the template file, format, and generation options serialized as JSON.

Convert an existing file

{
  "document": {
    "contentBase64": "<base64-encoded DOCX bytes>",
    "format": "Docx"
  },
  "options": {
    "outputFormat": "Pdf",
    "delivery": "Binary",
    "disposition": "Attachment",
    "fileName": "converted"
  }
}
                

Send to /api/v1/documents/convert. DOCX and XLSX conversion require an enabled, available renderer. Conversion does not populate fields, so its field/replacement counts are zero. PDF-to-Office and cross-Office conversions are unsupported.

Delivery and diagnostics

  • Binary returns file bytes with a content type and filename. Diagnostic headers are X-Document-Field-Count, X-Document-Replacement-Count, and, when present, X-Document-Warnings.
  • Json returns base64 content, content type, filename, field/replacement counts, and warnings in the body.
  • Preview returns expiring links when enabled. Office previews require explicit allowExternalPreview: true consent. See output and previews.

Field counts describe discovered template occurrences; replacement counts include processed repeating rows. Responses are no-store. Processing errors use Problem Details with a stable code and traceId. See the status-code guide.

Capability discovery and interactive reference

  • Query /api/v1/capabilities before offering optional conversion features. Enabled configuration is not a renderer health guarantee.
  • Query /api/v1/previews/capabilities for preview availability.
  • Get the deployed OpenAPI specification at /openapi/v1.json. It is anonymous only in Development; production access requires documents.read.
  • The interactive /docs API workbench is Development-only. Document operations remain authenticated there.
  • /health/live is an anonymous liveness endpoint, not proof that generation or external dependencies are healthy.