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

# Query Task Status

> Query the status and result of an asynchronous task by task ID.

Task status flow: PENDING (queued) → RUNNING (processing) → SUCCEEDED (success) / FAILED (failure).

The initial query status is typically PENDING (queued) or RUNNING (processing).
When the status becomes SUCCEEDED, the response will include the generated video URL.
If the status is FAILED, check the error information and retry.
If the status is CANCELED, the task has been canceled. Resubmit the task if needed.
If the status is UNKNOWN, the task does not exist or the status is unknown. This may occur when the task_id does not exist or exceeds the 24-hour validity period.



## OpenAPI

````yaml api-reference/en/zmodelVideo/ali/api/task-query.json GET /ali/api/v1/tasks/{task_id}
openapi: 3.0.1
info:
  title: Aliyun Task Status Query
  version: 1.0.0
  description: >-
    Aliyun task status query endpoint. Used to query the status and result of an
    asynchronous task via `/ali/api/v1/tasks/{task_id}`.
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API server endpoint
security: []
tags:
  - name: Aliyun Video
    description: Aliyun video task query capability
paths:
  /ali/api/v1/tasks/{task_id}:
    get:
      tags:
        - Aliyun Video
      summary: Query task status
      description: >-
        Query the status and result of an asynchronous task by task ID.


        Task status flow: PENDING (queued) → RUNNING (processing) → SUCCEEDED
        (success) / FAILED (failure).


        The initial query status is typically PENDING (queued) or RUNNING
        (processing).

        When the status becomes SUCCEEDED, the response will include the
        generated video URL.

        If the status is FAILED, check the error information and retry.

        If the status is CANCELED, the task has been canceled. Resubmit the task
        if needed.

        If the status is UNKNOWN, the task does not exist or the status is
        unknown. This may occur when the task_id does not exist or exceeds the
        24-hour validity period.
      operationId: aliVideoTaskQuery
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
          description: Task ID.
      responses:
        '200':
          description: Query successful. Returns the task status and result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskQueryResponse'
              examples:
                success:
                  summary: Task executed successfully
                  value:
                    request_id: 52cade0d-905e-9b7d-a01e-xxxxxx
                    output:
                      task_id: 18814247-f944-4102-aa4a-xxxxxx
                      task_status: SUCCEEDED
                      submit_time: '2026-04-02 22:53:19.537'
                      scheduled_time: '2026-04-02 22:53:30.427'
                      end_time: '2026-04-02 23:00:39.287'
                      orig_prompt: 视频2抱着图片3在咖啡厅里弹奏一支舒缓的美式乡村民谣，视频1笑着看着视频2，并缓缓向他走去
                      video_url: >-
                        https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?xxxx
                    usage:
                      duration: 15
                      input_video_duration: 5
                      output_video_duration: 10
                      video_count: 1
                      SR: 720
                      ratio: '16:9'
                failure:
                  summary: Task execution failed
                  value:
                    request_id: e5d70b02-ebd3-98ce-9fe8-759d7d7b107d
                    output:
                      task_id: 86ecf553-d340-4e21-af6e-a0c6a421c010
                      task_status: FAILED
                      code: InvalidParameter
                      message: The size is not match xxxxxx
                expired:
                  summary: Task query expired
                  value:
                    request_id: a4de7c32-7057-9f82-8581-xxxxxx
                    output:
                      task_id: 502a00b1-19d9-4839-a82f-xxxxxx
                      task_status: UNKNOWN
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Task does not exist or has expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    TaskQueryResponse:
      type: object
      properties:
        request_id:
          type: string
          description: >-
            Unique request ID. Can be used for request tracing and issue
            diagnosis.
        output:
          type: object
          description: Task output information.
          properties:
            task_id:
              type: string
              description: Task ID. Valid for 24 hours for querying.
            task_status:
              type: string
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
              description: >-
                Task status.


                - `PENDING`: Task is queued.

                - `RUNNING`: Task is processing.

                - `SUCCEEDED`: Task completed successfully.

                - `FAILED`: Task execution failed.

                - `CANCELED`: Task has been canceled.

                - `UNKNOWN`: Task does not exist or status is unknown.


                Status flow during polling:

                PENDING (queued) → RUNNING (processing) → SUCCEEDED (success) /
                FAILED (failure).


                The initial query status is typically PENDING or RUNNING.

                When the status becomes SUCCEEDED, the response will include the
                generated video URL.

                If the status is FAILED, check the error information and retry.

                If the status is CANCELED, the task has been canceled. Resubmit
                the task if needed.

                If the status is UNKNOWN, the task does not exist or the status
                is unknown. This may occur when the task_id does not exist or
                exceeds the 24-hour validity period.
              x-enum-descriptions:
                PENDING: Task is queued
                RUNNING: Task is processing
                SUCCEEDED: Task completed successfully
                FAILED: Task execution failed
                CANCELED: Task has been canceled
                UNKNOWN: Task does not exist or status is unknown
            submit_time:
              type: string
              description: 'Task submission time. Format: YYYY-MM-DD HH:mm:ss.SSS.'
            scheduled_time:
              type: string
              description: 'Task execution time. Format: YYYY-MM-DD HH:mm:ss.SSS.'
            end_time:
              type: string
              description: 'Task completion time. Format: YYYY-MM-DD HH:mm:ss.SSS.'
            video_url:
              type: string
              description: >-
                Video URL. Only returned when task_status is SUCCEEDED.


                The link is valid for 14 days. Download the video via this URL.
                The video format is MP4 (H.264 encoding).
            orig_prompt:
              type: string
              description: >-
                Original input prompt, corresponding to the request parameter
                `prompt`.
            code:
              type: string
              description: >-
                Error code for request failure. Not returned when the request
                succeeds. See error codes for details.
            message:
              type: string
              description: >-
                Detailed error message for request failure. Not returned when
                the request succeeds. See error codes for details.
        usage:
          type: object
          description: Output information statistics. Only counts successful results.
          properties:
            input_video_duration:
              type: integer
              description: Duration of the input video, in seconds.
            output_video_duration:
              type: integer
              description: Duration of the output video, in seconds.
            duration:
              type: integer
              description: >-
                Total video duration, used for billing.


                For reference video generation tasks, duration =
                input_video_duration + output_video_duration.
            SR:
              type: integer
              description: 'Resolution tier of the output video. Example value: 720.'
            video_count:
              type: integer
              description: Number of output videos. Fixed at 1.
            ratio:
              type: string
              description: 'Aspect ratio of the generated video. Example value: 16:9.'
        code:
          type: string
          description: Error code. Only returned when the request fails.
        message:
          type: string
          description: Error message. Only returned when the request fails.
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code.
        message:
          type: string
          description: Error message.
        request_id:
          type: string
          description: Request ID.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Token
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````