Overview
The Generate PDF endpoint is the core functionality of CuratePDF. It takes a template ID and dynamic data to produce a professionally formatted PDF document that’s automatically stored in secure cloud storage.
Generated PDFs are temporarily stored and accessible via secure download URLs with automatic expiration for enhanced security.
Key Features
Dynamic Data Binding Variable Substitution Replace template variables with real data like customer names, invoice numbers, dates, and complex objects.
Cloud Storage Secure File Hosting Generated PDFs are automatically uploaded to secure cloud storage with time-limited download URLs.
Custom Filenames Flexible Naming Specify custom filenames with dynamic content for better organization and identification.
High Performance Fast Generation Optimized PDF rendering engine processes documents quickly even with complex layouts.
Data Binding
Template variables are replaced with actual data during PDF generation. Variables use double curly brace syntax: {{variable_name}}
.
Simple Variable Binding
{
"customerName" : "John Smith" ,
"invoiceNumber" : "INV-001" ,
"date" : "2024-01-15" ,
"amount" : 1299.99 ,
"currency" : "USD"
}
Complex Object Binding
{
"data" : {
"customer" : {
"name" : "Acme Corporation" ,
"email" : "billing@acme.com" ,
"address" : {
"street" : "123 Business Ave" ,
"city" : "New York" ,
"state" : "NY" ,
"zip" : "10001"
}
},
"items" : [
{
"name" : "Professional Service" ,
"quantity" : 10 ,
"rate" : 150.00 ,
"total" : 1500.00
},
{
"name" : "Consultation" ,
"quantity" : 5 ,
"rate" : 200.00 ,
"total" : 1000.00
}
]
}
}
Common Use Cases
Invoice Generation Report Generation Certificate Generation const invoiceData = {
templateId: "invoice_template_123" ,
data: {
invoiceNumber: "INV-2024-001" ,
issueDate: "2024-01-15" ,
dueDate: "2024-02-14" ,
company: {
name: "Your Company Inc." ,
address: "123 Business St, City, State 12345" ,
phone: "(555) 123-4567" ,
email: "billing@yourcompany.com"
},
client: {
name: "Client Corporation" ,
address: "456 Client Ave, Client City, CC 67890" ,
email: "ap@clientcorp.com"
},
lineItems: [
{
description: "Web Development Services" ,
hours: 40 ,
rate: 125.00 ,
amount: 5000.00
},
{
description: "Design Consultation" ,
hours: 8 ,
rate: 150.00 ,
amount: 1200.00
}
],
subtotal: 6200.00 ,
tax: 496.00 ,
total: 6696.00
},
filename: "invoice-INV-2024-001.pdf"
};
const response = await fetch ( 'https://api.curatepdf.com/api/generate-pdf' , {
method: 'POST' ,
headers: {
'x-api-key' : api_key ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ( invoiceData )
});
API key for accessing the Docurate PDF API
Example: { "name" : "John Doe" , "company" : "Acme Corp" }
PDF generated successfully
Example: "https://storage.example.com/document.pdf"
Expiration timestamp for the download URL
Example: "2024-01-15T23:59:59.000Z"
Size of the generated PDF in bytes