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
actionstringYeshtml_to_pdf, merge, info, watermark, split, protect
htmlstringFor html_to_pdf, protectHTML content to convert (max 500K chars)
contentstringFor info, watermark, splitBase64-encoded PDF content
filesarrayFor mergeArray of objects with "content" (base64 PDF). Min 2, max 20.
orientationstringNoportrait or landscape (default: portrait)
paper_sizestringNoa4, a3, a5, letter, legal, tabloid (default: a4)
marginintegerNoPage margin in mm (0-100, default: 10)
watermark_textstringNoText for watermark (default: CONFIDENTIAL)
pagesstringNoFor split: comma-separated page numbers (e.g. "1,3,5")
passwordstringFor protectPassword 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
  }
}