LexiFlow ยท Templates and documents

Document generation API: Word templates and JSON values

The API can generate a document from an existing template owned by the account behind your API key. Review the endpoint examples and current limits before integrating.

Generate your first document free See a complete example

Authentication and template

Create an API key in account settings. Send Authorization: Bearer YOUR_API_KEY. Use an existing template_id belonging to that account, with placeholders such as {{client_name}}. Never put a real key in frontend code or a shared example.

Generation request

POST /api/v1/documents/generate accepts template_id, variables, name and format. The example below uses fictional data and a placeholder template ID. DOCX/PDF generation requires a DOCX template; test other formats against your template type.

Response and errors

Successful generation returns HTTP 201 with status, message and data. Missing or invalid keys return 401; a template outside the account returns 404; validation errors return 422; file-generation errors return 500.

Limits and subscription relation

The API implementation currently has no dedicated per-key rate limiter or consistent document quota enforcement. The browser throttle is not an API rate-limit guarantee. Plan features include API access labels, but these are not consistently enforced by the API filter. Confirm intended usage with support before production integration.

curl -X POST https://lexiflow.eu/api/v1/documents/generate \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"template_id":123,"name":"Example offer","format":"docx","variables":{"client_name":"Example Studio","service":"Design","amount":"1200 EUR"}}'
{"status":"success","message":"Document generated successfully.","data":{"id":456,"name":"Example offer","format":"docx","file_path":"example-offer_1234567890.docx","file_size":12345}}