API リファレンス

コールバック:動画の完成を通知

ポーリングの代わりに、タスク作成時に callback_url を渡せます。生成が成功または失敗すると、その URL にタスクオブジェクトを POST します。

API キーを取得Wan 3 API チーム ·

コールバック:動画の完成を通知

ポーリングの代わりに、タスク作成時に callback_url を渡せます。生成が成功または失敗すると、その URL にタスクオブジェクトを POST します。

curl -X POST "https://api.wan3api.org/v1/videos/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "model": "wan-3",
  "prompt": "A red fox runs through fresh snow at sunrise, slow motion, cinematic",
  "duration": 5,
  "resolution": "480P",
  "aspect_ratio": "16:9",
  "callback_url": "https://your-app.com/webhooks/video"
}'

ペイロード

GET /tasks/:id と同じ JSON のタスクオブジェクト。Content-Type は application/json で、X-Task-Id ヘッダーが付きます。

json
{
  "id": "3f1c9a52-6d1e-4c1b-9a77-2f4d8f0c9e10",
  "object": "video.generation",
  "model": "wan-3",
  "mode": "text",
  "status": "succeeded",
  "progress": 100,
  "prompt": "A red fox runs through fresh snow at sunrise, slow motion, cinematic",
  "duration": 5,
  "resolution": "480P",
  "aspect_ratio": "16:9",
  "video_url": "https://api.wan3api.org/api/video/media/video/outputs/…/3f1c9a52.mp4",
  "credits": 15,
  "refunded": false,
  "error": null,
  "source": "api",
  "created_at": "2026-11-01T08:00:00.000Z",
  "completed_at": "2026-11-01T08:00:41.000Z"
}

配信と再試行

10 秒以内に 2xx を返してください。タイムアウトや 5xx の場合は合計 3 回試し、4xx なら再試行しません。各タスクの配信は最大 1 回なので、ポーリングも併用してください。

信頼する前に確認

コールバックには署名がありません。本文はヒントとして扱い、タスク ID を取り出してキー付きで GET /tasks/:id を呼び、その結果に基づいて処理してください。

javascript
// Express: confirm the task with your key before acting on it.
app.post("/webhooks/video", express.json(), async (req, res) => {
  res.sendStatus(200);
  const response = await fetch(`https://api.wan3api.org/v1/tasks/${req.body.id}`, {
    headers: { Authorization: `Bearer ${process.env.API_KEY}` },
  });
  const task = await response.json();
  if (task.status === "succeeded") await saveVideo(task.id, task.video_url);
});