REST API · Swagger 文件
你可以做出什麼
- 內容管理系統與部落格:每篇文章或圖片發布時自動加上時間戳記。
- 設計與攝影工具:每次匯出都自動登錄。
- 文件流程:固定合約、報價單或發票的確切版本。
- 程式碼流程:在 CI 中替發行檔建立數位指紋。
- 交易平台:為賣家的每次上傳提供原創證明。
取得金鑰
- 打開 https://run.secureauthor.com,使用 Google 帳戶登入。
- 打開「API 金鑰」區塊,按下產生金鑰的按鈕。
- 複製金鑰,並以
api-key查詢參數傳送。
完整參考文件:「Swagger API 說明文件」。
建立收據
POST https://api.secureauthor.com/api/recipient/user-api/create-with-pdf?api-key=YOUR_KEY
:multipart/form-data,欄位 media 為檔案。
curl -X POST "https://api.secureauthor.com/api/recipient/user-api/create-with-pdf?api-key=YOUR_KEY" \
-F "media=@artwork.png"
回應(節錄):
{
"code": 0,
"message": "Receipt created successfully",
"receipt": {
"id": "cm8ixlzwf0002pj42vqmvev62",
"hash": "26be856c7aa5748040bcf998b18d3081cacb2ab1e4e3b34aece9e86152f083aa",
"timeStamp": "2025-03-21T15:25:13.599Z",
"blockchainLink": null,
"fileName": "artwork",
"fileMimeType": "png",
"fileSize": 26106,
"nextEntryWritten": "2025-03-22T00:00:00.000Z"
}
}
code: 0:已建立新收據。code: 1:這個檔案之前已經登錄過,會傳回原本的收據。blockchainLink在下一次錨定前為null,之後會是 Polygonscan 連結。nextEntryWritten:預計寫入鏈上的時間。
驗證檔案
POST https://api.secureauthor.com/api/recipient/user-api/compare-with-pdf?api-key=YOUR_KEY[&hash-id=RECEIPT_ID]
:欄位 media 為要查核的檔案,選填欄位 pdf 為證書。請傳送證書 PDF 或收據編號其中之一。
curl -X POST "https://api.secureauthor.com/api/recipient/user-api/compare-with-pdf?api-key=YOUR_KEY&hash-id=cm8j56xxh0007pj42mj8eg7rl" \
-F "media=@artwork.png"
{
"code": 0,
"fileHash": "a535b2b5…d0",
"receiptHash": "a535b2b5…d0",
"receiptId": "cm8j56xxh0007pj42mj8eg7rl",
"isEqual": true
}
isEqual: true(code 0):檔案與收據相符;false(code 1):不相符。
錯誤
| 回應 | 意思 |
|---|---|
{"code": 3, "error": "API key is missing"} | 在網址加上 ?api-key= |
{"code": 3, "error": "Invalid API key"} | 在網頁應用程式中重新產生金鑰 |
| HTTP 400 | media 欄位沒有檔案,或請求格式錯誤 |