# Video işini okuma

> Bir video işinin durumunu, ilerlemesini, maliyetini ve tamamlandığında dosyaya giden, bir saat geçerli yeni bağlantıyı okuyun.

`GET https://api.getlykia.com/v1/videos/{id}`

İşi döndürür. `status` `completed`, `failed` ya da `cancelled` olana kadar birkaç saniyede bir okuyun. Her okuma dosyaya yeni bir bağlantı imzalar; süresi dolmuş bir `output.url` işi yeniden okuyarak yenilenir.

## Örnek

**İstek**

cURL

```bash
curl https://api.getlykia.com/v1/videos/gen-1795463406-qOWSYdRnX7cEsv8q \
  -H "Authorization: Bearer $LYKIA_API_KEY"
```

Python

```python
import os

import requests

VIDEO_ID = "gen-1795463406-qOWSYdRnX7cEsv8q"

response = requests.get(
    f"https://api.getlykia.com/v1/videos/{VIDEO_ID}",
    headers={"Authorization": f"Bearer {os.environ['LYKIA_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
job = response.json()
print(job["status"], job["progress"])
if job["status"] == "completed":
    print(job["output"]["url"], "valid until", job["output"]["expires_at"])
```

TypeScript

```typescript
const VIDEO_ID = "gen-1795463406-qOWSYdRnX7cEsv8q";

const response = await fetch(`https://api.getlykia.com/v1/videos/${VIDEO_ID}`, {
  headers: { Authorization: `Bearer ${process.env.LYKIA_API_KEY}` },
});
if (!response.ok) throw new Error(`Lykia returned ${response.status}: ${await response.text()}`);

const job = (await response.json()) as { status: string; progress: number; output?: { url: string | null; expires_at?: string } };
console.log(job.status, job.progress);
if (job.status === "completed") console.log(job.output?.url, "valid until", job.output?.expires_at);
```

**Yanıt (200)**

```json
{
    "id": "gen-1795463406-qOWSYdRnX7cEsv8q",
    "object": "video",
    "status": "completed",
    "progress": 100,
    "model": "bytedance/seedance-1.0-pro",
    "provider": "bytedance",
    "created_at": 1795463406,
    "completed_at": 1795463439,
    "expires_at": 1796068239,
    "duration_seconds": 5,
    "params": {
        "duration": 5,
        "aspect_ratio": "16:9",
        "resolution": "720p",
        "image": false,
        "last_frame": false,
        "reference_images": 0
    },
    "usage": {
        "cost": 0.2574,
        "is_byok": false,
        "cost_details": {
            "upstream_cost": 0.2574,
            "platform_fee": 0,
            "is_byok": false
        }
    },
    "output": {
        "url": "https://files.example.com/media/gen-1795463406-qOWSYdRnX7cEsv8q/0.mp4?X-Amz-Expires=3600&X-Amz-Signature=5f0c9e…",
        "expires_at": "2026-11-23T20:50:41.145Z",
        "mime_type": "video/mp4",
        "bytes": 310368
    }
}
```

## İş nesnesi

- `id` (string) — İş kimliği; aynı zamanda istek kaydının kimliği ([`GET /generation`](https://www.getlykia.com/docs/api-reference/generation)).
- `object` (string) — Her zaman `video`.
- `status` (string) — `queued`, `in_progress`, `completed`, `failed` ya da `cancelled`.
- `progress` (integer) — Sağlayıcı bildiriyorsa 0–100.
- `model` (string) — Model; hazır ayarla gerçek model.
- `provider` (string) — İşi yürüten sağlayıcı.
- `created_at`, `completed_at` (integer | null) — Unix zamanları.
- `expires_at` (integer | null) — Lykia'nın dosyayı sileceği an (Unix zamanı). Süreyi platform belirler.
- `duration_seconds` (number | null) — Tamamlanınca videonun uzunluğu.
- `params` (object) — İsteğin özeti: verildiyse `duration`, `aspect_ratio`, `resolution`, `audio`; `image`, `last_frame`, `reference_images` için gönderilip gönderilmediği ya da kaç tane olduğu.
- `error` (object) — Yalnız `failed` ve `cancelled` işlerde: `message`, `code` (örneğin `timeout`), `reason` ve sağlayıcı reddini ücretlendirdiyse `billed_by_provider: true`.
- `usage` (object) — İş bitince: USD olarak `cost`, `is_byok` ve `cost_details`. Başarısız ya da iptal edilmiş iş, sağlayıcı ücretlendirmediyse `0` tutar.
- `output` (object) — Tamamlanınca: `url` (imzalı, bir saat geçerli), `expires_at` (bağlantının çalışmayı bırakacağı an), `mime_type`, `bytes`, biliniyorsa `width` ve `height`. Lykia'nın depolaması kullanılamıyorsa `url` `null` olur ve `content`, dosyayı akıtan [`GET /videos/{id}/content`](https://www.getlykia.com/docs/api-reference/videos-content) yolunu verir.

İptal edilmiş bir iş:

```json
{
    "id": "gen-1795463449-mbcwAk5o21bdfuKi",
    "object": "video",
    "status": "cancelled",
    "progress": 0,
    "model": "bytedance/seedance-1.0-pro",
    "provider": "bytedance",
    "created_at": 1795463449,
    "completed_at": 1795463449,
    "expires_at": null,
    "duration_seconds": null,
    "params": {
        "duration": 5,
        "image": false,
        "last_frame": false,
        "reference_images": 0
    },
    "error": {
        "message": "The job was cancelled",
        "code": "cancelled",
        "reason": "invalid_request"
    },
    "usage": {
        "cost": 0,
        "is_byok": false,
        "cost_details": {
            "upstream_cost": 0,
            "platform_fee": 0,
            "is_byok": false
        }
    }
}
```

## Hatalar

İş yoksa ya da başka bir projeye aitse `404`.
