Skip to main content

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:

RegionEndpointMax TimeoutMax Payload Size
Default (Singapore)https://rest.apitemplate.io100s4 MB
Europe (Frankfurt)https://rest-de.apitemplate.io100s4 MB
US East (N. Virginia)https://rest-us.apitemplate.io100s4 MB
Australia (Sydney)https://rest-au.apitemplate.io30s6 MB

Alternative regions:

Alternative endpoints offer a higher payload size limit with a shorter timeout, useful for large requests that generate quickly.

RegionEndpointMax TimeoutMax Payload Size
Default (Singapore)https://rest-alt.apitemplate.io30s6 MB
Europe (Frankfurt)https://rest-alt-de.apitemplate.io30s6 MB
US East (N. Virginia)https://rest-alt-us.apitemplate.io30s6 MB
Payload size
  • Payload size applies to both request and response.
  • If export_type is set to json, the output file is stored on AWS S3 and is not subject to the payload size limitation.
  • If export_type is set to file, 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.

tip

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:

RegionIP Address
Singapore54.169.31.181/32
US52.21.225.83/32
Germany35.159.181.52/32
Australia3.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=true to your request
  • You'll get a transaction_ref in 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:

LanguageRepository
Pythonapitemplateio-python
JavaScriptapitemplateio-javascript
PHPapitemplateio-php
C#apitemplateio-csharp
Javaapitemplateio-java
UiPathUIPath-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.