# Опрос задачи генерации видео

**API:** Model API

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

Возвращает текущий статус задачи. Когда статус — 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) — API-ключ Felo, передаваемый как `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — API-ключ Felo, передаваемый как `X-API-Key: <key>`.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `task_id` | path | yes | string | ID задачи, возвращённый POST /api/v1/videos/generations. |

## Responses

### 200 — Текущее состояние задачи

**application/json**

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

### 401 — Недействительный или отсутствующий API-ключ Felo

**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 медиафайлов (анонимное скачивание) при статусе succeeded; иначе []."
      }
    },
    "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": "Присутствует, если задача завершилась с ошибкой."
    }
  }
}
```
