# Video işini iptal etme

> Bekleyen ya da süren bir video işini durdurun. İptal edilen iş ücretlendirilmez.

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

İşi iptal eder ve iş nesnesini `status: "cancelled"` ile döndürür. Lykia'nın kuyruğunda bekleyen iş her zaman iptal edilir. Sağlayıcıya gönderilmiş iş yalnız sağlayıcı o aşamada izin veriyorsa iptal edilir. İptal edilen iş ücretsizdir.

## Örnek

**İstek**

cURL

```bash
curl -X POST https://api.getlykia.com/v1/videos/gen-1795463449-mbcwAk5o21bdfuKi/cancel \
  -H "Authorization: Bearer $LYKIA_API_KEY"
```

Python

```python
import os

import requests

VIDEO_ID = "gen-1795463449-mbcwAk5o21bdfuKi"

response = requests.post(
    f"https://api.getlykia.com/v1/videos/{VIDEO_ID}/cancel",
    headers={"Authorization": f"Bearer {os.environ['LYKIA_API_KEY']}"},
    timeout=30,
)
if response.status_code == 409:
    # Already finished, or the provider cannot stop it at this stage
    print(response.json()["error"]["code"])
else:
    response.raise_for_status()
    print(response.json()["status"])  # "cancelled"; a cancelled job is free
```

**Yanıt (200)**

```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

| Durum | Kod                   | Ne zaman                                             |
| ----- | --------------------- | ---------------------------------------------------- |
| `404` | `not_found`           | Bu projede böyle bir iş yok.                         |
| `409` | `job_not_cancellable` | İş zaten bitti ya da sağlayıcı şu an iptal edemiyor. |
