Skip to main content

Preview PDF Template

POST 

/api/pdf-templates/:id/preview

Renders a preview of draft template content without saving it, using sample data.

Not yet available to API tokens

This endpoint currently requires session authentication; Personal Access Token scope support is in progress.

Authentication: Bearer Personal Access 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.
  • sales_order_id (optional): render against a real sales order's data instead of sample data. Only applied for packing-slip templates; ignored for other types.

Invalid template markup returns a 422 with the offending line rather than a server error.

Request

Responses

OK

Response Headers
    Content-Type