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

Choose the endpoint closest to your users or the one that meets your data residency requirements:

RegionBase URL
US (default)https://rest.apitemplate.io/v2/
EUhttps://rest-eu.apitemplate.io/v2/
Australiahttps://rest-au.apitemplate.io/v2/
Singaporehttps://rest-sg.apitemplate.io/v2/

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.