Call it from another service
Consume the Tuix PDF Service from your own backend, in any language, and from frontend apps through a proxy.
The API is plain HTTP with JSON, so any backend can call it. The only
requirement is the x-api-key header, which makes a backend the natural place
to render from: the key never leaves your infrastructure.
From a backend service
From a frontend app
A browser must never hold an API key, so the render itself stays where it already is: in your backend, exactly as above. The frontend only asks your own endpoint for the document.
Passing the returned url on to the browser does not work: it is an endpoint of
the Tuix PDF Service, and the browser sends neither the API key.
Download the file in your backend and serve it from there,
see Download a PDF.
Operating notes
- Batching. One request may carry many
payloads. The service renders up to five documents in parallel and answers when the whole batch is done. - Timeouts. Rendering is synchronous, so a large batch means a long request. Split large jobs, or run them in a background worker.
- Errors. One failing document fails the entire request, nothing is returned for the successful ones. On a retry, all documents in that batch are rendered again.
- Correlation.
idis echoed back on every generated document. Set it to your own entity ID to match results without relying on array order. - Keys per consumer. Give every consuming service its own API key, so one can be revoked on its own. See API Keys.