Quickstart (Node.js)
5-step quickstart to render a template from Node.js.
Quickstart — Node.js (5 steps)
This quickstart assumes you have a Papier account and access to a Project in the web UI.
- Install the SDK
npm install @papier/sdk- Create an API key
- In the Papier web UI go to Project → Settings → API Keys and create a key scoped to the environment you will use (staging/production).
- Store the key in an environment variable locally:
export PAPIER_API_KEY=sk_test_...- Make a template in the UI
- Open the Editor and click “New Template”.
- Add fields via the Schema panel (for example:
name: string,items: array). - Save and create a version (Draft → Create Version).
- Render from Node
Create a small script to render the template.
import Papier from '@papier/sdk'
const client = new Papier({ apiKey: process.env.PAPIER_API_KEY })
async function main() {
const result = await client.render({
templateId: 'tmpl_123',
version: 'v1',
data: { name: 'Alex', items: [{ title: 'One' }] },
})
console.log(result.html)
}
main().catch(console.error)- Promote a version
- From the Versions panel in the UI promote the tested version to
stagingorproduction. - Use environment-specific API keys in your deployments.
Optional: set up webhooks to receive render.completed or version.promoted events (see Webhooks).