REST API
The REST API is the most flexible way to integrate APITemplate.io into your application. It supports PDF generation, image generation, and template management.
Base URL
https://rest.apitemplate.io/v2/
Regional endpoints
A regional API endpoint is intended for customers in the same region. The data for the requests and generated PDFs/images are processed and stored within the region. Choose the endpoint closest to your users or the one that meets your data residency requirements.
Primary regions:
| Region | Endpoint | Max Timeout | Max Payload Size |
|---|---|---|---|
| Default (Singapore) | https://rest.apitemplate.io | 100s | 4 MB |
| Europe (Frankfurt) | https://rest-de.apitemplate.io | 100s | 4 MB |
| US East (N. Virginia) | https://rest-us.apitemplate.io | 100s | 4 MB |
| Australia (Sydney) | https://rest-au.apitemplate.io | 30s | 6 MB |
Alternative regions:
Alternative endpoints offer a higher payload size limit with a shorter timeout, useful for large requests that generate quickly.
| Region | Endpoint | Max Timeout | Max Payload Size |
|---|---|---|---|
| Default (Singapore) | https://rest-alt.apitemplate.io | 30s | 6 MB |
| Europe (Frankfurt) | https://rest-alt-de.apitemplate.io | 30s | 6 MB |
| US East (N. Virginia) | https://rest-alt-us.apitemplate.io | 30s | 6 MB |
- Payload size applies to both request and response.
- If
export_typeis set tojson, the output file is stored on AWS S3 and is not subject to the payload size limitation. - If
export_typeis set tofile, which returns binary data of the generated PDF, the file size is limited to 6 MB or 4 MB depending on the region.
Other regions are available on request — contact hello@apitemplate.io for more information.
Rate limiting
The API enforces IP-based rate limits to ensure fair usage and maintain optimal performance:
- 100 requests per 10 seconds per IP address
- 100 concurrent synchronous PDF-generation requests per user account
If you exceed these limits, you'll receive an HTTP 429 response, indicating that you've hit the rate cap. Pause briefly before retrying.
For high-volume workloads, consider using asynchronous generation to avoid hitting concurrency limits.
IP whitelisting
To ensure APITemplate.io's PDF and image generation services can retrieve any geo-restricted assets you host (e.g. images, stylesheets, fonts behind a firewall or CDN), whitelist the following outbound IP addresses:
| Region | IP Address |
|---|---|
| Singapore | 54.169.31.181/32 |
| US | 52.21.225.83/32 |
| Germany | 35.159.181.52/32 |
| Australia | 3.105.245.173/32 |
Once whitelisted, the services will be able to access your protected resources without interruption.
Authentication
Include your API key in the X-API-KEY header:
curl -H "X-API-KEY: YOUR_API_KEY" https://rest.apitemplate.io/v2/list-templates
Key endpoints
Create a PDF from a template
curl -X POST "https://rest.apitemplate.io/v2/create-pdf?template_id=TEMPLATE_ID" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"company_name": "Acme Corp", "amount": "$500"}'
Create a PDF from HTML
curl -X POST "https://rest.apitemplate.io/v2/create-pdf-from-html" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"body": "<h1>Hello World</h1><p>This is a PDF from HTML.</p>",
"css": "h1 { color: blue; }",
"settings": {
"paper_size": "A4",
"orientation": "Portrait"
}
}'
Create a PDF from a URL
curl -X POST "https://rest.apitemplate.io/v2/create-pdf-from-url" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/my-page"}'
Create an image
curl -X POST "https://rest.apitemplate.io/v2/create-image?template_id=TEMPLATE_ID" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"overrides": [
{"name": "title", "text": "Hello World"}
]
}'
List templates
curl "https://rest.apitemplate.io/v2/list-templates" \
-H "X-API-KEY: YOUR_API_KEY"
Synchronous vs asynchronous
By default, API calls are synchronous — you get the result immediately. For large or batch jobs, use asynchronous generation:
- Add
&async=trueto your request - You'll get a
transaction_refin the response - Set up a webhook to get notified when the job is done
Response format
Successful responses return JSON with a download_url:
{
"download_url": "https://rest.apitemplate.io/v2/get-pdf/...",
"download_url_png": "https://rest.apitemplate.io/v2/get-image/...",
"status": "success",
"template_id": "abc123",
"transaction_ref": "def456"
}
SDKs
Official client libraries are available for multiple languages:
| Language | Repository |
|---|---|
| Python | apitemplateio-python |
| JavaScript | apitemplateio-javascript |
| PHP | apitemplateio-php |
| C# | apitemplateio-csharp |
| Java | apitemplateio-java |
| UiPath | UIPath-Integration |
Full API reference
For the complete list of endpoints, parameters, and examples, see the API Reference v2.
You can also access the OpenAPI specification (YAML) directly for use with tools like Postman, Swagger UI, or code generators.