GET /templates/html
Once you have obtained a template then use the PDF from HTML API with the required templateId & templateData parameters defined.
Use the dashboard to manage your HTML to PDF Templates.
Query parameters
No query parameters accepted.
Responses
| Parameter | Type | Description |
templates | array[object] | |
remainingCredits | integer | Number of credits remaining in the account |
credits | integer | Number of credits consumed by the request |
Example Payload
Example Response
To see the main response codes, please refer to the
Response Codes page.
{
"id": 1,
"type": "system",
"title": "General Invoice Template",
"description": "sample invoice template showcasing use of Mustache templates syntax for generating invoices",
"body": "<!doctype html>\r\n<html lang=\"en-US\">\r\n<head>\r\n<title>Invoice </title> \r\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css\" integrity=\"sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn\" crossorigin=\"anonymous\">\r\n</head> \r\n<body>\r\n \r\n <div style=\"border-width: 3px;border-style: solid; border-color: #008000;border-radius: 8px; color: #008000; opacity:0.4; position: absolute; z-index: 1; left:80%; top:3%; font-size: 60pt;transform: rotate(-20deg)\">\r\n PAID </div>\r\n \r\n \r\n <div class=\"container\">\r\n <div class=\"\">\r\n <div class=\"\">\r\n \r\n <!-- invoice: header begin-->\r\n <div class=\"row col-md-12\">\r\n <div class=\"col col-md-6\">\r\n <div class=\"font-weight-bold\"></div>\r\n\r\n <div class=\"\"></div>\r\n <div class=\"\"></div>\r\n <div class=\"\"></div>\r\n <div class=\"\"></div>\r\n </div>\r\n <div class=\"col col-md-6\">\r\n <div class=\"\">\r\n <div class=\"\">\r\n <span class=\"font-weight-bold\">Invoice Number:</span> \r\n </div>\r\n <div class=\"\">\r\n <span class=\"font-weight-bold\">Invoice Date:</span> \r\n </div>\r\n <div class=\"\">\r\n <span class=\"font-weight-bold\">Invoice Due Date:</span> \r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n \r\n<div class=\"row col-md-12\">\r\n <div class=\"col col-md-6\"></div>\r\n\r\n <div class=\"col col-md-6\">\r\n <div class=\"font-weight-bold footer-title\">BILL TO</div>\r\n <div class=\"\">\r\n <div class=\"\"><strong>Name:</strong> </div>\r\n <div class=\"\"><strong>Company:</strong> </div>\r\n <div class=\"\"><strong>Address:</strong> </div>\r\n <div class=\"\"><strong>Email:</strong> </div>\r\n </div>\r\n </div> \r\n </div>\r\n \r\n <div class=\"row col-md-12\">\r\n <div class=\"col col-md-12\">\r\n <table class=\"table table-striped\" cellspacing=\"0\">\r\n <thead>\r\n <tr class=\"table-head\">\r\n <th class=\"text-left\">Item</th>\r\n <th class=\"text-right\">Price</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n \r\n <tr>\r\n <td class=\"text-left\"></td>\r\n <td class=\"text-right\"></td>\r\n </tr>\r\n \r\n </tbody>\r\n </table> \r\n </div> \r\n\r\n </div>\r\n <div class=\"row col-md-12\">\r\n <div class=\"col col-md-6\">\r\n </div>\r\n <div class=\"col col-md-6 text-right\">\r\n <div style=\"margin-bottom: 10px;\">Discount: <span class=\"amount\"></span></div>\r\n <div style=\"margin-bottom: 10px;\">Tax: <span class=\"amount\"></span></div>\r\n <div class=\"font-weight-bold footer-title\">TOTAL: <span class=\"total-amount amount font-weight-bold\"></span></div> \r\n </div>\r\n \r\n </div>\r\n </div> \r\n </div>\r\n </div>\r\n <div class=\"container text-muted\"></div>\r\n </div>\r\n</body>\r\n</html>\r\n",
"remainingCredits": 99204002,
"credits": 2
}
Inconsistent URL Encoding in cURL Output: When using cURL to make API requests, the output JSON may show URL characters encoded as Unicode escape sequences. For example, the ampersand character (&) may appear as \u0026 in the cURL output. This is normal JSON encoding behavior and does not affect the validity of the URL. The URL will function correctly when used, as JSON parsers automatically decode these escape sequences. If you’re parsing the response programmatically, your JSON parser will handle this conversion automatically.
Code Samples
curl --location --request GET 'https://api.pdf.co/v1/templates/html/1' \
--header 'Content-Type: application/json' \
--header 'x-api-key: *******************' \
--data-raw ''