API Overview
PDFGen Studio provides a RESTful API for generating PDFs, images, and documents from various sources.
Base URL
https://api.pdfgenstudio.com/api/v1
Renderer Endpoints
All four renderer endpoints handle options consistently:
| Endpoint | Method | Description |
|---|---|---|
/renderer/templates/:id | POST | Render a template with dynamic data |
/renderer/json | POST | Generate document from JSON definition |
/renderer/html | POST | Convert HTML to PDF/image |
/renderer/url | POST | Capture webpage as PDF/screenshot |
Options Handling
All endpoints support options in both query parameters AND request body:
- ✅ Query params - For quick/dynamic usage
- ✅ Body options - For complex/structured requests
- ⚡ Query params take precedence over body.options
Example: Using Query Params
POST /api/v1/renderer/templates/123?format=png&response=base64&pixelRatio=3
Example: Using Body Options
{
"data": { "name": "John Doe" },
"options": {
"format": "pdf",
"response": "binary"
}
}
Example: Mixed (Query Wins)
POST /api/v1/renderer/json?format=png
Body: { "document": {...}, "options": { "format": "pdf" } }
# Result: format=png (query wins)
Common Response Formats
| Format | Content-Type | Description |
|---|---|---|
pdf | application/pdf | PDF document |
png | image/png | PNG image |
jpg | image/jpeg | JPEG image |
Response Types
| Type | Description |
|---|---|
binary | Raw binary data (default) |
base64 | Base64 encoded string |
HTTP Status Codes
| Code | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Template or resource not found |
422 | Unprocessable Entity - Validation failed |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Rate Limiting
API requests are rate limited based on your plan. Rate limit information is included in response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1704412800