# Download a video

> Download a completed video, by redirect to a fresh signed link or as JSON with the link.

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

Returns the file of a completed job. By default the answer is a `302` redirect to a signed link in Lykia's storage, valid for one hour; a client that follows redirects downloads the file in one step. The signed link needs no API key. If Lykia's storage is not available, the file is streamed through this endpoint instead.

## Query parameters

- `redirect` (string) — `false` to receive `{ url, expires_at, mime_type }` as JSON instead of the redirect.

## Example

**cURL**

```bash
# Follows the redirect to the signed file and saves it
curl -L https://api.getlykia.com/v1/videos/gen-1795463406-qOWSYdRnX7cEsv8q/content \
  -H "Authorization: Bearer $LYKIA_API_KEY" \
  -o beach.mp4
```

**Python**

```python
import os

import requests

VIDEO_ID = "gen-1795463406-qOWSYdRnX7cEsv8q"

# redirect=false returns the signed link as JSON instead of redirecting to it
link = requests.get(
    f"https://api.getlykia.com/v1/videos/{VIDEO_ID}/content",
    headers={"Authorization": f"Bearer {os.environ['LYKIA_API_KEY']}"},
    params={"redirect": "false"},
    timeout=30,
)
link.raise_for_status()
info = link.json()
print(info["mime_type"], "valid until", info["expires_at"])

# The signed link needs no Lykia key
video = requests.get(info["url"], timeout=300)
video.raise_for_status()
with open("beach.mp4", "wb") as f:
    f.write(video.content)
print("saved beach.mp4,", len(video.content), "bytes")
```

With `?redirect=false`:

```json
{
    "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.269Z",
    "mime_type": "video/mp4"
}
```

Headers: `X-Generation-Id` and `X-Lykia-Cost` (the job's cost).

## Errors

| Status | Code              | When                                     |
| ------ | ----------------- | ---------------------------------------- |
| `404`  | `not_found`       | No such job in this project.             |
| `409`  | `video_not_ready` | The job is not completed (yet).          |
| `410`  | `video_expired`   | The file was deleted after `expires_at`. |

```json
{
    "error": {
        "message": "The video is queued; content is available once it is completed",
        "type": "invalid_request_error",
        "code": "video_not_ready",
        "status": 409,
        "metadata": {
            "reason": "invalid_request"
        }
    }
}
```
