Webhook 端點
在工作結束或點數不足時,我們傳送簽署訊息的目的網址。如何驗證每則訊息,請參閱 Webhook。
本頁內容
GET/v1/webhooks
工作空間的端點,不含其密鑰。
回傳
- 200端點清單。
8 個欄位
webhooksobject[]必填webhooks[].idstring必填webhooks[].urlstring (URL)必填webhooks[].eventsstring[]必填job.completed、job.partly_failed、job.failed、job.cancelled或credits.low其中之一webhooks[].enabledboolean必填連續 72 小時傳送失敗而遭停用後,值為 false。管理員可以在設定中重新啟用。
webhooks[].disabled_atstring (date-time) | null必填webhooks[].created_atstring (date-time)必填webhooks[].secretstring簽署密鑰。只會出現在新增端點時的回應中。
錯誤
範例
curl https://api.filesokay.com/v1/webhooks \
-H "Authorization: Bearer $FILESOKAY_KEY"const res = await fetch("https://api.filesokay.com/v1/webhooks", {
headers: {
Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
},
});
const list = await res.json();import os
import requests
res = requests.get(
"https://api.filesokay.com/v1/webhooks",
headers={
"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
},
)
list = res.json(){
"webhooks": [
{
"id": "wh_5b0e3c1f9a7d42e8b6c4d2f0a8e61b37",
"url": "https://example.com/webhooks/filesokay",
"events": [
"job.completed",
"job.partly_failed",
"job.failed"
],
"enabled": true,
"disabled_at": null,
"created_at": "2026-12-03T09:25:50Z"
}
]
}POST/v1/webhooks
新增一個位於公開網際網路上的 HTTPS 網址,供我們傳送經過簽署的訊息。回應中包含端點的簽署密鑰:請妥善保存,以便驗證每則訊息的簽章。一個工作空間最多可有 20 個端點。
要求本文
urlstring (URL)必填https://網址。私人網路上的網址會遭到拒絕。最多 2,048 個字元
eventsstring[]要傳送的事件。省略則傳送所有事件。
job.completed、job.partly_failed、job.failed、job.cancelled或credits.low其中之一
回傳
- 201端點及其簽署密鑰,密鑰只會顯示這一次。
7 個欄位
idstring必填urlstring (URL)必填eventsstring[]必填job.completed、job.partly_failed、job.failed、job.cancelled或credits.low其中之一enabledboolean必填連續 72 小時傳送失敗而遭停用後,值為 false。管理員可以在設定中重新啟用。
disabled_atstring (date-time) | null必填created_atstring (date-time)必填secretstring必填簽署密鑰。只會出現在新增端點時的回應中。
錯誤
範例
curl -X POST https://api.filesokay.com/v1/webhooks \
-H "Authorization: Bearer $FILESOKAY_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/filesokay",
"events": [
"job.completed",
"job.partly_failed",
"job.failed"
]
}'const res = await fetch("https://api.filesokay.com/v1/webhooks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://example.com/webhooks/filesokay",
events: [
"job.completed",
"job.partly_failed",
"job.failed"
]
}),
});
const endpoint = await res.json();import os
import requests
res = requests.post(
"https://api.filesokay.com/v1/webhooks",
headers={
"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
},
json={
"url": "https://example.com/webhooks/filesokay",
"events": [
"job.completed",
"job.partly_failed",
"job.failed"
]
},
)
endpoint = res.json(){
"id": "wh_5b0e3c1f9a7d42e8b6c4d2f0a8e61b37",
"url": "https://example.com/webhooks/filesokay",
"events": [
"job.completed",
"job.partly_failed",
"job.failed"
],
"enabled": true,
"disabled_at": null,
"created_at": "2026-12-03T09:25:50Z",
"secret": "whsec_…"
}DELETE/v1/webhooks/{id}
移除端點。仍在等待傳送給該端點的訊息將不會傳送。
路徑參數
idstring必填
回傳
- 204已移除。
錯誤
範例
curl -X DELETE https://api.filesokay.com/v1/webhooks/wh_5b0e3c1f9a7d42e8b6c4d2f0a8e61b37 \
-H "Authorization: Bearer $FILESOKAY_KEY"const res = await fetch("https://api.filesokay.com/v1/webhooks/wh_5b0e3c1f9a7d42e8b6c4d2f0a8e61b37", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
},
});
console.log(res.status);import os
import requests
res = requests.delete(
"https://api.filesokay.com/v1/webhooks/wh_5b0e3c1f9a7d42e8b6c4d2f0a8e61b37",
headers={
"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
},
)
print(res.status_code)