Render PDF from Template

The PDF generation endpoint of our API allows you to dynamically create PDF documents based on pre-defined templates. By sending a POST request to the /api/templates/{templateId}/pdf endpoint.

URL parameters

Replace {templateId} in the URL with the identifier of the template you wish to render.


Template ID

The templateId parameter in the URL is a required parameter that identifies the PDF template to be used for generating the PDF. You can find the template identifier in the template index page.

Accept Header

The Accept header is used to specify the format of the response. The API supports the following formats:

  • application/pdf - The API will respond with a PDF file in the response body.
  • application/json - The API will respond with a JSON object containing two keys: status and data. The status key will contain the HTTP status code of the response, and the data contains the PDF file encoded as a base64 string.

Request body


The data parameter is sent through the request payload. It should contain key-value pairs representing the data to be replaced in the template. The keys should match the placeholders you defined in the PDF template.

Example of the data parameter in the request body:

curl -X POST "{templateId}/pdf" \
-H "Content-Type: application/json" \
-H "Accept: application/pdf" \
-H "Authorization: Bearer {token}"
-d '{
    "data": {
        "name": "John Doe",
        "order_id": "ABC123",
        "total": "$ 120.00",

When using dynamic tables with a repeatable row, the "data" should contain an array of objects, where each object represents a row in the table. The keys in the objects should match the placeholders in the table row.

    "data": {
        "invoice_items": [
            { "name": "Item 1", "qty": "2", "price": "$ 120.00" },
            { "name": "Item 2", "qty": "1", "price": "$ 65.00" }


Upon successful generation of the PDF, the API will respond with a PDF file in the response body. The "Content-Type" header of the response will indicate the type of the file ("application/pdf").

In case of any errors during the generation process, appropriate error codes and messages will be provided in the response.