Skip to main content

Preview PDF Template

POST 

/api/pdf-templates/:id/preview

Renders a preview of draft template content without saving it.

Required scope: settings:write

Grant 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 in data.pdf; html returns rendered markup in data.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 when sample_record_id is 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

OK

Response Headers
    Content-Type