Documentation

API URL


POST /api/v1/document-generation/:documentType/generate

Headers
Code
Content-Type: application/json
Body Parameters


Example Request

Code
POST https://datpaq.com/api/v1/document-generation/invoice/generate?api_key=your-api-key | Body: {"mode":"filled","templateVersion":"1.0.0","data":{"invoiceNumber":"INV-2026-0042","invoiceDate":"2026-09-02","dueDate":"2026-10-02","sellerName":"Datpaq","customerName":"Example Corporation","currency":"USD","taxRate":0,"items":[{"description":"API Platform Subscription","quantity":1,"unitPrice":499}]},"output":{"type":"docx","responseType":"base64"}}

Successful Response

Status
HTML
200 OK
Body
Code
{
  "success": true,
  "docxBase64": "UEsDB...",
  "documentMetadata": {
    "documentType": "invoice",
    "templateVersion": "1.0.0",
    "mode": "filled",
    "format": "DOCX",
    "byteLength": 12345,
    "timingMs": 120
  },
  "metadata": {
    "correlationId": "req_abc123"
  }
}

Error Response

Example
Code
HTTP 400 ValidationError: Missing fields malformed data invalid template version invalid branding or invalid output selection — Request rejected before render or generation; HTTP 401 AuthenticationError: Gateway rejects missing or invalid API key — Authentication enforcement before business processing; HTTP 404 NotFound: Unknown document type or endpoint — Requested resource not available; HTTP 429 RateLimitError: Rate limiter threshold exceeded — Too many requests in active window; HTTP 503 PoolSaturated: Chromium pool at concurrency capacity — Service is temporarily busy; HTTP 500 InternalError: Unexpected render or generation failure or malformed or oversized JSON body — Unhandled generation or shared parser failure

Last Updated:  May 4, 2026