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

# Query Task Result

> Query the status and results of an async task by task_id



## OpenAPI

````yaml /common-api/query-task-result.json get /api/v1/tasks/{task_id}
openapi: 3.1.0
info:
  description: Task management API for querying async task status and results
  version: 1.0.0
  contact:
    name: Modellix API Support
    email: support@modellix.ai
  title: Tasks API
servers:
  - url: https://api.modellix.ai/
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/v1/tasks/{task_id}:
    get:
      summary: Query Task Result
      description: Query the status and results of an async task by task_id
      operationId: getTaskById
      parameters:
        - name: task_id
          in: path
          required: true
          description: Task ID returned by async interface
          schema:
            type: string
            example: task-abc123
      responses:
        '200':
          description: Task found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskQueryResponse'
              examples:
                success:
                  summary: Task completed successfully
                  value:
                    code: 0
                    message: success
                    data:
                      status: success
                      task_id: task-abc123
                      model_id: qwen-image-plus
                      duration: 3500
                      billing:
                        status: succeeded
                        amount: 12.3456
                      result:
                        resources:
                          - url: https://cdn.example.com/images/abc123.png
                            type: image
                            width: 1024
                            height: 1024
                            format: png
                            role: primary
                        metadata:
                          image_count: 1
                        extensions:
                          submit_time: 1704067200000
                          end_time: 1704067203000
                      result_expires_at: 1704153600000
                pending:
                  summary: Task pending
                  value:
                    code: 0
                    message: success
                    data:
                      status: pending
                      task_id: task-abc123
                      model_id: qwen-image-plus
                processing:
                  summary: Task processing
                  value:
                    code: 0
                    message: success
                    data:
                      status: processing
                      task_id: task-abc123
                      model_id: qwen-image-plus
                failed:
                  summary: Task failed
                  value:
                    code: 0
                    message: success
                    data:
                      status: failed
                      task_id: task-abc123
                      model_id: qwen-image-plus
                      error: Task execution failed
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    TaskQueryResponse:
      type: object
      required:
        - code
        - message
        - data
      properties:
        code:
          type: integer
          description: Response code, 0 indicates success
          example: 0
        message:
          type: string
          description: Response message
          example: success
        data:
          type: object
          required:
            - status
            - task_id
            - model_id
          properties:
            status:
              type: string
              enum:
                - success
                - pending
                - processing
                - failed
              description: Task status
              example: success
            task_id:
              type: string
              description: Unique task identifier
              example: task-abc123
            model_id:
              type: string
              description: Model ID
              example: qwen-image-plus
            duration:
              type: integer
              description: >-
                Processing time in milliseconds (only returned on
                completion/failure)
              example: 3500
            result:
              $ref: '#/components/schemas/StandardResponse'
            billing:
              $ref: '#/components/schemas/BillingInfo'
            result_expires_at:
              type: integer
              description: >-
                Result expiration time as Unix millisecond timestamp (only
                returned on success)
              example: 1704153600000
            error:
              type: string
              description: Error message (only returned on failure)
              example: Task execution failed
    StandardResponse:
      type: object
      description: >-
        Standard task result response structure containing generated resources
        and metadata
      properties:
        resources:
          type: array
          description: Array of generated media resources (images, videos, audio)
          items:
            $ref: '#/components/schemas/Resource'
        metadata:
          type: object
          description: >-
            Metadata containing resource statistics (e.g., image_count,
            video_count)
          additionalProperties: true
          example:
            image_count: 1
        extensions:
          type: object
          description: >-
            Extended fields for provider-specific information (e.g.,
            submit_time, end_time)
          additionalProperties: true
          example:
            submit_time: 1704067200000
            end_time: 1704067203000
    BillingInfo:
      type: object
      required:
        - status
      description: >-
        Billing status and actual charge amount for a successful task. Returned
        only when task status is success.
      properties:
        status:
          type: string
          enum:
            - pending
            - succeeded
          description: >-
            Billing processing status. pending means the charge has not been
            completed yet; succeeded means the actual charge amount is
            available.
          example: succeeded
        amount:
          type: number
          format: double
          description: >-
            Actual charge amount in USD with 4 decimal places. Returned only
            when status is succeeded.
          example: 12.3456
    ErrorResponse:
      type: object
      required:
        - code
        - message
      description: Standard error response structure
      properties:
        code:
          type: integer
          description: Error code
          example: 400
        message:
          type: string
          description: Error message
          example: Invalid parameters
    Resource:
      type: object
      required:
        - url
        - type
      description: >-
        Media resource object containing information about generated images,
        videos, or audio
      properties:
        url:
          type: string
          format: uri
          description: Resource CDN URL
          example: https://cdn.example.com/images/abc123.png
        type:
          type: string
          enum:
            - image
            - video
            - audio
          description: Resource type
          example: image
        width:
          type: integer
          description: Width in pixels (for images and videos)
          example: 1024
        height:
          type: integer
          description: Height in pixels (for images and videos)
          example: 1024
        duration:
          type: integer
          description: Duration in seconds (for videos and audio)
          example: 5
        size:
          type: integer
          description: File size in bytes
          example: 2048000
        role:
          type: string
          enum:
            - primary
            - cover
            - thumbnail
          description: >-
            Resource role: primary (main content), cover (thumbnail), or
            thumbnail (preview)
          example: primary
        quality:
          type: string
          description: Quality identifier (e.g., 1080p, 720p, 4K)
          example: 1080p
        format:
          type: string
          description: File format (e.g., png, jpg, mp4, mp3)
          example: png
        metadata:
          type: object
          description: >-
            Extended metadata for model-specific information. For example, image
            recognition models include seg_type (segmentation type: head_seg,
            face_seg, cloth_seg, object_seg) and is_contain (whether the content
            type was detected)
          additionalProperties: true
          example:
            seg_type: object_seg
            is_contain: true
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API Key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 401
            message: 'Authentication failed: invalid API key'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 404
            message: 'Resource not found: task ''task-abc123'' does not exist'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 500
            message: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API Key authentication. Format: Bearer YOUR_API_KEY'

````