> ## 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

> Query the status and result of any Kling generation task — video, image, lip-sync, and virtual try-on.

The Kling Task Query endpoint lets you check the status and retrieve results for any Kling generation task. This is a shared endpoint used across all Kling models (Omni, text-to-video, image-to-video, etc.).

## Key points

* **Universal query** — Works for all Kling task types: video, image, lip-sync, virtual try-on
* **Async workflow** — Create a task first, then poll this endpoint until completion
* **Action parameter** — Must match the task type of the original creation request
* **Progress tracking** — Returns progress percentage and status updates

## Action types

| Action                  | Description                        |
| ----------------------- | ---------------------------------- |
| `text2video`            | Text-to-video and Omni video tasks |
| `image2video`           | Image-to-video tasks               |
| `generations`           | Image generation tasks             |
| `lip-sync`              | Lip-sync video tasks               |
| `kolors-virtual-try-on` | Virtual try-on image tasks         |

## Quick example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.anyfast.ai/kling/v1/videos/text2video/860260753860210752 \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests
  import time

  task_id = "860260753860210752"
  action = "text2video"

  while True:
      response = requests.get(
          f"https://www.anyfast.ai/kling/v1/videos/{action}/{task_id}",
          headers={"Authorization": "Bearer YOUR_API_KEY"}
      )

      result = response.json()
      status = result["data"]["status"]
      progress = result["data"]["progress"]
      print(f"Status: {status}, Progress: {progress}")

      if status in ["SUCCESS", "FAILED"]:
          break

      time.sleep(5)

  if status == "SUCCESS":
      videos = result["data"]["data"]["data"]["task_result"]["videos"]
      for video in videos:
          print(f"Video URL: {video['url']}")
  ```
</CodeGroup>

## Response fields

| Field                        | Type    | Description                                            |
| ---------------------------- | ------- | ------------------------------------------------------ |
| `code`                       | string  | Response code (`success`)                              |
| `data.task_id`               | string  | Task ID                                                |
| `data.status`                | string  | `SUBMITTED`, `PROCESSING`, `SUCCESS`, or `FAILED`      |
| `data.progress`              | string  | Progress percentage (e.g. `10%`, `100%`)               |
| `data.submit_time`           | integer | Submission Unix timestamp                              |
| `data.start_time`            | integer | Processing start Unix timestamp                        |
| `data.finish_time`           | integer | Completion Unix timestamp                              |
| `data.data.data.task_result` | object  | Contains `videos` or `images` array with download URLs |

<Card title="API Reference" icon="code" href="/api-reference/model-api/kuaishou/kling-task-query">
  View the interactive API playground for Kling Task Query.
</Card>

<script src="/feedback.js" />
