[Go to site: main page, start]

Skip to content

TemplateFox REST API Reference

Complete reference for the TemplateFox REST API.

https://api.templatefox.com

All requests require an API key passed in the x-api-key header.

Terminal window
x-api-key: YOUR_API_KEY

Create an API key in the API keys section of your dashboard. Keys start with sk_.

Run In Postman



List all templates belonging to your team. Useful for no-code integrations (Zapier, Make, n8n).

No credits consumed.

Terminal window
curl https://api.templatefox.com/v1/templates \
-H "x-api-key: YOUR_API_KEY"
{
"templates": [
{
"id": "HMQywVpZxqAM",
"name": "Invoice Template",
"created_at": "2026-01-15T10:30:00Z",
"updated_at": "2026-01-20T14:45:00Z"
}
]
}

Get the dynamic fields (variables) declared in a template. Useful for building dynamic forms in integrations.

No credits consumed.

Terminal window
curl https://api.templatefox.com/v1/templates/HMQywVpZxqAM/fields \
-H "x-api-key: YOUR_API_KEY"
[
{
"key": "customer_name",
"label": "customer_name",
"type": "string",
"required": false,
"helpText": "e.g. John Doe"
},
{
"key": "items",
"label": "items",
"type": "string",
"required": false,
"helpText": "JSON array, e.g. [{\"name\": \"Product\", \"price\": 99}]"
}
]
FieldTypeDescription
keystringField identifier to use in the data object
labelstringHuman-readable label
typestringField type: string, integer, number, boolean
requiredbooleanWhether the field is required
helpTextstringHelp text with example value

Current account info including remaining credits.

No credits consumed.

Terminal window
curl https://api.templatefox.com/v1/account \
-H "x-api-key: YOUR_API_KEY"
{
"credits": 142,
"email": "user@example.com"
}

Transaction history with pagination.

No credits consumed.

ParameterTypeDefaultDescription
limitnumber300Number of records to return (1-1000)
offsetnumber0Number of records to skip
Terminal window
curl "https://api.templatefox.com/v1/account/transactions?limit=10&offset=0" \
-H "x-api-key: YOUR_API_KEY"
{
"transactions": [
{
"transaction_ref": "550e8400-e29b-41d4-a716-446655440000",
"transaction_type": "PDFGEN",
"template_id": "HMQywVpZxqAM",
"exec_tm": 1250,
"credits": 1,
"created_at": "2026-01-20T14:30:00Z"
}
],
"total": 45,
"limit": 10,
"offset": 0
}
Transaction TypeDescription
PDFGENPDF generation (credits consumed)
PURCHASECredit purchase (credits added)
REFUNDCredit refund on failed generation
BONUSBonus credits

Positive credits = consumed, negative = added.


Direct PDF manipulation endpoints — no template required. Each call costs 1 credit and accepts the input as either an HTTPS URL (pdf_url) or a base64 string (pdf_base64).

All three return the same payload as POST /v1/pdf/create (URL + filename + remaining credits + expiration).

Concatenate 2 or more PDFs in the order provided.

Terminal window
curl -X POST https://api.templatefox.com/v1/pdf-tools/merge \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pdfs": [
{ "pdf_url": "https://example.com/cover.pdf" },
{ "pdf_url": "https://example.com/report.pdf" },
{ "pdf_url": "https://example.com/appendix.pdf" }
],
"filename": "merged-report"
}'
FieldTypeRequiredDescription
pdfsarrayYesOrdered list (min 2). Each entry has pdf_url or pdf_base64.
filenamestringNoCustom filename without .pdf.
expirationintegerNoSigned URL TTL in seconds (60–604800, default 86400).
export_typestringNourl (default) or binary (returns raw bytes).

Return a single PDF containing only the selected pages of the input — in the order specified. Use this to split, reorder, or pick pages.

Terminal window
curl -X POST https://api.templatefox.com/v1/pdf-tools/extract-pages \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pdf_url": "https://example.com/report.pdf",
"pages": "1-3, 5, 7-9"
}'
FieldTypeRequiredDescription
pdf_url or pdf_base64stringYesSource PDF (exactly one).
pagesstringYes1-indexed page selection. Supports ranges + singles, e.g. 1-3, 5, 7-9. Order is preserved (5,1,3 outputs those 3 pages in that order).
filename, expiration, export_typeNoSame as merge.

Rotate every page by a single angle (rotation) or apply a per-page map (page_rotations). Allowed angles: 0, 90, 180, 270. Rotations are cumulative with the page’s existing rotation.

