Preview PDF Template
POST/api/pdf-templates/:id/preview
Renders a preview of draft template content without saving it.
settings:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Personal Access Token (sent as a Bearer token) with the settings scope (read access).
Fields:
- content (required): the draft markup to render.
- format (optional):
pdf(default) returns a base64-encoded PDF indata.pdf;htmlreturns rendered markup indata.html. - sample_record_id (optional): render against one of your own records instead of sample data. The template's type decides what kind of record that is — a sales order, a quote, a purchase order, a pick list or a credit. Use the sample-records endpoint to list the eligible records for a template.
- destination_country (optional): render the sample data against a destination country so country-conditional sections can be seen. Accepts one of the codes in the template's
preview_destinations(US, CA, GB, AU, NZ, DE). Ignored whensample_record_idis supplied — a real record carries its own address.
Invalid template markup returns a 422 with the offending line rather than a server error.
Response:
- data.pdf: the base64-encoded document (pdf format only).
- data.html: the rendered markup (html format only).
- data.rendered_with: which engine produced this preview, so the preview can be trusted to match the printed document.
- data.warnings: page-setup problems found while rendering — a dropped footer banner, artwork too tall for the page. Empty when nothing was wrong, and always present. The html format does not run page setup, so it returns no warnings.
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.