Sample request
cURL
curl --location --request GET 'https://api.pdf.co/v1/templates/html' \
--header 'Content-Type: application/json' \
--header 'x-api-key: *******************' \
--data-raw ''
{
"credits": 2,
"remainingCredits": 88470,
"templates": [
{
"description": "Simple invoice template using Mustache macros.",
"id": 1,
"test_json": "{ \"paid\": true }",
"title": "Simple Invoice",
"type": "system",
"updated_at": "2022-10-12T12:15:29.075Z"
},
{
"description": "",
"id": 15,
"test_json": "{ \"paid\": true }",
"title": "User Template 1",
"type": "user",
"updated_at": "2024-03-01T10:00:00.000Z"
}
]
}
{
"error": true,
"status": 400,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}
{
"error": true,
"status": 401,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}
{
"error": true,
"status": 402,
"message": "Not enough credits."
}
{
"error": true,
"status": 404,
"message": "The requested resource could not be found."
}
{
"error": true,
"status": 429,
"message": "Too many requests in a given time period."
}
{
"error": true,
"status": 500,
"message": "Something went wrong. Please try again or contact support."
}
cURL
curl --location --request GET 'https://api.pdf.co/v1/templates/html' \
--header 'Content-Type: application/json' \
--header 'x-api-key: *******************' \
--data-raw ''
{
"credits": 2,
"remainingCredits": 88470,
"templates": [
{
"description": "Simple invoice template using Mustache macros.",
"id": 1,
"test_json": "{ \"paid\": true }",
"title": "Simple Invoice",
"type": "system",
"updated_at": "2022-10-12T12:15:29.075Z"
},
{
"description": "",
"id": 15,
"test_json": "{ \"paid\": true }",
"title": "User Template 1",
"type": "user",
"updated_at": "2024-03-01T10:00:00.000Z"
}
]
}
{
"error": true,
"status": 400,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}
{
"error": true,
"status": 401,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}
{
"error": true,
"status": 402,
"message": "Not enough credits."
}
{
"error": true,
"status": 404,
"message": "The requested resource could not be found."
}
{
"error": true,
"status": 429,
"message": "Too many requests in a given time period."
}
{
"error": true,
"status": 500,
"message": "Something went wrong. Please try again or contact support."
}
PDF from HTML
Return All Templates
Create PDF’s from HTML template input.
Sample request
cURL
curl --location --request GET 'https://api.pdf.co/v1/templates/html' \
--header 'Content-Type: application/json' \
--header 'x-api-key: *******************' \
--data-raw ''
{
"credits": 2,
"remainingCredits": 88470,
"templates": [
{
"description": "Simple invoice template using Mustache macros.",
"id": 1,
"test_json": "{ \"paid\": true }",
"title": "Simple Invoice",
"type": "system",
"updated_at": "2022-10-12T12:15:29.075Z"
},
{
"description": "",
"id": 15,
"test_json": "{ \"paid\": true }",
"title": "User Template 1",
"type": "user",
"updated_at": "2024-03-01T10:00:00.000Z"
}
]
}
{
"error": true,
"status": 400,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}
{
"error": true,
"status": 401,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}
{
"error": true,
"status": 402,
"message": "Not enough credits."
}
{
"error": true,
"status": 404,
"message": "The requested resource could not be found."
}
{
"error": true,
"status": 429,
"message": "Too many requests in a given time period."
}
{
"error": true,
"status": 500,
"message": "Something went wrong. Please try again or contact support."
}
cURL
curl --location --request GET 'https://api.pdf.co/v1/templates/html' \
--header 'Content-Type: application/json' \
--header 'x-api-key: *******************' \
--data-raw ''
{
"credits": 2,
"remainingCredits": 88470,
"templates": [
{
"description": "Simple invoice template using Mustache macros.",
"id": 1,
"test_json": "{ \"paid\": true }",
"title": "Simple Invoice",
"type": "system",
"updated_at": "2022-10-12T12:15:29.075Z"
},
{
"description": "",
"id": 15,
"test_json": "{ \"paid\": true }",
"title": "User Template 1",
"type": "user",
"updated_at": "2024-03-01T10:00:00.000Z"
}
]
}
{
"error": true,
"status": 400,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}
{
"error": true,
"status": 401,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}
{
"error": true,
"status": 402,
"message": "Not enough credits."
}
{
"error": true,
"status": 404,
"message": "The requested resource could not be found."
}
{
"error": true,
"status": 429,
"message": "Too many requests in a given time period."
}
{
"error": true,
"status": 500,
"message": "Something went wrong. Please try again or contact support."
}
Try it live: Return All Templates → API Tester — send a real request from your browser.
GET /v1/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.
No query parameters accepted.
Responses
The JSON below is a simplified example, not a complete account dump. It shows one system template and one user template. A live response includes all system templates plus any user templates on the account. List items do not includebody; fetch HTML with Return HTML Template by ID.
Synchronous response
{
"credits": 2,
"remainingCredits": 88470,
"templates": [
{
"description": "Simple invoice template using Mustache macros.",
"id": 1,
"test_json": "{ \"paid\": true }",
"title": "Simple Invoice",
"type": "system",
"updated_at": "2022-10-12T12:15:29.075Z"
},
{
"description": "",
"id": 15,
"test_json": "{ \"paid\": true }",
"title": "User Template 1",
"type": "user",
"updated_at": "2024-03-01T10:00:00.000Z"
}
]
}
| Field | Type | Description |
|---|---|---|
credits | integer | Number of credits consumed by the request |
remainingCredits | integer | Number of credits remaining in the account |
templates | array[object] | HTML templates available to the account. List items do not include body. |
id | integer | Template ID. |
title | string | Template title. |
description | string | Template description. |
type | string | Template type (system or user). |
test_json | string | Sample JSON data used to fill the template. |
updated_at | string | Timestamp when the template was last updated. |
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.Was this page helpful?