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

# 查询任务

> 按批次任务 ID 或视频子项 UUID 返回任务状态和输出。id 与 uuid 必须且只能传入一个。



## OpenAPI

````yaml /openapi.zh.json get /openapi/v1/tasks/task-info
openapi: 3.0.3
info:
  title: Neural4D API
  description: API v1 用于上传可复用的输入文件、异步创建视频并查询任务状态和结果。
  version: 1.0.0
servers:
  - url: https://api.neural4d.com
    description: 生产环境
security:
  - bearerAuth: []
tags:
  - name: 视频生成
    description: 创建异步视频生成任务。
  - name: 任务
    description: 通过 ID 查询异步任务。
  - name: 文件
    description: 上传可在生成请求中复用的输入文件。
paths:
  /openapi/v1/tasks/task-info:
    get:
      tags:
        - 任务
      summary: 查询任务
      description: 按批次任务 ID 或视频子项 UUID 返回任务状态和输出。id 与 uuid 必须且只能传入一个。
      operationId: getTaskInfo
      parameters:
        - name: id
          in: query
          required: false
          description: 生成请求返回的批次任务 ID。与 uuid 二选一，不能同时传入。
          schema:
            type: string
            example: normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d
        - name: uuid
          in: query
          required: false
          description: 生成响应返回的视频子项 UUID。与 id 二选一，不能同时传入。
          schema:
            type: string
            format: uuid
            example: 7d1fa4bb-41e6-4a5d-88d8-1851f5342e87
      responses:
        '200':
          description: 任务详情
          headers:
            x-ratelimit-limit-requests:
              $ref: '#/components/headers/RateLimitLimitRequests'
            x-ratelimit-remaining-requests:
              $ref: '#/components/headers/RateLimitRemainingRequests'
            x-ratelimit-reset-requests:
              $ref: '#/components/headers/RateLimitResetRequests'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
              example:
                id: normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d
                status: succeeded
                mode: first_frame_image_to_video
                model: bytedance/seedance-2.0-fast
                created_at: 1784044800
                updated_at: 1784044842
                usage:
                  credits: 26
                output:
                  videos:
                    - uuid: 7d1fa4bb-41e6-4a5d-88d8-1851f5342e87
                      url: https://cdn.neural4d.com/results/video.mp4
                      format: mp4
                      duration: 5
                      resolution: 720p
                      aspect_ratio: '16:9'
                      has_audio: true
                      mode: first_frame_image_to_video
                      status: succeeded
                      created_at: 1784044800
                      updated_at: 1784044842
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      servers:
        - url: https://api.neural4d.com
          description: 生产环境
