PDF Pro API Documentation
Complete guide to integrate PDF Pro into your application
Quick Navigation
Authentication
All API requests require authentication using your API key
curl -X POST https://pdfgenerate.com/api/generate \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"template_id": 1, "data": {...}}'
Security Note: Never share your API key publicly. Keep it secure like a password!
Templates API
List Templates
GET
/api/templates
curl -X GET https://pdfgenerate.com/api/templates \
-H "X-API-Key: YOUR_API_KEY"
Create Template
POST
/api/templates
curl -X POST https://pdfgenerate.com/api/templates \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Invoice Template",
"description": "Professional invoice template",
"html_content": "Invoice #{{invoice_number@}}
Amount: ${{amount@}}
",
"is_public": false
}'
Update Template
PUT
/api/templates/{id}
curl -X PUT https://pdfgenerate.com/api/templates/1 \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Invoice Template"}'
Delete Template
DELETE
/api/templates/{id}
curl -X DELETE https://pdfgenerate.com/api/templates/1 \
-H "X-API-Key: YOUR_API_KEY"
PDF Generation
Generate PDF
POST
/api/generate
curl -X POST https://pdfgenerate.com/api/generate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": 1,
"data": {
"invoice_number": "INV-2024-001",
"amount": "1,250.00",
"customer_name": "John Doe",
"date": "2024-10-24"
}
}'
Response:
{
"success": true,
"pdf_url": "https://yourdomain.com/storage/pdfs/abc123.pdf",
"pdf_id": 42
}
Preview PDF
POST
/api/preview
Generate a watermarked preview PDF for testing (does not count against quota)
curl -X POST https://pdfgenerate.com/api/preview \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": 1,
"data": {"invoice_number": "PREVIEW"}
}'
Code Examples
PHP / Laravel
$response = Http::withHeaders([
'X-API-Key' => 'your_api_key_here',
])->post('https://pdfgenerate.com/api/generate', [
'template_id' => 1,
'data' => [
'invoice_number' => 'INV-001',
'amount' => '100.00',
]
]);
$pdfUrl = $response->json()['pdf_url'];
JavaScript / Node.js
const response = await fetch('https://pdfgenerate.com/api/generate', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template_id: 1,
data: {
invoice_number: 'INV-001',
amount: '100.00'
}
})
});
const { pdf_url } = await response.json();
Python
import requests
response = requests.post('https://pdfgenerate.com/api/generate',
headers={'X-API-Key': 'your_api_key_here'},
json={
'template_id': 1,
'data': {
'invoice_number': 'INV-001',
'amount': '100.00'
}
}
)
pdf_url = response.json()['pdf_url']
Error Codes
| Code | Error | Description |
|---|---|---|
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | PDF quota exceeded |
| 404 | Not Found | Template not found |
| 422 | Validation Error | Invalid input data |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Internal server error |
Plans & Pricing
Free Plan
$0/month
- 10 PDFs/month
- API Access
- Basic Templates
Popular
Starter Plan
$9.99/month
- 100 PDFs/month
- Priority Support
- Custom Branding
Wallet Credits: Exceeded your monthly limit? Use wallet credits at $0.10 per PDF for pay-as-you-go flexibility!
Need Help?
Our support team is here to help you succeed