Table of contents
RapidPDF API Documentation
Use RapidPDF to generate PDF files from HTML content or public URLs. This page covers the core integration flow and API reference for production use.
Base URL
https://api.rapidpdfapp.com/api/v1Quickstart
- Create an account and generate an API key from your dashboard.
- Send a
x-api-keyheader with your requests. - Call
POST /generatewith eitherhtmlContentorurl. - Read the returned signed
urlto view/download the PDF.
Code Examplebash
curl -X POST "https://api.rapidpdfapp.com/api/v1/generate" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"htmlContent":"<h1>Hello from RapidPDF</h1>",
"pdfOptions":{"format":"A4","printBackground":true}
}'Authentication
Authenticate all API calls with your API key:
Code Examplebash
x-api-key: YOUR_API_KEYKeep API keys server-side and rotate them if exposed.
Endpoints
POST/generate
Generates a PDF from HTML content or a public URL.
GET/health
Returns service health status (and may return 503 when dependencies are unavailable).
Request Schema
Provide exactly one source: htmlContent or url.
Code Examplejson
{
"htmlContent": "<html><body><h1>Invoice</h1></body></html>",
"url": "https://example.com/invoice/123",
"pdfOptions": {
"format": "A4",
"landscape": false,
"printBackground": true,
"scale": 1,
"margin": {
"top": "1cm",
"right": "1cm",
"bottom": "1cm",
"left": "1cm"
},
"media": "screen",
"width": "8.27in",
"height": "11.69in"
}
}Response Schema
Code Examplejson
{
"success": true,
"data": {
"id": "1737048457123.pdf",
"url": "https://signed-url-to-pdf",
"expiresAt": "2026-01-17T09:24:17.123Z",
"size_bytes": 248932
}
}Error Handling
| Status | Meaning |
|---|---|
| 400 | Invalid request payload. |
| 401 | Missing or invalid API key. |
| 422 | Missing/invalid input content. |
| 429 | Rate limit exceeded. |
| 500 | Internal server error. |
| 503 | Service/dependency unavailable. |
Code Examplejson
{
"success": false,
"message": "Too Many Requests",
"retryAfter": 42
}Rate Limits
Handle throttling gracefully using response headers:
| Header | Description |
|---|---|
| RateLimit-Limit | Requests allowed in current window. |
| X-RateLimit-Remaining | Requests remaining. |
| X-RateLimit-Reset | Reset time (Unix ms timestamp). |
PDF Options Reference
| Option | Type | Default | Notes |
|---|---|---|---|
| format | string | A4 | A4, A3, Letter, Legal, etc. |
| landscape | boolean | false | Landscape orientation. |
| printBackground | boolean | false | Include CSS backgrounds. |
| scale | number | 1 | Typical range 0.1 to 2. |
| margin | object | 1cm | top/right/bottom/left with units. |
| media | string | screen | Use print for print CSS. |
| width / height | string | — | Custom page size values. |
Interactive Demo
Run sample API requests directly from the browser.
POST /api/v1/generate
Request Body (JSON)
Response
Click "Run Request" to verify the output...
Authenticated as: Guest(Rate limited to 10 req/min. Log in for higher limits)