PDF Tools API Documentation
Complete reference for the PDF Tools API
Authentication
Authorization: Bearer sk_live_your_key_here
POST /v1/pdf/process
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| action | string | Yes | html_to_pdf, merge, info, watermark, split, protect |
| html | string | For html_to_pdf, protect | HTML content to convert (max 500K chars) |
| content | string | For info, watermark, split | Base64-encoded PDF content |
| files | array | For merge | Array of objects with "content" (base64 PDF). Min 2, max 20. |
| orientation | string | No | portrait or landscape (default: portrait) |
| paper_size | string | No | a4, a3, a5, letter, legal, tabloid (default: a4) |
| margin | integer | No | Page margin in mm (0-100, default: 10) |
| watermark_text | string | No | Text for watermark (default: CONFIDENTIAL) |
| pages | string | No | For split: comma-separated page numbers (e.g. "1,3,5") |
| password | string | For protect | Password to protect the PDF (min 4 chars) |
Example: HTML to PDF
curl -X POST "https://snapapis.com/api/v1/pdf/process" \
-H "Authorization: Bearer YOUR_KEY" \
-d "action=html_to_pdf&html=<h1>Invoice</h1><p>Total: $99</p>&paper_size=a4"
Response
{
"success": true,
"data": {
"file_size": 15234,
"paper_size": "a4",
"orientation": "portrait",
"download_url": "https://snapapis.com/api/v1/pdf/download?file=...",
"data_uri": "data:application/pdf;base64,...",
"action": "html_to_pdf",
"duration_ms": 450
}
}