PDF Generator API - Generate PDFs from Your Templates
The APIFreaks PDF Generator API turns dynamic data into finished, pixel-perfect documents. Build your layout visually in the APIFreaks PDF Template Builder, map your schema, and save it once. From there, a single REST call handles the rest, whether you're rendering an instant JSON invoice or running a high-volume CSV batch, all with auto-expanding tables, native barcodes and QR codes, and zero server-side maintenance.
Built for production, it drops into the systems that already hold your data. It's perfect for billing platforms generating invoices, HR systems issuing certificates, logistics tools printing shipping labels, and SaaS products that need PDFs on demand. Because every call renders the same saved template, your output stays consistent across thousands of documents, and you can pin a version so a later design change never touches what is already live.
Features
Template-Based Rendering
Design your layout once and reference it bytemplate_id. Every call returns the same pixel-accurate document, from one PDF to thousands.Bulk CSV Batching
Upload a CSV to the bulk endpoint and get one PDF per row in a single request. Ideal for monthly statements, payroll slips, and event tickets.Flexible Data Input
Send JSON in the request body, or pass adata_url and our servers pull the JSON from your endpoint or bucket.Dynamic Tables and Auto-Pagination
Bind arrays to tables that grow with your data. They expand and paginate cleanly across pages without overflowing.
Native Barcodes and QR Codes
Generate scannable 1D and 2D codes straight from your data, with no third-party library or image service to wire up.
Production Version Control
Pin a call to a specific version tag likev2, then edit and test new drafts in the dashboard without touching live output.Built for These Use Cases
Billing and invoicing
Turn order or subscription data into branded invoices and receipts, with line items pulled from an array and a QR code for payment.
Certificates and credentials
Issue personalized certificates, diplomas, and badges in bulk from a CSV of recipients.
Reports and statements
Turn JSON metrics into multi-page reports and account statements with repeating headers and footers.
Contracts and agreements
Merge customer details into a standard agreement and pin the version for stable, repeatable output.
Shipping labels and tickets
Generate labels, passes, and event tickets with barcodes and QR codes straight from your data.
Single Generate PDF
$ pip install requestsimport requests
import json
url = "https://api.apifreaks.com/v1.0/pdf/template/generate"
payload = json.dumps({
"report_title": "Quarterly Business Report",
"report_period": "Q4 2024",
"prepared_by": "Marketing Team",
"revenue": 125000,
"growth_rate": 15,
"customer_count": 520,
"monthly_comparison": [
{
"metric": "Revenue",
"previous": "$108,000",
"current": "$125,000",
"change": "+15.7%"
},
{
"metric": "Active Customers",
"previous": "480",
"current": "520",
"change": "+8.3%"
}
]
})
headers = {
'Content-Type': 'application/json',
'X-apiKey': 'API-KEY'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Bulk Generate PDFs
API Endpoint
$ pip install requestsimport requests
url = "https://api.apifreaks.com/v1.0/pdf/template/generate/bulk?template_id=YOUR_TEMPLATE_ID&version=v2"
payload = {}
files=[
('file',('customers.csv',open('/path/to/customers.csv','rb'),'application/pdf'))
]
headers = {
'X-apiKey': 'API-KEY'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
APIFreaks PDF Template Builder
APIFreaks PDF Template Builder is a drag-and-drop workspace inside your dashboard. You set the page size, lay your document out visually, and bind each element to your data, all without code. Preview and generate PDFs right there as you design, then use the API to automate the same template at scale, calling it by its template_id.
By keeping design out of your codebase, a designer or product manager can update a layout in the builder while your developers stay focused on the integration.
- Visual canvas. Drop text, images, shapes, lines, tables, barcodes, and QR codes onto the page.
- Visual data binding. Paste a sample JSON payload and the Data Fields panel reads your fields, typed as text, number, or array. Drag each one onto the element that should show it.
- Dynamic tables. Map a table to a JSON array and it fills in one row per item, paginating across pages on its own.
- Headers, footers, and watermarks. Set a header and footer that repeat on every page, and a watermark with control over font, opacity, rotation, and tiling.
- Page setup. Choose your page size (A4, Letter, Legal, A3, and more) and margins when you create the template.
- Live preview. See the rendered PDF against your sample data as you design.
- Version history. Keep multiple versions, protect the ones in production, and roll back anytime. Each has its own ID for the API.
Create your first template
- Sign up or log in. Create a free account or log in, then go to your dashboard.
- Create a template. Open the builder in your dashboard and choose your page size.
- Add your elements. Drag text, images, tables, barcodes, or QR codes onto the canvas.
- Bind your data. Paste sample JSON into the Data panel and drag each field onto the element that should show it.
- Preview and save. Check the live preview against your sample data, save, and copy the
template_idfor your API calls.
How-To-Guides
Send your data in the request body with the template ID:
# Response { "template_id": "YOUR_TEMPLATE_ID", "pdf_url": "https://.../your-pdf.pdf", "created_at": "2026-08-06T12:34:56Z", "expiration_time": "2026-11-06T12:34:56Z" }curl -X POST "https://api.apifreaks.com/v1.0/pdf/template/generate?template_id=YOUR_TEMPLATE_ID" \ -H "X-apikey: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "customer_name": "Jordan Lee", "invoice_total": "$1,240.00", "due_date": "2026-09-01" }'
You get back a pdf_url you can download or share.
Generate from a data URL
If your data already lives at a URL, pass data_url and skip the body. The API fetches the JSON for you:
# Response { "template_id": "YOUR_TEMPLATE_ID", "pdf_url": "https://.../invoice-42.pdf", "created_at": "2026-08-06T12:34:56Z", "expiration_time": "2026-11-06T12:34:56Z" }curl -X POST "https://api.apifreaks.com/v1.0/pdf/template/generate?template_id=YOUR_TEMPLATE_ID&data_url=https://example.com/invoice-42.json" \ -H "X-apikey: YOUR_API_KEY"
Generate in bulk from a CSV
Upload a CSV where each row is one record. Each row comes back as its own PDF:
# Response [ { "template_id": "YOUR_TEMPLATE_ID", "pdf_url": "https://.../customer-1.pdf", "created_at": "2026-08-06T12:34:56Z", "expiration_time": "2026-11-06T12:34:56Z" }, { "template_id": "YOUR_TEMPLATE_ID", "pdf_url": "https://.../customer-2.pdf", "created_at": "2026-08-06T12:34:56Z", "expiration_time": "2026-11-06T12:34:56Z" } ]curl -X POST "https://api.apifreaks.com/v1.0/pdf/template/generate/bulk?template_id=YOUR_TEMPLATE_ID" \ -H "X-apikey: YOUR_API_KEY" \ -F "file=@customers.csv"
Frequently Asked Questions
template_id, and send that ID with your data to POST /v1.0/pdf/template/generate. The API populates the template and returns a hosted URL for the rendered PDF.data_url for our servers to fetch the JSON, or upload a CSV file to the bulk endpoint. Field names in your data map to the fields you bound in the template.POST /v1.0/pdf/template/generate/bulk and the API generates one PDF per row, returning an array of results in a single response, each with its own PDF URL.version=v2. The API always renders that exact version, so your team can draft and test layout revisions in the builder without affecting production. Omit the version to use the latest.expiration_time. The generated PDF stays accessible at its returned URL until then. Download or move it to your own storage if you need it for longer.Pricing
To generate a PDF through the API, you will need API credits. Credits are only deducted for successful queries, defined by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits already charged will be refunded.
- Generate a PDF request: Each successful request costs
100 credits.
Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.