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

# Bir Wan videosunu retrieve edin

> Durum, ilerleme, zaman damgaları ve tamamlanan video URL’si dahil olmak üzere, task ID ile bir Wan video görevini retrieve edin.

Bir Wan video görevi oluşturduktan sonra bu endpoint’i kullanın. Görev durumunu döndürür ve görev tamamlandıktan sonra `video_url` bilgisini içerir.

## Bu alanları kontrol edin

* `status`, görevin `queued`, `in_progress`, `completed`, `failed` veya `error` durumunda olup olmadığını söyler.
* `progress`, yaklaşık bir tamamlanma yüzdesidir.
* `video_url`, tamamlanmış yanıtlarda görünür.
* `error`, bir görev başarısız olduğunda görünür.

## Polling akışı

<Steps>
  <Step title="Önce görevi oluşturun">
    [Create a Wan video](./create) ile başlayın ve döndürülen `id` değerini saklayın.
  </Step>

  <Step title="Task ID ile polling yapın">
    `status`, `completed`, `failed` veya `error` durumuna ulaşana kadar task ID’yi bu endpoint’e gönderin.
  </Step>

  <Step title="MP4 dosyasını indirin">
    `status` değeri `completed` olduğunda, [Retrieve Wan video content](./retrieve-content) çağrısını yapın.
  </Step>
</Steps>


## OpenAPI

````yaml api/openapi/video/wan/get-retrieve.openapi.json GET /v1/videos/{task_id}
openapi: 3.1.0
info:
  title: Wan Video Retrieve API
  version: 1.0.0
  description: >-
    Retrieve a Wan video task by task ID. Poll this endpoint until status is
    completed, failed, or error.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/videos/{task_id}:
    get:
      summary: Retrieve a Wan video task
      description: >-
        Read the state of a Wan video task that was created through POST
        /v1/videos.
      operationId: wan_retrieve_video
      parameters:
        - name: task_id
          in: path
          required: true
          description: Task ID returned by POST /v1/videos.
          schema:
            type: string
          example: task_example
      responses:
        '200':
          description: Current Wan video task state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WanVideoTask'
              examples:
                queued:
                  summary: Task queued
                  value:
                    id: task_example
                    model: wan2.6
                    object: video
                    status: queued
                    progress: 0
                    created_at: 1779938152
                completed:
                  summary: Task completed
                  value:
                    id: task_example
                    model: wan2.6
                    object: video
                    status: completed
                    progress: 100
                    video_url: <temporary-video-url>
                    created_at: 1779938152
                    completed_at: 1779938219
        '400':
          description: The task ID does not match a task for the authenticated user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: task_not_exist
                  type: invalid_request_error
        '401':
          description: The API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          label: Retrieve task status
          source: |-
            curl https://api.cometapi.com/v1/videos/<TASK_ID> \
              -H "Authorization: Bearer $COMETAPI_KEY"
        - lang: Python
          label: Retrieve task status
          source: |
            import os
            import time
            import requests

            TASK_ID = "<TASK_ID>"
            headers = {"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]}
            terminal_statuses = {"completed", "failed", "error"}

            while True:
                response = requests.get(
                    f"https://api.cometapi.com/v1/videos/{TASK_ID}",
                    headers=headers,
                    timeout=60,
                )
                response.raise_for_status()
                task = response.json()
                print(task["status"], task.get("progress"))
                if task["status"] in terminal_statuses:
                    print(task.get("video_url"))
                    break
                time.sleep(10)
        - lang: JavaScript
          label: Retrieve task status
          source: |
            const TASK_ID = "<TASK_ID>";
            const terminalStatuses = new Set(["completed", "failed", "error"]);

            while (true) {
              const response = await fetch(
                `https://api.cometapi.com/v1/videos/${TASK_ID}`,
                { headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` } },
              );
              const task = await response.json();
              console.log(task.status, task.progress);
              if (terminalStatuses.has(task.status)) {
                console.log(task.video_url);
                break;
              }
              await new Promise((resolve) => setTimeout(resolve, 10_000));
            }
components:
  schemas:
    WanVideoTask:
      type: object
      required:
        - id
        - object
        - model
        - status
        - progress
        - created_at
      properties:
        id:
          type: string
          description: Task ID. Use this value as task_id in retrieve and content requests.
          example: task_example
        task_id:
          type: string
          description: Compatibility alias for id. The value matches id when present.
          example: task_example
        object:
          type: string
          description: Object type. Wan video tasks return video.
          example: video
        model:
          type: string
          description: Model ID used for the task.
          example: wan2.6
        status:
          type: string
          description: >-
            Task lifecycle status. Poll until the value is completed, failed, or
            error.
          enum:
            - queued
            - in_progress
            - completed
            - failed
            - error
          example: queued
        progress:
          type: integer
          minimum: 0
          maximum: 100
          description: Task progress as a coarse percentage.
          example: 0
        created_at:
          type: integer
          description: Task creation time as a Unix timestamp in seconds.
          example: 1779938152
        completed_at:
          type: integer
          description: >-
            Task completion time as a Unix timestamp in seconds. This field
            appears on completed tasks.
          example: 1779938219
        video_url:
          type: string
          description: Temporary video delivery URL. This field appears on completed tasks.
          example: <temporary-video-url>
        error:
          type: object
          description: Failure details. This field appears when the task fails.
          additionalProperties: true
      additionalProperties: true
    ErrorResponse:
      description: >-
        Error body. Validation errors can use a top-level code and message,
        while authentication errors can use an error object.
      oneOf:
        - type: object
          required:
            - message
          properties:
            code:
              type:
                - string
                - 'null'
              description: Short error code.
            message:
              type: string
              description: Human-readable error message.
          additionalProperties: true
        - type: object
          required:
            - error
          properties:
            error:
              type: object
              required:
                - message
              properties:
                message:
                  type: string
                  description: Human-readable error message.
                type:
                  type: string
                  description: Error category.
                code:
                  type:
                    - string
                    - 'null'
                  description: Short error code.
              additionalProperties: true
          additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication. Use your CometAPI API key.

````