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

# 查询任务

> 使用 `GET /v1/video/generations/{task_id}` 查询 Seedance 2.0 视频生成任务状态与结果。

# 查询任务

根据 [创建视频](./generation) 返回的 `task_id` 查询任务状态、进度与结果视频地址。

## 方法与路径

```http theme={null}
GET /v1/video/generations/{task_id}
```

## 请求示例

<CodeGroup>
  ```bash theme={null}
  curl https://octopusx.ai/v1/video/generations/cgt-20260412163502-x8k2m \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Accept: application/json"
  ```

  ```python theme={null}
  import requests

  resp = requests.get(
      "https://octopusx.ai/v1/video/generations/cgt-20260412163502-x8k2m",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Accept": "application/json",
      },
      timeout=30,
  )
  print(resp.json())
  ```
</CodeGroup>

## 响应示例

<ResponseExample>
  ```json 200 - 进行中 theme={null}
  {
    "code": "success",
    "data": {
      "task_id": "task_xxxxx",
      "status": "IN_PROGRESS",
      "progress": "50%",
      "submit_time": 1775908082,
      "start_time": 1775908086,
      "finish_time": 0,
      "data": {
        "status": "processing",
        "duration": 5,
        "resolution": "720p",
        "ratio": "16:9",
        "content": {},
        "usage": {}
      }
    }
  }
  ```

  ```json 200 - 成功 theme={null}
  {
    "code": "success",
    "data": {
      "task_id": "task_xxxx",
      "status": "SUCCESS",
      "progress": "100%",
      "submit_time": 1775908082,
      "start_time": 1775908086,
      "finish_time": 1775908321,
      "data": {
        "status": "succeeded",
        "duration": 5,
        "resolution": "720p",
        "ratio": "16:9",
        "content": {
          "video_url": "https://example.com/output.mp4"
        },
        "usage": {
          "completion_tokens": 108900,
          "total_tokens": 108900
        }
      }
    }
  }
  ```

  ```json 200 - 失败 theme={null}
  {
    "code": "success",
    "data": {
      "task_id": "task_xxxx",
      "status": "FAILURE",
      "progress": "100%",
      "submit_time": 1775908082,
      "start_time": 1775908086,
      "finish_time": 1775908200,
      "fail_reason": "Content safety check failed",
      "data": {
        "status": "failed",
        "duration": 5,
        "resolution": "720p",
        "ratio": "16:9",
        "content": {},
        "usage": {}
      }
    }
  }
  ```

  ```json 404 theme={null}
  {
    "error": {
      "code": "NotFound",
      "message": "task not found",
      "type": "new_api_error"
    }
  }
  ```
</ResponseExample>

## 认证

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

<ParamField path="task_id" type="string" required>
  视频生成任务 ID，与创建接口返回的 `task_id` 一致。
</ParamField>

## Response

<ResponseField name="code" type="string">
  响应码，成功时为 `success`。
</ResponseField>

<ResponseField name="data.task_id" type="string">
  任务 ID。
</ResponseField>

<ResponseField name="data.status" type="string">
  任务状态：`SUBMITTED`、`IN_PROGRESS`、`SUCCESS`、`FAILURE`。
</ResponseField>

<ResponseField name="data.progress" type="string">
  进度字符串，例如 `50%`、`100%`。
</ResponseField>

<ResponseField name="data.fail_reason" type="string">
  失败原因，仅 `status=FAILURE` 时出现。
</ResponseField>

<ResponseField name="data.data.status" type="string">
  上游原生状态：`queued`、`pending`、`processing`、`succeeded`、`failed`。
</ResponseField>

<ResponseField name="data.data.content.video_url" type="string">
  生成的视频 URL（多为临时签名链接，默认约 12 小时有效）。
</ResponseField>

<ResponseField name="data.data.usage.total_tokens" type="integer">
  计费相关 token 用量。
</ResponseField>

## 相关页面

* [Seedance-2 概览](./overview)
* [创建视频](./generation)
