API Endpoints ​
Interactive API Documentation
Swagger UI is available at /docs in development mode. You can explore and test all endpoints interactively.
PDF Generation ​
Generate PDF from HTML ​
POST /api/pdf/from-html
Content-Type: application/json{
"requestedKey": "invoice-12345",
"html": "<html><body><h1>Hello World</h1></body></html>",
"options": {
"pdf": {
"format": "A4",
"printBackground": true
}
}
}Generate PDF from URL ​
POST /api/pdf/from-url
Content-Type: application/json{
"requestedKey": "website-snapshot",
"url": "https://example.com",
"options": {
"browser": {
"timeout": 30000,
"viewport": { "width": 1920, "height": 1080 }
}
}
}Generate PDF with Custom Dimensions ​
{
"requestedKey": "custom-size-pdf",
"url": "https://example.com",
"options": {
"browser": {
"viewport": { "width": 400, "height": 800 }
},
"pdf": {
"width": 400,
"height": 800,
"printBackground": true
}
}
}Generate PDF with Loading Rules ​
{
"requestedKey": "spa-page",
"url": "https://example.com/dashboard",
"options": {
"browser": {
"timeout": 60000,
"waitForSelector": "#chart-container",
"waitAfter": 2000
},
"pdf": {
"format": "A4",
"printBackground": true
}
}
}TIP
This waits for the #chart-container element to appear, then waits an additional 2 seconds before generating the PDF.
Generate PDF with Animations Disabled ​
{
"requestedKey": "no-animation-pdf",
"url": "https://example.com/animated-page",
"options": {
"browser": {
"disableAnimations": true
},
"pdf": {
"format": "A4",
"printBackground": true
}
}
}Why disable animations?
CSS animations and transitions can cause elements to be captured mid-animation, resulting in invisible, partially visible, or incorrectly positioned elements in the PDF. This option injects CSS to disable all animations and sets prefers-reduced-motion: reduce for reliable rendering.
Generate PDF with Custom Headers ​
{
"requestedKey": "auth-page",
"url": "https://example.com/protected",
"options": {
"browser": {
"userAgent": "Mozilla/5.0 Custom Agent",
"extraHTTPHeaders": {
"Authorization": "Bearer your-token",
"X-Custom-Header": "custom-value"
}
}
}
}Generate PDF from File ​
POST /api/pdf/from-file
Content-Type: multipart/form-data
file: <HTML file>
requestedKey: report-001
options: {"pdf": {"format": "Letter"}}Screenshot Generation ​
Generate Screenshot from HTML ​
POST /api/screenshot/from-html
Content-Type: application/json{
"requestedKey": "page-capture-001",
"html": "<html><body><h1>Hello World</h1></body></html>",
"options": {
"screenshot": {
"type": "png",
"fullPage": true
}
}
}Generate Screenshot from URL ​
POST /api/screenshot/from-url
Content-Type: application/json{
"requestedKey": "website-screenshot",
"url": "https://example.com",
"options": {
"browser": {
"viewport": { "width": 1920, "height": 1080 }
},
"screenshot": {
"type": "png",
"fullPage": true
}
}
}Generate JPEG Screenshot with Quality ​
{
"requestedKey": "compressed-screenshot",
"url": "https://example.com",
"options": {
"screenshot": {
"type": "jpeg",
"quality": 80,
"fullPage": true
}
}
}Capture Specific Region ​
{
"requestedKey": "region-capture",
"url": "https://example.com",
"options": {
"screenshot": {
"type": "png",
"fullPage": false,
"clip": {
"x": 0,
"y": 0,
"width": 800,
"height": 600
}
}
}
}TIP
Use clip to capture a specific region of the page. When using clip, set fullPage to false.
Transparent Background (PNG only) ​
{
"requestedKey": "transparent-screenshot",
"html": "<html><body style='background: transparent;'><h1>Hello</h1></body></html>",
"options": {
"screenshot": {
"type": "png",
"omitBackground": true
}
}
}Generate Screenshot from File ​
POST /api/screenshot/from-file
Content-Type: multipart/form-data
file: <HTML file>
requestedKey: screenshot-001
options: {"screenshot": {"type": "png", "fullPage": true}}Get Screenshot Job Status ​
GET /api/screenshot/status/:requestedKeyCancel/Remove Screenshot Job ​
DELETE /api/screenshot/:requestedKeyDownload Screenshot ​
GET /api/screenshot/download/:requestedKeyDownloads the generated screenshot file. Returns the image with appropriate Content-Type (image/png or image/jpeg).
Response Headers:
Content-Type:image/pngorimage/jpegContent-Disposition:attachment; filename="<filename>"Content-Length: File size in bytes
Error Responses:
404- Job not found or file not found409- Screenshot not ready (still processing or failed)
Job Management ​
Get Job Status ​
GET /api/pdf/status/:requestedKeyResponse:
{
"requestedKey": "invoice-12345",
"status": "completed",
"progress": 100,
"createdAt": "2025-01-15T10:30:00.000Z",
"updatedAt": "2025-01-15T10:30:05.000Z",
"filePath": "pdf-files/15-01-2025/invoice-12345__15-01-2025_10-30-05.pdf"
}Cancel Job ​
DELETE /api/pdf/cancel/:requestedKeyDownload PDF ​
GET /api/pdf/download/:requestedKeyQueue Statistics ​
GET /api/pdf/queueHealth Checks ​
GET /health # Basic health check
GET /health/ready # Readiness probe
GET /health/live # Liveness probe with queue statsSettings ​
Get Current Settings ​
GET /api/settingsUpdate Settings ​
PUT /api/settings
Content-Type: application/json{
"browser": {
"maxConcurrent": 5
},
"queue": {
"maxSize": 200
}
}Reset to Defaults ​
POST /api/settings/reset