> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voidai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Video

> Download a completed video or its assets

```
GET /v1/videos/{id}/content
```

Downloads the content of a completed video. Can retrieve the video file, thumbnail, or spritesheet.

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the video.
</ParamField>

## Query Parameters

<ParamField query="variant" type="string" default="video">
  The type of content to download:

  * `video` - The generated video file (MP4)
  * `thumbnail` - A thumbnail image (WebP)
  * `spritesheet` - A spritesheet preview (JPEG)
</ParamField>

## Response

Returns the binary content of the requested file with the appropriate `Content-Type` header:

| Variant       | Content-Type |
| ------------- | ------------ |
| `video`       | `video/mp4`  |
| `thumbnail`   | `image/webp` |
| `spritesheet` | `image/jpeg` |

## Examples

### Download Video

<CodeGroup>
  ```python Python theme={null}
  import requests

  video_id = "vid_abc123"

  response = requests.get(
      f"https://api.voidai.app/v1/videos/{video_id}/content",
      headers={"Authorization": "Bearer sk-voidai-your_key_here"}
  )

  with open("output.mp4", "wb") as f:
      f.write(response.content)

  print("Video saved as output.mp4")
  ```

  ```typescript TypeScript theme={null}
  const videoId = 'vid_abc123';

  const response = await fetch(`https://api.voidai.app/v1/videos/${videoId}/content`, {
    headers: {
      'Authorization': 'Bearer sk-voidai-your_key_here'
    }
  });

  const buffer = await response.arrayBuffer();
  fs.writeFileSync('output.mp4', Buffer.from(buffer));
  console.log('Video saved as output.mp4');
  ```

  ```bash cURL theme={null}
  curl "https://api.voidai.app/v1/videos/vid_abc123/content" \
    -H "Authorization: Bearer sk-voidai-your_key_here" \
    -o output.mp4
  ```
</CodeGroup>

### Download Thumbnail

<CodeGroup>
  ```python Python theme={null}
  response = requests.get(
      f"https://api.voidai.app/v1/videos/{video_id}/content",
      headers={"Authorization": "Bearer sk-voidai-your_key_here"},
      params={"variant": "thumbnail"}
  )

  with open("thumbnail.webp", "wb") as f:
      f.write(response.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.voidai.app/v1/videos/vid_abc123/content?variant=thumbnail" \
    -H "Authorization: Bearer sk-voidai-your_key_here" \
    -o thumbnail.webp
  ```
</CodeGroup>

### Download Spritesheet

<CodeGroup>
  ```python Python theme={null}
  response = requests.get(
      f"https://api.voidai.app/v1/videos/{video_id}/content",
      headers={"Authorization": "Bearer sk-voidai-your_key_here"},
      params={"variant": "spritesheet"}
  )

  with open("spritesheet.jpg", "wb") as f:
      f.write(response.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.voidai.app/v1/videos/vid_abc123/content?variant=spritesheet" \
    -H "Authorization: Bearer sk-voidai-your_key_here" \
    -o spritesheet.jpg
  ```
</CodeGroup>

## Complete Download Workflow

```python theme={null}
import time
import requests

headers = {"Authorization": "Bearer sk-voidai-your_key_here"}
base_url = "https://api.voidai.app/v1/videos"

# 1. Create video
create_response = requests.post(
    base_url,
    headers=headers,
    data={
        "model": "sora-2",
        "prompt": "A timelapse of clouds moving over a mountain",
        "size": "1920x1080",
        "seconds": "10"
    }
)
video_id = create_response.json()["id"]
print(f"Created video: {video_id}")

# 2. Wait for completion
while True:
    status_response = requests.get(f"{base_url}/{video_id}", headers=headers)
    status = status_response.json()["status"]

    if status == "completed":
        print("Video completed!")
        break
    elif status == "failed":
        print(f"Failed: {status_response.json().get('error')}")
        exit(1)

    print(f"Status: {status}")
    time.sleep(15)

# 3. Download all variants
variants = ["video", "thumbnail", "spritesheet"]
extensions = {"video": "mp4", "thumbnail": "webp", "spritesheet": "jpg"}

for variant in variants:
    response = requests.get(
        f"{base_url}/{video_id}/content",
        headers=headers,
        params={"variant": variant}
    )

    filename = f"output.{extensions[variant]}"
    with open(filename, "wb") as f:
        f.write(response.content)

    print(f"Downloaded {variant} as {filename}")
```

<Warning>
  The video must have a `completed` status before downloading. Attempting to download a pending or failed video will return an error.
</Warning>
