API 參考

工作流程 API

除特別說明外,所有端點均需要已登入的工作階段(Cookie)。回應為 JSON:{ ok: true, data } 或 { ok: false, error }。常見錯誤:400 驗證失敗、401 未登入、403 無權限、404 不存在、429 觸發限流、502/503 上游異常。公開的 /api/v1 端點以 Authorization: Bearer pdflean_… 進行驗證,且必須傳送 JSON 內容類型。

本頁目錄

工作流程

方法路徑說明
GET/api/workflows列出您的工作流程
POST/api/workflows建立工作流程(草稿)
GET/api/workflows/:id取得工作流程
PUT/api/workflows/:id更新工作流程(草稿,版本 +1)
DELETE/api/workflows/:id刪除工作流程
POST/api/workflows/:id/publish發布版本
GET/api/workflows/:id/versions版本列表
POST/api/workflows/:id/versions/:version/restore還原至版本

觸發器與 Hook

方法路徑說明
GET/api/workflows/triggers觸發器列表
POST/api/workflows/triggers建立觸發器(webhook/排程/電子郵件/雲端硬碟)
POST/api/workflows/triggers/:id/run立即執行觸發器
DELETE/api/workflows/triggers/:id刪除觸發器
POST/api/workflows/hook/:token入站 Webhook(權杖驗證,無需工作階段;JSON 請求內文)

執行與審核

方法路徑說明
POST/api/workflows/runs建立一次執行(排入佇列)
GET/api/workflows/runs執行列表
GET/api/workflows/runs/:id執行詳情與步驟
POST/api/workflows/runs/:id/retry重試失敗/排入佇列的執行
GET/api/workflows/reviews待人工審核列表
POST/api/workflows/reviews/:id核准/駁回審核

雲端橋接

方法路徑說明
GET/api/workflows/cloud/status獨立 VPS 橋接狀態
POST/api/workflows/cloud/convertOffice → PDF(獨立 VPS,LibreOffice)
POST/api/workflows/cloud/ocrOCR(獨立 VPS,Tesseract)
POST/api/workflows/cloud/extract從 PDF 擷取發票/一般欄位(pdfjs + 規則)

歸檔與保留

方法路徑說明
GET/api/workflows/archive歸檔列表與雜湊鏈完整性
POST/api/workflows/archive歸檔文件(base64,SHA-256 雜湊鏈)
GET/api/workflows/archive/:id/verify驗證歸檔雜湊鏈
GET/api/workflows/archive/export匯出歸檔稽核 CSV(含墓碑記錄)
POST/api/workflows/archive/:id/hold設定/解除法務保留
POST/api/workflows/archive/:id/compliance啟用不可逆的 WORM 合規鎖定
DELETE/api/workflows/archive/:id刪除歸檔(法務保留期間禁止)

公開 API v1

方法路徑說明
GET/api/v1/openapi.jsonOpenAPI 3.1 規格(公開,無需鑑權)
GET/api/v1/me當前 API Key 所屬使用者(Bearer 金鑰)
GET/api/v1/usage用量看板:餘額、近 30 天聚合、最近呼叫
GET/api/v1/workflows工作流程列表(scope workflow.read)
GET/api/v1/workflows/:id取得工作流程(scope workflow.read)
POST/api/v1/workflows/:id/run排隊執行(scope workflow.run)
GET/api/v1/runs執行列表(scope workflow.read)
POST/api/v1/pdf/merge合併 PDF(scope pdf.merge;2–10 個 base64 檔案)
POST/api/v1/pdf/split保留指定頁面(scope pdf.split;ranges 如 "1-3,5")
POST/api/v1/pdf/compress結構壓縮 PDF(scope pdf.compress)
GET/api/v1/jobs/:id任務狀態(免費)
GET/api/v1/jobs/:id/download下載任務結果(免費)
POST/api/v1/convert/officeOffice/ODF 文件互轉(scope pdf.convert)
POST/api/v1/convert/linearizePDF 線性化,加速網頁預覽(scope pdf.convert)
POST/api/v1/convert/typstTypst/Markdown 原始碼編譯為 PDF(scope pdf.convert)
POST/api/v1/ocr掃描檔 OCR 成可搜尋 PDF(scope pdf.ocr)
POST/api/v1/ocr/text單張圖片 OCR 成文字(scope pdf.ocr)
POST/api/v1/validate/pdfaPDF/A 合規校驗(scope pdf.validate)
POST/api/v1/validate/pdfuaPDF/UA 無障礙校驗(scope pdf.validate)
POST/api/v1/validate/signature數位簽章驗證報告(scope pdf.validate)
POST/api/v1/signPAdES 數位簽章(scope pdf.sign;可自帶 PEM 金鑰對)
POST/api/v1/redact真塗黑遮罩:依文字或區域刪除(scope pdf.redact)
POST/api/v1/extract文字與規則化欄位萃取(scope pdf.extract)
POST/api/v1/doclingDocling 結構化版面解析(scope pdf.extract)
POST/api/v1/scan/pii文字個人資訊掃描(scope pii.detect)

Credit consumption

Member credits refresh each billing cycle (no rollover) and are spent before purchased credits. Credits are $0.001 each.

Top up API credits in your account (from $5, never expires)

MethodEndpointCredits
GET/jobs/:id0 per call
GET/jobs/:id/download0 per call
GET/me0 per call
GET/runs0 per call
GET/usage0 per call
GET/workflows0 per call
GET/workflows/:id0 per call
POST/ai/chat3 per call
POST/ai/extract5 per call
POST/ai/pii-detect4 per call
POST/ai/summarize3 per call
POST/ai/translate3 per call
POST/convert/linearize1 per call
POST/convert/office2 per call
POST/convert/typst1 per call
POST/docling3 per call
POST/extract2 per call
POST/ocr3 per page
POST/ocr/text1 per call
POST/pdf/compress1 per call
POST/pdf/merge1 per call
POST/pdf/split1 per call
POST/redact3 per call
POST/scan/pii2 per call
POST/sign5 per envelope
POST/validate/pdfa2 per call
POST/validate/pdfua2 per call
POST/validate/signature2 per call
POST/workflows/:id/run1 per call
ai.chat2 per call
convert.html_to_pdf4 per page
convert.office_to_pdf10 per page
convert.pdf_to_office12 per page
convert.pdfa8 per page
esign.envelope750 per envelope
pdf.ocr3 per page
pdf.ocr.high8 per page