# 動画生成タスクをポーリング

**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) — Felo APIキーを `Authorization: Bearer <key>` として送信します。
- `FeloApiKey` (apiKey in header `X-API-Key`) — Felo APIキーを `X-API-Key: <key>` として送信します。

## 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": "タスクが失敗した場合に含まれます。"
    }
  }
}
```
