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

# 查询视频生成任务

> 查询任务状态。`status` 为 `completed` 时返回 `video_url`（7 天内有效，请及时下载保存）；为 `failed` 时返回 `error`，失败的任务不扣费。建议每 10 ~ 15 秒查询一次。



## OpenAPI

````yaml /openapi/zh/vidu-q4-preview.json get /v1/videos/{task_id}
openapi: 3.1.0
info:
  description: >-
    Vidu Q4 Preview：首帧图生视频与参考生视频（1 ~ 15 张参考图、0 ~ 3 段参考音频），3 ~ 16 秒，540P 到
    4K，音画同出。
  title: Vidu Q4 Preview
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Vidu Q4 Preview
paths:
  /v1/videos/{task_id}:
    get:
      tags:
        - Vidu Q4 Preview
      summary: 查询视频生成任务
      description: >-
        查询任务状态。`status` 为 `completed` 时返回 `video_url`（7 天内有效，请及时下载保存）；为 `failed`
        时返回 `error`，失败的任务不扣费。建议每 10 ~ 15 秒查询一次。
      operationId: videoQueryTask
      parameters:
        - description: 创建任务时返回的 `task_id`。
          example: job_02b88886c4fda5be35baff61
          in: path
          name: task_id
          required: true
          schema:
            examples:
              - job_02b88886c4fda5be35baff61
            type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                生成中:
                  summary: 生成中
                  value:
                    task_id: job_02b88886c4fda5be35baff61
                    status: in_progress
                    model: viduq4
                    created_at: 1794846663
                    request_id: req_6a9a539502118ba1c33f1bfc
                生成成功:
                  summary: 生成成功
                  value:
                    task_id: job_02b88886c4fda5be35baff61
                    status: completed
                    model: viduq4
                    created_at: 1794846663
                    completed_at: 1794847019
                    request_id: req_6a9a539502118ba1c33f1bfc
                    video_url: >-
                      https://cdn.example.com/videos/02b88886c4fda5be35baff61.mp4
                生成失败:
                  summary: 生成失败
                  value:
                    task_id: job_02b88886c4fda5be35baff61
                    status: failed
                    model: viduq4
                    created_at: 1794846663
                    completed_at: 1794847019
                    request_id: req_6a9a539502118ba1c33f1bfc
                    error:
                      type: api_error
                      message: >-
                        InvalidParameterValue: Please input the ImageURL that
                        can be retrieved from the external network.
              schema:
                $ref: '#/components/schemas/VideoTaskResponse'
          description: 任务详情。
          headers:
            X-Request-Id:
              description: 本次请求的 ID，排查问题时请提供。
              schema:
                type: string
        '401':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: unauthorized
                      http_status: 401
                      message: Invalid API key.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: authentication_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: API Key 缺失或无效。
        '404':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: not_found
                      http_status: 404
                      message: The requested task was not found.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: invalid_request_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: 任务不存在或结果已过期。
        '429':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: rate_limit_exceeded
                      http_status: 429
                      message: Rate limit exceeded. Please try again later.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: rate_limit_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: 请求过于频繁，请稍后重试。
        '500':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: api_error
                      http_status: 500
                      message: Unable to query the task. Please try again later.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: api_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: 服务端错误，请稍后重试。
components:
  schemas:
    VideoTaskResponse:
      additionalProperties: false
      description: 任务详情。
      properties:
        task_id:
          description: 任务 Id。
          type: string
        status:
          description: |-
            任务状态。

            **可选值：**
            - `queued`：排队中。
            - `in_progress`：生成中。
            - `completed`：生成成功，从 `video_url` 下载视频。
            - `failed`：生成失败，原因见 `error`，不扣费。
          enum:
            - queued
            - in_progress
            - completed
            - failed
          type: string
        model:
          description: 模型名称。
          type: string
        created_at:
          description: 任务创建时间，Unix 秒级时间戳。
          format: int64
          type: integer
        completed_at:
          description: 任务结束时间（成功或失败），Unix 秒级时间戳；任务未结束时不返回。
          format: int64
          type: integer
        request_id:
          description: 创建该任务的请求 ID，排查问题时请提供。
          type: string
        video_url:
          description: 生成的视频下载地址，仅 `status` 为 `completed` 时返回。链接 7 天内有效，请及时下载保存。
          type: string
        error:
          $ref: '#/components/schemas/VideoTaskError'
          description: 失败原因，仅 `status` 为 `failed` 时返回。
      required:
        - task_id
        - status
        - model
        - created_at
        - request_id
      type: object
    VideoAPIErrorResponse:
      additionalProperties: false
      description: 错误响应。
      properties:
        error:
          $ref: '#/components/schemas/VideoAPIError'
          description: 错误信息。
      required:
        - error
      type: object
    VideoTaskError:
      additionalProperties: false
      description: 任务失败原因。
      properties:
        type:
          description: |-
            错误类型。

            **可选值：**
            - `api_error`：视频生成失败。
          enum:
            - api_error
          type: string
        message:
          description: 可读的失败原因。
          type: string
      required:
        - type
        - message
      type: object
    VideoAPIError:
      additionalProperties: false
      description: 错误信息。
      properties:
        code:
          description: 错误码。
          type: string
        http_status:
          description: HTTP 状态码。
          format: int64
          type: integer
        message:
          description: 可读的错误说明。
          type: string
        request_id:
          description: 请求 ID，排查问题时请提供。
          type: string
        type:
          description: |-
            错误类型。

            **可选值：**
            - `invalid_request_error`：请求参数错误。
            - `authentication_error`：认证失败。
            - `insufficient_balance_error`：余额不足。
            - `permission_error`：无权限。
            - `rate_limit_error`：请求过于频繁。
            - `api_error`：服务端错误。
          enum:
            - invalid_request_error
            - authentication_error
            - insufficient_balance_error
            - permission_error
            - rate_limit_error
            - api_error
          type: string
      required:
        - code
        - http_status
        - message
        - request_id
        - type
      type: object
  securitySchemes:
    bearerAuth:
      description: 'DreamTo 控制台创建的 API Key，格式 `Authorization: Bearer <API Key>`。'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.