📄 PDF Generation API
The Outliny PDF Generation API lets you create professional, dynamic PDFs from your templates with just one simple API call.
Endpoint
POST /api/v1/render/pdf
Authentication
Include your API Key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Need an API key? Create one in your dashboard.
Request Body
Field | Type | Required | Description |
---|
template_id | string | Yes | ID of the PDF template you created in Outliny. |
parameters | object | Yes | Key-value pairs replacing Jinja variables in template. |
output_type | string | Optional | pdf (default) or base64. |
filename | string | Optional | Suggested filename for downloaded file |
Example Request
POST https://api.outliny.com/api/v1/render/pdf
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"template_id": "template_123abc",
"parameters": {
"customer_name": "Jane Doe",
"invoice_number": "INV-2025-001",
"amount_due": "$500",
"due_date": "2025-05-10"
},
"filename": "invoice-jane-doe.pdf"
}
Response
Field | Type | Description |
---|
status | string | success |
file_url | string | (If hosted) URL to download the PDF |
file_url | string | (If output_type=base64) Base64-encoded PDF. |
Example Response (default output)
{
"status": "success",
"file_url": "https://api.outliny.com/files/generated/invoice-jane-doe.pdf"
}
Example Response (base64)
{
"status": "success",
"file_base64": "JVBERi0xLjQKJc..."
}
Output Types Explained
Value | Description |
---|
pdf | Hosted URL (default). |
base64 | Returns the PDF directly encoded in base64 string (useful for APIs, internal storage, etc.). |
Common Errors
HTTP Code | Error | Description |
---|
400 | invalid_request | Missing or invalid fields |
401 | unauthorized | Missing/incorrect API key |
404 | template_not_found | Template ID doesn't exist |
500 | internal_error | Server error—try later |
Notes
- Parameters must match Jinja variable names like
amount_due
- PDFs typically generate within 1-3 seconds
- Files are private, securely hosted, and expire after a set period