Template API
Introduction
The template API renders images or PDFs from templates you've created. The following endpoints are available:
Method | URL | Credits | Description |
---|
POST | /template | 0 | Create / update a template |
DELETE | /template?templateName={templateName} | 0 | Delete a template by its name |
POST | /template/render | 1 | Render a template |
GET | /template/render/{renderId} | 0 | Get the result of a previously rendered file |
Basic usage
Create a template
curl --location --request POST 'https://api.tailrender.com/template' \
--header 'Authorization: {{ YOUR_API_KEY_HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"templateName": "my-new-template",
"type": "pdf",
"html": "<div class=\"text-green-600\">My first template is named {{ title }}.</div>"
}'
{
"success": true,
"templateName": "my-new-template"
}
Render a template
curl --location --request POST 'https://api.tailrender.com/template/render' \
--header 'Authorization: {{ YOUR_API_KEY_HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"templateName": "my-new-template",
"props": {
"title": "My first template"
}
}'
- POST
/template/render
response
{
"id": "E1dQthkkGbacfL6prXDg",
"templateName": "my-new-template",
"props": {
"title": "My first template"
},
"status": "COMPLETED",
"result": {
"url": "https://tailrender-api.s3.amazonaws.com/pdf/E1dQthkkGbacfL6prXDg.pdf",
"pdfUrl": "https://tailrender-api.s3.amazonaws.com/pdf/E1dQthkkGbacfL6prXDg.pdf"
}
}