> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bytedance.mom/llms.txt
> Use this file to discover all available pages before exploring further.

# 视频生成结果查询

<Tip>
  点击上方的“**复制页面**”可发给 AI 自动写对接代码

  拿着视频生成接口返回的任务ID来这里获取视频文件
</Tip>

## 1、身份认证

<ParamField query="Authorization" type="string" required>
  所有接口均需要使用 Bearer Token 进行认证

  获取 API Key：访问 [**API Key 管理页面**](https://toapis.com/console/token) 获取您的 API Key

  使用时在请求头中添加：

  ```text theme={null}
  Authorization: Bearer YOUR_API_KEY
  Content-Type: application/json
  ```
</ParamField>

## 2、请求参数

<Info>
  请求方法：`GET`

  请求路径：`https://api.bytedance.mom/v1/videos/:id`
</Info>

<ParamField query="id" path="param" type="string" required>
  提交视频生成任务时返回的 `id`
</ParamField>

<RequestExample>
  ```text 请求示例(CURL) theme={null}
  curl https://api.bytedance.mom/v1/videos/{{id}} \
    -H "Authorization: Bearer <api-key>"
  ```
</RequestExample>

## 3、响应参数

<Info>
  单条视频生成需要时间通常在 3-10 分钟左右（"sd2-video-fast"模型的生成速度快，但在生成真人短片时，它的指令遵循、视频质量都略逊于"sd2-video"模型）

  让你的 AI 或者程序员设定一个定时器，每 15 秒调用一次本接口，最长超时设为 30 分钟（超过 30 分钟没出来说明卡审失败了，视频生成失败不扣费）。高峰期审核时间可能会拉长，高峰期单条视频生成的耗时可能超过 10 分钟。

  视频生成好了后，会放在"video\_url"参数里，视频链接只保存一天，请在视频生成后 24 小时内下载。
</Info>

<Tip>
  **常见问题**

  人脸审核系统偶尔会抽风，生成失败的时候，重新提交生成任务即可，正常情况在 3 次以内都能过
</Tip>

<ResponseExample>
  ```text 生成中 theme={null}
  //响应示例
  {
    "id": "video_abc123...",
    "object": "video",
    "model": "sd-video",
    "status": "in_progress",
    "progress": 45,
    "created_at": 1704067200,
    "seconds": "5",
    "size": "1280x720"
  }
  ```

  ```text 生成成功 theme={null}
  // 当"status"为"completed"时，从"video_url"参数里取出视频链接
  // 视频链接只保存一天，请在视频生成后 24 小时内下载
  {
    "id": "video_abc123...",
    "object": "video",
    "model": "sd-video",
    "status": "completed",
    "progress": 100,
    "created_at": 1704067200,
    "completed_at": 1704067260,
    "video_url": "https://example.com/videos/result.mp4",
    "seconds": "5",
    "size": "1280x720"
  }
  ```

  ```text 生成失败 theme={null}
  {
    "id": "video_abc123...",
    "object": "video",
    "model": "sd-video",
    "status": "failed",
    "progress": 0,
    "created_at": 1704067200,
    "error": {
      "message": "视频生成失败",
      "code": "task_failed"
    }
  }
  ```
</ResponseExample>
