适用场景:在集成 PDF API Hub REST API 实现文档自动化——HTML/URL 转 PDF、合并、拆分、压缩、OCR、加水印、签名、锁定/解锁、转换等。
User needs to call PDF API Hub endpoints ( pdfapihub.com/api/v1/...) for document automation: generating PDFs from HTML/URLs, merging, splitting, compressing, OCR, watermarking, signing, encrypting/decrypting, converting between PDF and images, parsing/extracting text and tables, or managing uploaded files.
This skill ONLY:
This skill NEVER:
All code examples are reference patterns for the user to implement.
TopicFileAll endpoints & parametersendpoints.mdCode examples by use caseexamples.mdAdvanced workflowsadvanced.md
Every request requires the CLIENT-API-KEY header.
text
CLIENT-API-KEY: <your-api-key>
Content-Type: application/json
Get your API key at pdfapihub.com/signup.
text
https://pdfapihub.com/api/v1/
All endpoints use POST with JSON body.
#CategoryEndpointPathWhat it does1DocumentGenerate PDF/generatePdfRender HTML or capture any webpage as a PDF2DocumentParse PDF/pdf/parseExtract text, tables, or structured layout data3DocumentMerge PDFs/pdf/mergeCombine multiple PDFs into one4DocumentSplit PDF/pdf/splitSplit a PDF into pages, ranges, or chunks5DocumentCompress PDF/compressPdfShrink file size (4 compression levels)6DocumentPDF Info/pdf/infoGet metadata and page info from a PDF7DocumentWatermark/watermarkOverlay text/logo watermarks on pages8DocumentSign PDF/sign-pdfStamp a signature image on PDF pages9SecurityLock PDF/lockPdfAES-256 encryption with granular permissions10SecurityUnlock PDF/unlockPdfRemove password protection11ConversionGenerate Image/generateImageCapture URL/HTML as PNG image12ConversionCompress Image/compressImageReduce image file size13ConversionPDF to Image/pdfToImageRender PDF pages as PNG/JPG/WebP14ConversionImage to PDF/imageToPdfCombine images into a PDF15OCRPDF OCR/pdfOcrExtract text from scanned PDF documents16OCRImage OCR/imageOcrExtract text from photos/images17UtilityURL to HTML/urlToHtmlFetch fully-rendered HTML via headless browser18File MgmtUpload File/uploadFileUpload a file to cloud storage19File MgmtList Files/listFilesList uploaded files20File MgmtDelete File/deleteFileDelete an uploaded file21TemplatesCreate Template/createTemplateSave a reusable HTML template22TemplatesList Templates/listTemplatesList saved templates23TemplatesDelete Template/deleteTemplateDelete a saved template
Most endpoints support the output_format parameter:
ValueDescriptionurlReturns a hosted CDN URL (default)fileReturns the file as a downloadbase64Returns base64-encoded contentbinaryReturns raw binary streampdfReturns PDF file directly
HTTP CodeMeaningAction400Invalid RequestCheck JSON body shape and required fields401UnauthorizedVerify CLIENT-API-KEY header422Validation FailedCheck URL/HTML/options for conflicts429Rate LimitedBack off and retry with exponential delay500Internal ErrorRetry; contact support if persistent
json
{
"success": true,
"pdf_url": "https://cdn.pdfapihub.com/pdf/a1b2c3d4.pdf",
"file_size_bytes": 84321,
"file_deletion_date": "2026-05-04",
"source_type": "html"
}
json
{ "output_format": "url" }
Don't rely on defaults — be explicit about whether you need a URL, file, or base64.
json
{
"html_content": "<h1>Invoice #{{number}}</h1>",
"css_content": "h1 { color: #333; }",
"dynamic_params": { "number": "INV-001" }
}
json
{
"url": "https://example.com/report",
"wait_until": "networkidle",
"paper_size": "A4"
}
For endpoints that operate on existing PDFs (merge, split, compress, etc.), provide files via:
Always check success: true in the response before using the result.
TrapConsequenceFixMissing CLIENT-API-KEY header401 errorAlways include the headerSending both url and html_contentUndefined behaviorUse one or the otherNot setting wait_until for SPAsIncomplete captureUse networkidle for JS-heavy pagesIgnoring file_deletion_dateBroken links after expiryDownload/store files before deletionLarge HTML without paginationTimeout or huge PDFUse page_size to limit output
pdfapihub.com over HTTPS