Documents API
Mirqam Documents is a separate service for real PDF generation with selectable text and automatic page flow.
Clients do not upload HTML or CSS. They create guided JSON templates in the app, publish them, then render by template_id.
text
https://documents.api.mirqam.net
Note
The image render service stays raster-only. Real multi-page PDF generation lives in the documents service.
Create a template
EndpointPOST/v1/document-templates
bash
curl -sS -X POST "https://documents.api.mirqam.net/v1/document-templates" \
-H "Authorization: Bearer ak_live_********" \
-H "Content-Type: application/json" \
-d '{"name":"Acme Invoice"}'
curl -sS -X POST "https://documents.api.mirqam.net/v1/document-templates" \
-H "Authorization: Bearer ak_live_********" \
-H "Content-Type: application/json" \
-d '{"name":"SaaS Invoice","starter_id":"saas_subscription"}'
Update the draft
EndpointPUT/v1/document-templates/{template_id}/draft
Send guided JSON only, for example:
directionthemebrandingsectionstable_columnslabelsfooterterms
Use direction: "rtl" for right-to-left PDF layouts and direction: "ltr" for left-to-right layouts.
Publish the template
EndpointPOST/v1/document-templates/{template_id}/publish
Published versions are immutable. Public renders always use the latest published version.
Fetch the canonical render contract
EndpointGET/v1/document-templates/{template_id}/contract
Invoice templates expose stable top-level fields:
sellercustomerinvoiceitemstotalsnotesterms
Preview a draft
EndpointPOST/v1/document-templates/{template_id}/preview
bash
curl -sS -X POST "https://documents.api.mirqam.net/v1/document-templates/<TEMPLATE_ID>/preview" \
-H "Authorization: Bearer ak_live_********" \
-H "Content-Type: application/json" \
-d @preview-request.json \
--output preview.pdf
Render a published document
EndpointPOST/v1/documents/render
bash
curl -sS -X POST "https://documents.api.mirqam.net/v1/documents/render" \
-H "Authorization: Bearer ak_live_********" \
-H "Content-Type: application/json" \
-d @render-request.json \
--output invoice.pdf