Loading
Loading
Generate a PDF from a template you designed in the APIFreaks PDF Template Builder. Send your data as JSON and get back a hosted URL for the rendered document.
The PDF Generator API renders the template referenced by template_id with the data you supply, either in the request body or fetched from a data_url. Every call returns the same pixel-accurate document, and you can pin a version tag so later design changes never touch live output.
Pass your API key as the apiKey parameter in every request.
This is version v1.0 of the API.
The following query parameters can be used in your API requests.
template_idrequiredStringThe template to render, from the APIFreaks PDF Template Builder.
versionoptionalStringTemplate version to render, e.g. v2. Must start with v.
data_urloptionalStringA URL the API fetches your JSON data from, instead of the request body.
Send your template's data as a JSON object in the request body. The keys are the fields you bound when you designed the template. Provide the body when you are not passing a data_url; one of the two is required.
{
"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%"
}
]
}A successful request returns a 200 OK response with a JSON object containing the hosted PDF URL and its expiration time. See the response preview on the right for the full JSON structure.
template_idThe template that was rendered.
pdf_urlHosted URL of the generated PDF.
created_atWhen the PDF was generated (ISO 8601).
expiration_timeWhen the hosted PDF expires (ISO 8601).
See the HTTP Status Codes documentation for a complete reference of common API errors and HTTP status codes.
The template_id parameter is missing.
One or more required parameters are missing.
A query parameter is malformed or not recognized.
version does not start with 'v' (for example v2). Please provide a valid template version.
The request body is missing or empty.
No data was supplied to fill the template. Please provide valid data to generate pdf.
The data_url could not be reached or did not return valid JSON.
The uploaded file or fetched data is larger than 10 MB.
Your account does not have access to this template.
No template matches the template_id.
The requested version does not exist.
The request Content-Type is not supported for this endpoint.
The request contains invalid or missing data.