Dynamic image and pdf generation API
Transform your data into beautiful images and PDFs with a simple API call
Templates On is a powerful image generation API and PDF generation API that transforms your templates and data into high-quality images and PDFs. Perfect for automation workflows, social media content, certificates, invoices, reports, and more.
Create a free account at templateson.com
You can either:
All API requests require authentication using an API key. Include your API key in the request headers:
Option 1: X-API-Key Header (Recommended)
X-API-Key: your_api_key_here
Option 2: Authorization Bearer Token
Authorization: Bearer your_api_key_here
Base URL: https://templateson.com/api/v1
Endpoint: POST /api/v1/image or GET /api/v1/image
Generate PNG images from templates or custom parameters.
Request:
curl -X POST https://templateson.com/api/v1/image \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "templateId": "your-template-id", "params": { "title": "Hello World", "subtitle": "Dynamic content", "date": "2024-01-15" } }'
GET Request:
curl "https://templateson.com/api/v1/image?templateId=your-template-id&title=Hello%20World" \ -H "X-API-Key: your_api_key_here"
Request:
curl -X POST https://templateson.com/api/v1/image \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "content": "Hello World", "width": 1200, "height": 630, "fontSize": 48, "color": "#ffffff", "backgroundColor": "#3B82F6" }'
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
templateId |
string | No* | - | UUID of your template (use snake_case template_id also supported) |
params |
object | No | - | Dynamic values to inject into template variables |
content |
string | No* | "Hello World" | Text content (when not using template) |
width |
number | No | 800 | Image width in pixels (100-4000) |
height |
number | No | 600 | Image height in pixels (100-4000) |
fontSize |
number | No | 32 | Font size in pixels (8-200) |
fontWeight |
number | No | 400 | Font weight (100-900) |
color |
string | No | "#000000" | Text color (hex format) |
backgroundColor |
string | No | "#ffffff" | Background color (hex format) |
textAlign |
string | No | "center" | Text alignment (left, center, right) |
padding |
number | No | 40 | Padding in pixels (0-200) |
format |
string | No | - | Set to "json" to receive base64-encoded response |
*Either templateId or content parameters must be provided
Binary Response (default):
Content-Type: image/png
[Binary PNG data]
JSON Response (format=json):
{ "success": true, "format": "png", "size": 45678, "data": "iVBORw0KGgoAAAANS...", "width": 1200, "height": 630
} Endpoint: POST /api/v1/pdf or GET /api/v1/pdf
Generate PDF documents from templates or custom parameters.
Request:
curl -X POST https://templateson.com/api/v1/pdf \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "templateId": "your-template-id", "params": { "name": "John Doe", "certificate_id": "CERT-2024-001", "date": "January 15, 2024" } }' \ --output certificate.pdf
GET Request:
curl "https://templateson.com/api/v1/pdf?templateId=your-template-id&name=John%20Doe" \ -H "X-API-Key: your_api_key_here" \ --output document.pdf
Request:
curl -X POST https://templateson.com/api/v1/pdf \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "content": "Invoice #1234", "width": 800, "height": 1100, "fontSize": 24, "color": "#000000", "backgroundColor": "#ffffff" }' \ --output invoice.pdf
Same parameters as the /image endpoint. See Image Generation Parameters above.
Binary Response (default):
Content-Type: application/pdf
Content-Disposition: inline; filename="template.pdf"
[Binary PDF data]
JSON Response (format=json):
{ "success": true, "format": "pdf", "size": 123456, "data": "JVBERi0xLjcKCjEgMC...", "width": 800, "height": 1100
} Template mode allows you to create reusable templates with dynamic variables. This is the recommended approach for production use.
{{variable_name}} syntaxDefine variables in your template:
<text>{{title}}</text>
<text>{{description}}</text>
<text>Date: {{date}}</text>
Pass values via API:
{ "templateId": "abc-123", "params": { "title": "Welcome", "description": "This is dynamic", "date": "2024-01-15" }
}
For simple use cases, you can generate images/PDFs without creating templates:
curl "https://templateson.com/api/v1/image?content=Quick%20Test&width=800&height=600&backgroundColor=%233B82F6&color=%23ffffff" \ -H "X-API-Key: your_api_key_here" \ --output test.png
curl -X POST https://templateson.com/api/v1/image \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "templateId": "social-post-template", "params": { "headline": "New Product Launch!", "description": "Check out our latest innovation", "cta": "Learn More" } }' \ --output social-post.png
curl -X POST https://templateson.com/api/v1/pdf \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "templateId": "certificate-template", "params": { "recipient_name": "Jane Smith", "course_name": "Advanced Web Development", "completion_date": "March 15, 2024", "certificate_id": "CERT-2024-12345" } }' \ --output certificate.pdf
curl -X POST https://templateson.com/api/v1/pdf \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "templateId": "invoice-template", "params": { "invoice_number": "INV-2024-001", "client_name": "Acme Corp", "amount": "$1,250.00", "due_date": "February 1, 2024" } }' \ --output invoice.pdf
const apiKey = 'your_api_key_here';
const templateId = 'your-template-id'; const response = await fetch('https://templateson.com/api/v1/image', { method: 'POST', headers: { 'X-API-Key': apiKey, 'Content-Type': 'application/json', }, body: JSON.stringify({ templateId: templateId, params: { title: 'Dynamic Title', subtitle: 'Generated with Node.js', }, }),
}); const imageBuffer = await response.arrayBuffer();
// Save or use imageBuffer as needed
import requests api_key = 'your_api_key_here'
template_id = 'your-template-id' response = requests.post( 'https://templateson.com/api/v1/image', headers={ 'X-API-Key': api_key, 'Content-Type': 'application/json', }, json={ 'templateId': template_id, 'params': { 'title': 'Dynamic Title', 'subtitle': 'Generated with Python', }, },
) with open('output.png', 'wb') as f: f.write(response.content)
curl -X POST https://templateson.com/api/v1/image \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "templateId": "your-template-id", "format": "json", "params": { "title": "Hello" } }'
Response:
{ "success": true, "format": "png", "size": 45678, "data": "iVBORw0KGgoAAAANSUhEUgAA...", "width": 1200, "height": 630
} Rate limits depend on your subscription plan, see Pricing Page
Exceeded limits return 429 Too Many Requests error.
Rate Limit Headers:
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9500
X-RateLimit-Reset: 1640995200
Templates On integrates seamlessly with popular automation platforms: