Skip to Content
API Reference

API Reference

Complete reference for the TemplateFox API.

Base URL

https://api.pdftemplateapi.com

Authentication

All requests require an API key passed in the x-api-key header.

x-api-key: YOUR_API_KEY

Endpoints

POST /v1/pdf/create

Generate a PDF from a template.

Request

FieldTypeRequiredDescription
template_idstringYesThe 12-character template ID
dataobjectYesKey-value pairs for template variables
export_typestringNo"url" (default) or "binary"
expirationnumberNoURL 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 }
FieldTypeDescription
urlstringSigned URL to the generated PDF
credits_remainingnumberNumber of PDF generations remaining in your plan
expires_innumberSeconds until the URL expires

Response (export_type: binary)

Returns the PDF file directly as application/pdf.


Error Codes

StatusCodeDescription
400INVALID_REQUESTMissing or invalid request parameters
401UNAUTHORIZEDInvalid or missing API key
403FORBIDDENNo credits remaining or plan expired
404TEMPLATE_NOT_FOUNDTemplate ID not found
500INTERNAL_ERRORServer error

Error Response Format

{ "error": "TEMPLATE_NOT_FOUND", "message": "Template with ID 'xyz' not found" }

Rate Limits

PlanRequests/minRequests/day
Free10100
Pro6010,000
EnterpriseCustomCustom

Rate limit headers are included in every response:

X-RateLimit-Limit: 60 X-RateLimit-Remaining: 59 X-RateLimit-Reset: 1704384000

Interactive Documentation

For interactive API testing, visit our Swagger documentation:

Open API Docs 

Last updated on