API Documentation
Integrate PDFly's privacy-first PDF processing into your applications with our simple RESTful API.
Authentication
All API requests require an API key. You can generate and manage your API keys from your PDFly Pro dashboard. Include your API key in the Authorization header of every request:
# Example request with authentication curl -X POST https://api.pdfly.app/v1/merge \ -H "Authorization: Bearer pk_live_abc123..." \ -H "Content-Type: multipart/form-data" \ -F "files=@document1.pdf" \ -F "files=@document2.pdf"
Rate Limits
API requests are rate-limited to ensure fair usage. Limits vary by plan:
| Plan | Requests/min | Monthly limit |
|---|---|---|
| Free | 10 | 500 |
| Pro | 60 | 10,000 |
| Business | 300 | 100,000 |
Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.
Error Handling
Errors are returned with appropriate HTTP status codes and a JSON body containing details:
"error": { "code": "invalid_file_format", "message": "The uploaded file is not a valid PDF.", "request_id": "req_abc123" }
Merge PDFs
Combine multiple PDF files into a single document.
| Parameter | Type | Description |
|---|---|---|
| files | file[] | Two or more PDF files to merge (required) |
| output_name | string | Name for the output file (optional) |
# Merge two PDFs curl -X POST https://api.pdfly.app/v1/merge \ -H "Authorization: Bearer pk_live_abc123..." \ -F "files=@doc1.pdf" \ -F "files=@doc2.pdf" \ -F "output_name=merged.pdf" # Response (200 OK) "id": "job_xyz789", "status": "completed", "download_url": "https://api.pdfly.app/v1/files/job_xyz789", "expires_at": "2025-01-15T12:00:00Z"
Split PDF
Split a PDF into multiple files by page ranges or individual pages.
| Parameter | Type | Description |
|---|---|---|
| file | file | The PDF file to split (required) |
| ranges | string | Page ranges, e.g. "1-3,4-6,7" (required) |
curl -X POST https://api.pdfly.app/v1/split \ -H "Authorization: Bearer pk_live_abc123..." \ -F "file=@document.pdf" \ -F "ranges=1-3,4-6,7-10"
Compress PDF
Reduce PDF file size while maintaining quality.
| Parameter | Type | Description |
|---|---|---|
| file | file | The PDF file to compress (required) |
| level | string | Compression level: "low", "medium", "high" (default: medium) |
Convert PDF
Convert PDF to other formats or other formats to PDF.
| Parameter | Type | Description |
|---|---|---|
| file | file | The file to convert (required) |
| to_format | string | Target format: "pdf", "jpg", "png", "docx", "txt" (required) |
OCR PDF
Extract text from scanned PDFs using optical character recognition.
| Parameter | Type | Description |
|---|---|---|
| file | file | The scanned PDF file (required) |
| language | string | Language code: "eng", "spa", "fra", "deu", etc. (default: eng) |
Rotate PDF
Rotate all or specific pages in a PDF document.
| Parameter | Type | Description |
|---|---|---|
| file | file | The PDF file to rotate (required) |
| angle | integer | Rotation angle: 90, 180, or 270 (required) |
| pages | string | Page numbers to rotate, e.g. "1,3,5" (optional, default: all) |
Webhooks
For long-running operations (like OCR on large files), you can register a webhook URL to receive notifications when processing is complete:
# Webhook payload (POST to your URL) "event": "job.completed", "job_id": "job_xyz789", "status": "completed", "download_url": "https://api.pdfly.app/v1/files/job_xyz789", "timestamp": "2025-01-15T12:00:00Z"
Ready to build with PDFly?
Get your API key and start integrating PDF processing in minutes.