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

# 查询任务状态

> 查询异步视频生成任务的状态与结果



## OpenAPI

````yaml /zh/openapi/videos/task-query.yaml GET /v1/videos/tasks/{task_id}
openapi: 3.1.0
info:
  title: 视频任务查询
  version: '1.0'
  description: 查询异步视频生成任务的状态与结果。
servers:
  - url: https://openapi.imini.ai/imini/router
security:
  - ApiKeyAuth: []
paths:
  /v1/videos/tasks/{task_id}:
    get:
      summary: 查询视频任务状态
      description: |
        查询指定异步视频生成任务的状态与输出结果。

        建议轮询间隔 **5 秒**，视频任务通常在 **1～5 分钟**内完成。
      operationId: getVideoTask
      parameters:
        - name: task_id
          in: path
          required: true
          description: 任务唯一 ID，由视频生成接口返回。
          schema:
            type: string
            example: task_2042864638838083584
      responses:
        '200':
          description: 查询成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    type: string
                    description: 任务唯一 ID
                    example: task_2042864638838083584
                  status:
                    type: string
                    description: |
                      任务状态：
                      - `queued` — 已提交，等待队列
                      - `processing` — 模型生成中
                      - `succeeded` — 生成成功
                      - `failed` — 生成失败，见 `error` 字段
                    enum:
                      - queued
                      - processing
                      - succeeded
                      - failed
                    example: succeeded
                  model:
                    type: string
                    description: 本次任务使用的模型 ID
                    example: kling/kling-v3
                  created_at:
                    type: string
                    format: date-time
                    description: 任务创建时间（ISO 8601）
                    example: '2026-04-11T07:17:39.146Z'
                  completed_at:
                    type: string
                    format: date-time
                    nullable: true
                    description: 任务完成时间（ISO 8601），未完成时为 `null`
                    example: '2026-04-11T07:19:57.844Z'
                  videos:
                    nullable: true
                    type: array
                    description: 生成结果列表，`status` 为 `succeeded` 时有值，否则为 `null`
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                          description: 平台 CDN 视频地址
                          example: >-
                            https://file.iminicdn.com/file/2026/04/11/2042865212863942656.mp4
                        width:
                          type: integer
                          description: 视频宽度（像素）
                          example: 1284
                        height:
                          type: integer
                          description: 视频高度（像素）
                          example: 716
                        duration:
                          type: integer
                          nullable: true
                          description: 视频时长（秒）
                          example: 5
                        cover_url:
                          type: string
                          nullable: true
                          description: 视频封面图地址，取视频首帧生成；生成失败时为 `null`
                          example: >-
                            https://file.iminicdn.com/file/2026/04/11/2042865212863942700.jpg
                  error:
                    nullable: true
                    description: 错误信息，`status` 为 `failed` 时有值，否则为 `null`
                    type: object
                    properties:
                      code:
                        type: string
                        description: 错误码
                        example: PROVIDER_ERROR
                      message:
                        type: string
                        description: 错误详情
                        example: Upstream provider returned an error
                      status:
                        type: integer
                        description: HTTP 状态码
                        example: 502
                  request_id:
                    type: string
                    description: 请求唯一 ID
                    example: req_abc123
              examples:
                Succeeded:
                  summary: 生成成功
                  value:
                    task_id: task_2042864638838083584
                    status: succeeded
                    model: kling/kling-v3
                    created_at: '2026-04-11T07:17:39.146Z'
                    completed_at: '2026-04-11T07:19:57.844Z'
                    videos:
                      - url: >-
                          https://file.iminicdn.com/file/2026/04/11/2042865212863942656.mp4
                        width: 1284
                        height: 716
                        duration: 5
                        cover_url: >-
                          https://file.iminicdn.com/file/2026/04/11/2042865212863942700.jpg
                    error: null
                    request_id: req_abc123
                Processing:
                  summary: 生成中
                  value:
                    task_id: task_2042864638838083584
                    status: processing
                    model: kling/kling-v3
                    created_at: '2026-04-11T07:17:39.146Z'
                    completed_at: null
                    videos: null
                    error: null
                    request_id: req_abc123
                Failed:
                  summary: 生成失败
                  value:
                    task_id: task_2042864638838083584
                    status: failed
                    model: kling/kling-v3
                    created_at: '2026-04-11T07:17:39.146Z'
                    completed_at: '2026-04-11T07:18:05.000Z'
                    videos: []
                    error:
                      code: PROVIDER_ERROR
                      message: Upstream provider returned an error
                      status: 502
                    request_id: req_abc123
        '401':
          description: API Key 无效或缺失
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: UNAUTHORIZED
                      message:
                        type: string
                        example: API Key is invalid or missing
                      status:
                        type: integer
                        example: 401
                      request_id:
                        type: string
                        example: req_abc123
        '404':
          description: 任务 ID 不存在
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: TASK_NOT_FOUND
                      message:
                        type: string
                        example: The specified task ID does not exist
                      status:
                        type: integer
                        example: 404
                      request_id:
                        type: string
                        example: req_abc123
        '500':
          description: 平台内部错误
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: INTERNAL_ERROR
                      message:
                        type: string
                        example: An internal error occurred
                      status:
                        type: integer
                        example: 500
                      request_id:
                        type: string
                        example: req_abc123
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >
        在请求 Header 中传入 `Authorization: Bearer <YOUR_API_KEY>`。前往 [API Keys
        管理页](https://imini.ai/zh/api-keys) 创建和管理 API Key。

````