Webhook 通知

配置一个 webhook URL,以便在渲染完成(成功或失败)时自动接收 POST 回调。您可以在渲染控制台中或通过编程方式设置该 URL。

设置或更新 Webhook URL

set-webhook.sh
curl -X POST https://render-api.chillin.online/user/webhook \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"url": "https://your-domain.com/webhook"}'

触发测试交付

test-webhook.sh
curl -X POST https://render-api.chillin.online/user/webhook/test \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"url": "https://your-domain.com/webhook"}'

Webhook 负载

webhook_payload.json
{
"render_id": 123,
"user_id": 456,
"status": "success",
"video_url": "https://cloud.chillin.online/video_xxx.mp4",
"json_url": "https://cloud.chillin.online/project_xxx.json",
"error_message": "",
"error_log_url": "",
"cost": 0.05,
"duration": 10.5,
"finished_at": "2024-01-01T12:00:00Z"
}
  • 回调是一个 JSON POST 请求,在渲染完成后立即发送。
  • 在 5 秒内响应;超时不会重试。
  • 使用 status 字段(successfailed)以及 error_message/error_log_url 来优雅地处理失败。