This guide walks you through generating a PDF document end-to-end.
Prerequisites
- A Platendoc account (sign up free)
- A published template with at least one version
- An API key with
generations:trigger and generations:read scopes
1. Get your template ID
In the portal, open your template and copy the ID from the URL or the template settings. It looks like tpl_01j8z....
2. Create a generation
The API responds immediately with a PENDING generation:
3. Poll for completion
Fetch the generation by ID until status is COMPLETED:
Most generations complete in 2–5 seconds. Poll with a 1-second interval and a 30-second timeout.
4. Download the document
The outputUrl is a pre-signed URL valid for 1 hour. Download it directly:
Full example (Node.js)
Error handling
If the generation fails, status will be FAILED and the error field describes what went wrong:
Common causes:
- Typo in a variable name
- Template has no published version
- Template was archived after the generation was created