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

# kling-task-query

> 查询可灵生成任务的状态和结果。使用创建任务接口返回的 task_id。



## OpenAPI

````yaml zh/api-reference/model-api/kuaishou/openapi/kling-task-query/openapi.yaml GET /kling/v1/videos/{action}/{task_id}
openapi: 3.1.0
info:
  title: Kling 任务查询
  description: 通过 Anyfast API 查询可灵视频/图片生成任务的状态和结果
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/{action}/{task_id}:
    get:
      summary: 查询任务
      description: 查询可灵生成任务的状态和结果。使用创建任务接口返回的 task_id。
      operationId: queryKlingTask
      parameters:
        - name: action
          in: path
          required: true
          description: 任务类型，与创建任务时的端点对应。
          schema:
            type: string
            enum:
              - generations
              - text2video
              - image2video
              - lip-sync
              - kolors-virtual-try-on
            example: text2video
        - name: task_id
          in: path
          required: true
          description: 创建任务接口返回的任务 ID。
          schema:
            type: string
            example: '860260753860210752'
      responses:
        '200':
          description: 成功获取任务状态
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: 响应码
                    example: success
                  message:
                    type: string
                    description: 响应消息
                    example: ''
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                        description: 任务 ID
                        example: '860260753860210752'
                      action:
                        type: string
                        description: 创建该任务的原始接口
                        example: /kling/v1/videos/omni-video_POST
                      status:
                        type: string
                        enum:
                          - SUBMITTED
                          - PROCESSING
                          - SUCCESS
                          - FAILED
                        description: 任务状态
                        example: SUCCESS
                      fail_reason:
                        type: string
                        description: 失败原因或成功时的结果 URL
                      submit_time:
                        type: integer
                        description: 任务提交 Unix 时间戳
                        example: 1773130665
                      start_time:
                        type: integer
                        description: 任务开始 Unix 时间戳
                        example: 1773130715
                      finish_time:
                        type: integer
                        description: 任务完成 Unix 时间戳
                        example: 1773130790
                      progress:
                        type: string
                        description: 任务进度百分比
                        example: 100%
                      data:
                        type: object
                        description: 可灵原始响应数据
                        properties:
                          code:
                            type: integer
                            example: 0
                          message:
                            type: string
                            example: SUCCEED
                          request_id:
                            type: string
                            example: 7e91db5f-66d3-4df4-b7e5-c2ab89df1959
                          data:
                            type: object
                            properties:
                              created_at:
                                type: integer
                                description: 创建时间戳（毫秒）
                              task_id:
                                type: string
                                description: 任务 ID
                              task_status:
                                type: string
                                enum:
                                  - submitted
                                  - processing
                                  - succeed
                                  - failed
                                description: 可灵原始任务状态
                                example: succeed
                              updated_at:
                                type: integer
                                description: 最后更新时间戳（毫秒）
                              task_result:
                                type: object
                                description: 任务结果，包含生成的视频或图片
                                properties:
                                  videos:
                                    type: array
                                    description: 生成的视频列表
                                    items:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          description: 视频 ID
                                          example: '860260754053148756'
                                        url:
                                          type: string
                                          description: 视频下载 URL
                                        duration:
                                          type: string
                                          description: 视频时长（秒）
                                          example: '5.041'
        '400':
          description: 请求参数有误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 任务不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````