API documentation - Endpoints

Render template

Render and HTML or PDF template with your dynamic data.

POST
/templates/{templateId}/render

Request JSON body

Basically, you can pass any data you want to render in the template. The data will be used to replace the variables in the template. Read more about variables in the Dynamic variables section.

Successful response

Successful response, you will return the rendered subject, html and text as a JSON response.

Please note, that in the case of PDF rendering, the response will be a binary stream with Content-Type set to application/pdf.

HTTP status codes

Code Name Description
200 OK Request was accepted successfully
400 Bad Request Requested template has invalid syntax and cannot be rendered
401 Unauthorized Request without a token, or token is invalid
404 Not Found Template with provided {templateId} does not exist

Request example:

curl -X POST "https://api.templid.com/v1/templates/{templateId}/render" \
-H "Authorization: Bearer {YOUR_TOKEN_HERE}" \
-H "Content-type: application/json" \
-d '{
      "name": "John Doe",
      "amount": 44.99
    }'

Response example:

{
  "subject": "John Doe, we have received your order",
  "html": "<h1>Hello John Doe</h1><p>Your amount due is: $44.99</p>",
  "text": "Hello John Doe\n\nYour amount due is: $44.99"
}