API Overview
Overview of the PDF API endpoints and conventions.
API Overview
The PDF API is organized around REST principles. It uses standard HTTP methods, returns JSON-encoded responses, and uses standard HTTP response codes.
Base URL
All API requests should be made to:
https://api.renderpdf.dev/v1
Endpoints
PDF Conversion
| Method | Endpoint | Description |
|---|---|---|
| POST | /pdf/markdown | Convert Markdown to PDF |
| POST | /pdf/html | Convert HTML to PDF |
| POST | /pdf/url | Convert URL to PDF |
| POST | /pdf/template | Render template to PDF (Coming Soon) |
PDF Operations
| Method | Endpoint | Description |
|---|---|---|
| POST | /pdf/merge | Merge multiple PDFs |
| POST | /pdf/metadata | Set PDF metadata |
| POST | /pdf/metadata/get | Get PDF metadata |
File Storage
| Method | Endpoint | Description |
|---|---|---|
| GET | /files | List stored files |
| GET | /files/:id | Get file details |
| GET | /files/:id/download | Download file |
| DELETE | /files/:id | Delete file |
Webhooks
| Method | Endpoint | Description |
|---|---|---|
| POST | /webhooks/config | Configure webhook |
| GET | /webhooks/config | Get webhook config |
| DELETE | /webhooks/config | Delete webhook config |
Resources
| Method | Endpoint | Description |
|---|---|---|
| GET | /themes | List available themes |
| GET | /templates | List available templates (Coming Soon) |
Account Management
| Method | Endpoint | Description |
|---|---|---|
| POST | /keys | Create API key |
| GET | /keys | List API keys |
| DELETE | /keys/:id | Delete API key |
| GET | /usage | Get usage statistics |
Request Format
All POST requests should include:
Content-Type: application/json
Authorization: Bearer sk_live_xxx
Request body should be valid JSON.
Response Format
Success Response
PDF generation endpoints return the PDF file directly:
Content-Type: application/pdf
Other endpoints return JSON:
{
"data": { ... }
}
Error Response
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable message",
"details": { ... }
}
}
See Error Codes for a complete reference.
HTTP Status Codes
| Code | Description |
|---|---|
200 | Success |
201 | Created |
204 | No Content (successful deletion) |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Feature not available on your plan |
404 | Not Found |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Common Request Options
All PDF generation endpoints accept these optional parameters in the options object:
{
"options": {
"format": "A4",
"landscape": false,
"margin": {
"top": "20mm",
"bottom": "20mm",
"left": "15mm",
"right": "15mm"
},
"print_background": true,
"scale": 1.0,
"wait_for": 0,
"header": "<div>Header HTML</div>",
"footer": "<div>Footer HTML</div>",
"compression": {
"enabled": true,
"level": "medium"
}
},
"storage": {
"enabled": true,
"filename": "document.pdf"
}
}
See PDF Options for detailed documentation.
Compression Options
Reduce PDF file size with configurable compression:
| Level | Description |
|---|---|
none | No compression |
low | Light compression, excellent quality |
medium | Balanced compression (recommended) |
high | Maximum compression |
See Compression for details.
Storage Options
Store generated PDFs for later retrieval:
| Parameter | Type | Description |
|---|---|---|
enabled | boolean | Enable file storage |
filename | string | Custom filename |
See File Storage for details.
Paper Formats
Supported formats: A4, A3, A5, Letter, Legal, Tabloid
See Page Formats for dimensions and use cases.
Margins
Margins can be specified in various units:
| Unit | Example | Description |
|---|---|---|
mm | 20mm | Millimeters |
cm | 2cm | Centimeters |
in | 0.5in | Inches |
px | 50px | Pixels |
Rate Limits
API requests are rate-limited based on your plan:
| Plan | Requests/Minute | Monthly PDFs |
|---|---|---|
| Free | 3 | 10 |
| Pro | 30 | 3,000 |
| Business | 60 | 15,000 |
| Enterprise | 120 | Unlimited |
See Rate Limits for more details.
Next Steps
- Quickstart Guide - Generate your first PDF
- Authentication - API key management
- Code Examples - Ready-to-use examples in multiple languages
- PDF Operations - Merge, compress, and manage PDFs