API Reference
Complete reference for the TemplateFox API.
Base URL
https://api.pdftemplateapi.comAuthentication
All requests require an API key passed in the x-api-key header.
x-api-key: YOUR_API_KEYEndpoints
POST /v1/pdf/create
Generate a PDF from a template.
Request
| Field | Type | Required | Description |
|---|---|---|---|
template_id | string | Yes | The 12-character template ID |
data | object | Yes | Key-value pairs for template variables |
export_type | string | No | "url" (default) or "binary" |
expiration | number | No | URL expiration in seconds (default: 86400 = 24h, min: 60, max: 604800 = 7 days). Only applies to "url" export type. |
Example Request
curl -X POST https://api.pdftemplateapi.com/v1/pdf/create \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": "HMQywVpZxqAM",
"data": {
"customer_name": "John Doe",
"invoice_number": "INV-001",
"amount": "$1,234.56",
"date": "2026-01-05"
},
"export_type": "url",
"expiration": 86400
}'Response (export_type: url)
{
"url": "https://storage.pdftemplateapi.com/generated/abc123.pdf",
"credits_remaining": 29,
"expires_in": 86400
}| Field | Type | Description |
|---|---|---|
url | string | Signed URL to the generated PDF |
credits_remaining | number | Number of PDF generations remaining in your plan |
expires_in | number | Seconds until the URL expires |
Response (export_type: binary)
Returns the PDF file directly as application/pdf.
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_REQUEST | Missing or invalid request parameters |
| 401 | UNAUTHORIZED | Invalid or missing API key |
| 403 | FORBIDDEN | No credits remaining or plan expired |
| 404 | TEMPLATE_NOT_FOUND | Template ID not found |
| 500 | INTERNAL_ERROR | Server error |
Error Response Format
{
"error": "TEMPLATE_NOT_FOUND",
"message": "Template with ID 'xyz' not found"
}Rate Limits
| Plan | Requests/min | Requests/day |
|---|---|---|
| Free | 10 | 100 |
| Pro | 60 | 10,000 |
| Enterprise | Custom | Custom |
Rate limit headers are included in every response:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1704384000Interactive Documentation
For interactive API testing, visit our Swagger documentation:
Last updated on