# 輪詢影片生成任務

**API:** Model API

**Endpoint:** `GET /api/v1/videos/generations/{task_id}`

傳回目前的任務狀態。當 status 為 succeeded 時，outputs 會包含可匿名下載的已簽章媒體 URL（https://openapi.felo.ai/api/v1/media/{file_id}?exp=...&sig=...）。請以 5-10 秒的間隔輪詢；任務本身會在背景繼續執行。

## Base URL

- `https://openapi.felo.ai` — 正式環境

## Authentication

- `FeloBearerAuth` (http bearer) — 以 `Authorization: Bearer <key>` 形式傳送的 Felo API 金鑰。
- `FeloApiKey` (apiKey in header `X-API-Key`) — 以 `X-API-Key: <key>` 形式傳送的 Felo API 金鑰。

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `task_id` | path | yes | string | 由 POST /api/v1/videos/generations 傳回的任務 ID。 |

## Responses

### 200 — 目前的任務狀態

**application/json**

Schema: `VideoGenerationTask` (`#/components/schemas/VideoGenerationTask`)

### 401 — Felo API 金鑰無效或未提供

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 404 — 此帳戶找不到該任務

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 503 — 生成服務暫時無法使用

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

## Schema definitions

### GenerationError

`#/components/schemas/GenerationError`

```json
{
  "type": "object",
  "description": "相容於 OpenAI 的錯誤封裝。",
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message",
        "type"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "invalid_request_error",
            "server_error"
          ]
        },
        "param": {
          "type": "string",
          "nullable": true
        },
        "code": {
          "type": "string"
        }
      }
    }
  }
}
```

### VideoGenerationTask

`#/components/schemas/VideoGenerationTask`

```json
{
  "type": "object",
  "required": [
    "task_id",
    "status",
    "kind",
    "outputs"
  ],
  "properties": {
    "task_id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "interrupted"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "video"
      ]
    },
    "outputs": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri",
        "description": "成功時為已簽章的媒體 URL（可匿名下載）；否則為 []。"
      }
    },
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "code": {
          "type": "string",
          "description": "Stable failure code, e.g. file_not_found."
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "description": "任務失敗時才會出現。"
    }
  }
}
```
