Search the docs
Start for FreeTemplates API
List your templates, generate PDFs, and check your usage.
Base URL: https://pdfstork.com/api/v1
All endpoints require an Authorization: Bearer header. See Authentication.
List templates
Endpointbash
GET /api/v1/templatesReturns a paginated list of all templates belonging to the authenticated user or their current team.
Requestbash
curl https://pdfstork.com/api/v1/templates \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"Responsejson
{
"data": [
{
"id": 123,
"name": "Invoice",
"has_base_pdf": true,
"created_at": "2026-03-15T10:00:00Z",
"updated_at": "2026-03-28T14:30:00Z"
},
{
"id": 456,
"name": "Contract",
"has_base_pdf": false,
"created_at": "2026-03-20T09:00:00Z",
"updated_at": "2026-03-20T09:00:00Z"
}
],
"links": {
"first": "https://pdfstork.com/api/v1/templates?page=1",
"last": "https://pdfstork.com/api/v1/templates?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"last_page": 1,
"per_page": 50,
"total": 2
}
}Generate PDF
Endpointbash
POST /api/v1/templates/{template_id}/generateGenerates a PDF from the given template, injecting the provided data.
Request body
| Field | Type | Default | Description |
|---|---|---|---|
data | object | {} | Key-value pairs for template variables |
output | string | "base64" | base64, url, or binary |
filename | string | "document.pdf" | Output filename |
url_expiry | integer | 60 | URL validity in minutes (1–1440). Only for output: "url" |
Requestbash
curl -X POST https://pdfstork.com/api/v1/templates/123/generate \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"data": {
"customer_name": "Acme Corp",
"invoice_number": "INV-2026-042"
},
"output": "base64",
"filename": "invoice-042.pdf"
}'Response (base64)
200 OKjson
{
"success": true,
"pdf": "JVBERi0xLjQKJeLj...",
"filename": "invoice-042.pdf",
"size": 12345,
"usage": {
"current": 42,
"limit": 5000,
"percentage": 0.84
}
}Response (url)
200 OKjson
{
"success": true,
"url": "https://de-s3.storage.bunnycdn.com/pdfapi-pdfs/pdfs/abc123.pdf?X-Amz-Signature=...",
"filename": "invoice-042.pdf",
"expires_at": "2026-03-30T11:00:00Z",
"size": 12345,
"usage": {
"current": 42,
"limit": 5000,
"percentage": 0.84
}
}Response (binary)
Returns raw PDF bytes with Content-Type: application/pdf.
Check usage
Endpointbash
GET /api/v1/usageReturns your current monthly usage and quota information.
Requestbash
curl https://pdfstork.com/api/v1/usage \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"Responsejson
{
"current_month_usage": 42,
"quota_limit": 5000,
"quota_percentage": 0.84,
"overage_count": 0,
"has_quota_remaining": true,
"plan": "basic",
"daily_usage": [
{ "date": "2026-03-28", "count": 15 },
{ "date": "2026-03-29", "count": 12 },
{ "date": "2026-03-30", "count": 15 }
]
}Error responses
| Status | Description |
|---|---|
401 | Missing or invalid API token |
403 | Insufficient permissions or quota exceeded |
404 | Template not found |
422 | Validation error (see errors object) |
429 | Rate limit exceeded (60 requests/min) |
500 | PDF generation failed |
Validation error examplejson
{
"message": "The output field is invalid.",
"errors": {
"output": [
"The output must be one of: base64, url, binary."
]
}
}