components:
  headers:
    RateLimitLimitRequests:
      description: 当前时间窗口的请求上限。
      schema:
        type: integer
        format: int32
        minimum: 0
    RateLimitRemainingRequests:
      description: 当前时间窗口内的剩余请求次数。
      schema:
        type: integer
        format: int32
        minimum: 0
    RateLimitResetRequests:
      description: 请求时间窗口距离重置的时长，例如 1s。
      schema:
        type: string
        example: 1s
    RetryAfter:
      description: 重试前需要等待的秒数。
      schema:
        type: integer
        minimum: 0
  schemas:
    Task:
      type: object
      required:
        - mode
        - id
        - status
        - created_at
        - output
      properties:
        id:
          type: string
          example: normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d
          description: 生成请求返回的批次任务 ID。
        status:
          allOf:
            - $ref: '#/components/schemas/TaskStatus'
          description: 标准化后的任务生命周期状态。
        model:
          type: string
          enum:
            - bytedance/seedance-2.0
            - bytedance/seedance-2.0-fast
            - google/veo-3.1
            - xai/grok-imagine
          nullable: true
          description: 任务使用的视频生成模型。
        created_at:
          type: integer
          format: int64
          description: Unix 时间戳（秒）。
        updated_at:
          type: integer
          format: int64
          description: Unix 时间戳（秒）。
        usage:
          $ref: '#/components/schemas/TaskUsage'
          description: 可用时返回此任务扣除的点数。
        error:
          allOf:
            - $ref: '#/components/schemas/TaskError'
          description: 任务失败时返回的错误详情。
        output:
          $ref: '#/components/schemas/VideoTaskOutput'
          description: 当前子视频任务输出，包括仍在排队或处理中的条目。
        mode:
          type: string
          enum:
            - text_to_video
            - first_frame_image_to_video
            - first_last_frame_image_to_video
            - reference_to_video
          description: 任务使用的视频生成模式。
    TaskStatus:
      type: string
      enum:
        - queued
        - processing
        - succeeded
        - failed
      description: 异步任务的标准化生命周期状态。
    TaskUsage:
      type: object
      required:
        - credits
      properties:
        credits:
          type: number
          format: float
          minimum: 0
          description: 该任务或请求扣除的点数。
          example: 26
    TaskError:
      type: object
      required:
        - code
        - message
      description: 异步处理记录的失败详情。
      properties:
        code:
          type: string
          description: 稳定且可供程序读取的任务失败代码。
        message:
          type: string
          description: 便于阅读的任务失败说明。
        failed_at:
          type: integer
          format: int64
          description: 任务失败时的 Unix 时间戳（秒）。
        retryable:
          type: boolean
          description: 重试相同操作是否可能成功。
    VideoTaskOutput:
      type: object
      required:
        - videos
      properties:
        videos:
          type: array
          items:
            $ref: '#/components/schemas/VideoFile'
          description: 所有子视频任务及其当前输出信息；结果文件可用前 url 和 format 为 null。
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
          description: 结构化错误详情。
    VideoFile:
      type: object
      required:
        - uuid
        - url
        - format
        - duration
        - resolution
        - aspect_ratio
        - has_audio
        - mode
        - status
        - created_at
        - updated_at
      properties:
        uuid:
          type: string
          format: uuid
          example: 7d1fa4bb-41e6-4a5d-88d8-1851f5342e87
          description: 生成视频子项 UUID。
        url:
          type: string
          format: uri
          description: 生成视频可用时用于下载的临时签名 URL。
          nullable: true
        format:
          type: string
          nullable: true
          example: mp4
          description: 已知时返回视频文件格式，例如 mp4。
        duration:
          type: integer
          nullable: true
          minimum: 0
          description: 可用时返回生成视频的时长，单位为秒。
        resolution:
          type: string
          nullable: true
          example: 720p
          description: 可用时返回生成视频的分辨率，例如 720p。
        aspect_ratio:
          type: string
          nullable: true
          example: '16:9'
          description: 可用时返回生成视频的宽高比，例如 16:9。
        has_audio:
          type: boolean
          description: 此视频是否启用了原生音频生成。
        mode:
          type: string
          enum:
            - text_to_video
            - first_frame_image_to_video
            - first_last_frame_image_to_video
            - reference_to_video
          description: 此视频使用的生成模式。
        status:
          allOf:
            - $ref: '#/components/schemas/TaskStatus'
          description: 此生成视频的当前状态。
        created_at:
          type: integer
          format: int64
          description: 此生成视频的创建时间，Unix 时间戳，单位为秒。
        updated_at:
          type: integer
          format: int64
          description: 此生成视频的最后更新时间，Unix 时间戳，单位为秒。
    ApiError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: 稳定且可供程序读取的错误码。
          example: invalid_prompt
        message:
          type: string
          example: prompt is required and must be a non-empty string
          description: 便于阅读的错误说明。
        doc_url:
          type: string
          format: uri
          nullable: true
          example: https://api.neural4d.com/docs/errors#invalid_prompt
          description: 包含此错误更多信息的可选文档 URL。
  responses:
    BadRequest:
      description: 请求无效
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalid_prompt:
              summary: 提示词无效
              value:
                error:
                  code: invalid_prompt
                  message: prompt is required and must be a non-empty string
            unsupported_model:
              summary: 模型不受支持
              value:
                error:
                  code: unsupported_model
                  message: 'Unsupported modelKey: missing-model'
            model_unavailable:
              summary: 模型不可用
              value:
                error:
                  code: model_unavailable
                  message: 'Model is unavailable: veo-3.1'
    Unauthorized:
      description: 认证失败
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: invalid_api_key
              message: The API key is invalid or expired
    Forbidden:
      description: 当前已认证用户无权访问该资源或点数不足
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: insufficient_credits
              message: Insufficient credits for video generation
    NotFound:
      description: 未找到请求的资源
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: task_not_found
              message: The requested task does not exist
    RateLimited:
      description: 已超过请求或配额限制
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: Too many requests. Retry after the indicated interval.
    InternalError:
      description: 内部或上游服务错误
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: internal_error
              message: An internal error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 使用 Bearer 方式发送的 Neural4D API 密钥。
      x-default: ${YOUR_API_KEY}

````