Generate images and PDFs programmatically using our REST API
All API requests require authentication using an API key. You can create and manage your API keys in your account dashboard .
You can authenticate in two ways:
1. Using X-API-Key Header
X-API-Key: your_api_key_here2. Using Authorization Bearer Token
Authorization: Bearer your_api_key_hereTemplates On provides two main endpoints for generating images and PDFs from templates.
Generate PNG images from templates or simple text parameters.
Endpoint
https://your-domain.com/api/v1/imageUse a saved template and optionally override its parameters.
Parameters
templateId (required) - UUID of the template [paramName] (optional) - Any template parameter to override Example (cURL)
curl -X POST https://your-domain.com/api/v1/image \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"templateId": "123e4567-e89b-12d3-a456-426614174000",
"name": "John Doe",
"title": "Software Engineer"
}' \
--output image.pngExample (JavaScript)
const response = await fetch('https://your-domain.com/api/v1/image', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
templateId: '123e4567-e89b-12d3-a456-426614174000',
name: 'John Doe',
title: 'Software Engineer',
}),
});
const blob = await response.blob();
const url = URL.createObjectURL(blob);
// Use the image URLGenerate simple text images without creating a template.
Parameters
content (optional) - Text content (default: "Hello World") width (optional) - Image width in pixels (default: 800, max: 4096) height (optional) - Image height in pixels (default: 600, max: 4096) fontSize (optional) - Font size (default: 32, min: 8, max: 400) fontWeight (optional) - Font weight (default: 400) color (optional) - Text color hex (default: "#000000") backgroundColor (optional) - Background color hex (default: "#ffffff") textAlign (optional) - Text alignment: left, center, right (default: "center") padding (optional) - Padding in pixels (default: 40) Example (GET Request)
curl "https://your-domain.com/api/v1/image?content=Hello%20World&width=1200&height=630&fontSize=48&color=%23ffffff&backgroundColor=%23000000" \
-H "X-API-Key: your_api_key_here" \
--output image.pngExample (POST Request)
const response = await fetch('https://your-domain.com/api/v1/image', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
content: 'Hello World',
width: 1200,
height: 630,
fontSize: 48,
color: '#ffffff',
backgroundColor: '#000000',
}),
});
const blob = await response.blob(); Returns a PNG image file with Content-Type: image/png
Generate PDF documents from templates or simple text parameters.
Endpoint
https://your-domain.com/api/v1/pdfThe PDF endpoint works identically to the Image endpoint, with the same parameters and modes. The only difference is that it returns a PDF file instead of a PNG image.
Example (Template Mode)
curl -X POST https://your-domain.com/api/v1/pdf \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"templateId": "123e4567-e89b-12d3-a456-426614174000",
"name": "John Doe"
}' \
--output document.pdfExample (Query Parameter Mode)
curl "https://your-domain.com/api/v1/pdf?content=Hello%20PDF&width=800&height=600" \
-H "X-API-Key: your_api_key_here" \
--output document.pdf Returns a PDF file with Content-Type: application/pdf
The API returns standard HTTP status codes and JSON error responses.
Error Response Format
{
"statusCode": 400,
"statusMessage": "Bad Request",
"message": "Validation failed: content: Content is required"
}400 Bad Request
Invalid parameters or validation errors. Check your request parameters.
401 Unauthorized
Invalid or missing API key. Provide a valid API key via X-API-Key header or Authorization Bearer token.
403 Forbidden
Template access denied. The template is private and belongs to another user.
404 Not Found
Template does not exist. Check the template ID and try again.
413 Payload Too Large
Generated file exceeds 10MB limit. Reduce dimensions or complexity.
429 Too Many Requests
Rate limit exceeded. Upgrade your plan or wait for the limit to reset.
500 Internal Server Error
Server error during generation. Contact support if the issue persists.
504 Gateway Timeout
Request timed out after 30 seconds. Try reducing dimensions or complexity.
API rate limits are enforced based on your subscription plan. When you exceed your limit, you'll receive a 429 error response.
Rate Limit Headers
Check these response headers to monitor your usage:
X-RateLimit-Limit - Your total rate limit X-RateLimit-Remaining - Remaining requests X-RateLimit-Reset - When the limit resets To increase your rate limits, upgrade your subscription plan in your account settings .
If you have questions or need assistance with the API, feel free to reach out: