回调 (Callback)

创建任务时传入 callback_url,系统会自动轮询上游,任务完成或失败时向你的 URL 发送 POST 请求。

请求头

Header说明
Content-Typeapplication/json
X-Event事件类型:task.completedtask.failed
X-Task-Id任务 ID
X-TimestampUnix 时间戳(秒)

完成

{
  "id": "7d89c51e-9430-410e-909e-df347131ebaa",
  "status": "completed",
  "model": "doubao-seedance-2.0",
  "created_at": 1774790227,
  "completed_at": 1774796529,
  "output": {
    "urls": [
      "https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedance-2-0/...mp4?X-Tos-Algorithm=..."
    ],
    "metadata": {
      "seed": 41485,
      "ratio": "16:9",
      "duration": 5,
      "resolution": "480p",
      "generate_audio": true,
      "framespersecond": 24
    }
  }
}

失败

{
  "id": "57c8772c-f834-46f3-9b7d-81f92e104050",
  "status": "failed",
  "model": "doubao-seedance-2.0",
  "created_at": 1774793758,
  "error": {
    "code": "upstream_error",
    "message": "The request failed because the input text may contain sensitive information. Request id: 0217747937596950e290995bd2535df6af5f05331d9ca5663eeee"
  }
}

任务失败时,预扣的积分会自动退还。

重试策略

如果你的服务器不可达或返回非 2xx 状态码,系统会自动重试,最多 3 次

次数时机
第 1 次立即
第 2 次3 分钟后
第 3 次10 分钟后

3 次均失败后回调标记为 failed。你可以随时通过轮询 GET /v1/tasks/{taskId} 查询最终状态作为兜底。