Terminal window
# Rotate every page 90°
curl -X POST https://api.templatefox.com/v1/pdf-tools/rotate \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pdf_url": "https://example.com/scan.pdf",
"rotation": 90
}'
# Rotate page 1 by 90° and page 3 by 180°
curl -X POST https://api.templatefox.com/v1/pdf-tools/rotate \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pdf_url": "https://example.com/scan.pdf",
"page_rotations": { "1": 90, "3": 180 }
}'
FieldTypeRequiredDescription
pdf_url or pdf_base64stringYesSource PDF (exactly one).
rotation or page_rotationsint / objectYesProvide exactly one. rotation applies globally; page_rotations is a { "<page>": <degrees> } map.
filename, expiration, export_typeNoSame as merge.

Async-job inspection endpoints (paired with POST /v1/pdf/create-async).

List async PDF generation jobs for your team.

No credits consumed.

ParameterTypeDefaultDescription
limitinteger20Max results (1–100).
offsetinteger0Records to skip.
statusstringFilter by pending, processing, completed, failed.
Terminal window
curl "https://api.templatefox.com/v1/pdf/jobs?status=completed&limit=20" \
-H "x-api-key: YOUR_API_KEY"
{
"jobs": [
{
"id": "8e1c8c5d-4a4f-4c1a-9b13-3d2c9c3f4e6a",
"status": "completed",
"template_id": "HMQywVpZxqAM",
"filename": "invoice-001.pdf",
"result_url": "https://cdn.templatefox.com/generated/abc/invoice-001.pdf",
"created_at": "2026-04-25T12:00:00Z",
"completed_at": "2026-04-25T12:00:04Z"
}
],
"total": 1
}

See GET /v1/pdf/jobs/{job_id} on the Create PDF (Async) page for polling a single job.


List tagged versions of a template. Use this to pin generation to a specific snapshot for reproducibility (e.g. month-end invoice runs always rendered with the version that was live at month-start).

No credits consumed.

Terminal window
curl https://api.templatefox.com/v1/templates/HMQywVpZxqAM/versions \
-H "x-api-key: YOUR_API_KEY"
{
"versions": [
{ "id": "v3", "tag": "2026-Q2", "created_at": "2026-04-01T09:00:00Z" },
{ "id": "v2", "tag": "2026-Q1", "created_at": "2026-01-02T09:00:00Z" },
{ "id": "v1", "tag": null, "created_at": "2025-11-10T09:00:00Z" }
]
}

Pass the desired id as the version field on POST /v1/pdf/create or POST /v1/pdf/create-async to render against that version. Omit version to render the live draft.


Configure your own S3-compatible storage to have generated PDFs uploaded directly to your bucket.

Get current S3 storage configuration (secret key is masked).

Terminal window
curl https://api.templatefox.com/v1/integrations/s3 \
-H "x-api-key: YOUR_API_KEY"
{
"configured": true,
"endpoint_url": "https://s3.amazonaws.com",
"access_key_id": "AKIAIOSFODNN7EXAMPLE",
"bucket_name": "my-pdf-bucket",
"default_prefix": "invoices/"
}

Save or update S3 storage configuration.

FieldTypeRequiredDescription
endpoint_urlstringYesS3-compatible endpoint URL (must start with https://)
access_key_idstringYesAccess key ID (16-128 characters)
secret_access_keystringNoSecret access key (required on first setup)
bucket_namestringYesBucket name (3-63 characters, lowercase)
default_prefixstringNoDefault path prefix for uploaded files
Terminal window
curl -X POST https://api.templatefox.com/v1/integrations/s3 \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"endpoint_url": "https://s3.amazonaws.com",
"access_key_id": "AKIAIOSFODNN7EXAMPLE",
"secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"bucket_name": "my-pdf-bucket",
"default_prefix": "invoices/"
}'

Delete S3 storage configuration.

Terminal window
curl -X DELETE https://api.templatefox.com/v1/integrations/s3 \
-H "x-api-key: YOUR_API_KEY"

Test S3 connection with stored credentials.

Terminal window
curl -X POST https://api.templatefox.com/v1/integrations/s3/test \
-H "x-api-key: YOUR_API_KEY"

See Create PDF → S3 parameters to use your configured bucket from the generation endpoint.


StatusCodeDescription
400INVALID_REQUESTMissing or invalid request parameters
401UNAUTHORIZEDInvalid or missing API key
402INSUFFICIENT_CREDITSNo credits remaining
403FORBIDDENAccess denied (not your template)
404TEMPLATE_NOT_FOUNDTemplate ID not found
429RATE_LIMIT_EXCEEDEDToo many requests
500INTERNAL_ERRORServer error
{
"error": "TEMPLATE_NOT_FOUND",
"message": "Template with ID 'xyz' not found"
}

PlanRequests/minRequests/day
Free10100
Pro6010,000
EnterpriseCustomCustom

Rate limit headers included on every response:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1704384000