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

# TV Episode Downloads

> Fetch direct download links for a TV episode with quality labels and file sizes.

Returns direct download links for a specific TV episode. Each link comes with a quality label, file size, and format — useful for building download buttons or offline-capable applications. Requires a `standard` or `partner` API key.

***

## Path Parameters

<ParamField path="tmdb_id" type="string" required>
  TMDB **series** ID.
</ParamField>

<ParamField path="season" type="number" required>
  Season number.
</ParamField>

<ParamField path="episode" type="number" required>
  Episode number.
</ParamField>

***

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl https://1c34-y.hf.space/api/downloads/tv/1396/1/1 \
    --header "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const res  = await fetch(
    'https://1c34-y.hf.space/api/downloads/tv/1396/1/1',
    { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
  );
  const data = await res.json();

  data.downloads.forEach(dl => {
    console.log(`${dl.quality} (${dl.size}): ${dl.url}`);
  });
  ```

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

  data = requests.get(
    'https://1c34-y.hf.space/api/downloads/tv/1396/1/1',
    headers={'Authorization': 'Bearer YOUR_API_KEY'}
  ).json()

  for dl in data['downloads']:
      print(f"{dl['quality']} ({dl['size']}): {dl['url']}")
  ```
</CodeGroup>

***

## Response

```json theme={null}
{
  "downloads": [
    {
      "url": "https://...",
      "quality": "1080p",
      "size": "1.32 GB",
      "format": "MP4",
      "server": "1"
    },
    {
      "url": "https://...",
      "quality": "720p",
      "size": "856.00 MB",
      "format": "MP4",
      "server": "2"
    },
    {
      "url": "https://...",
      "quality": "480p",
      "size": "412.00 MB",
      "format": "MP4",
      "server": "3"
    }
  ]
}
```

***

## Response Fields

<ResponseField name="downloads" type="Download[]" required>
  Array of available download options. Empty array if none are found.

  <Expandable title="Download object">
    <ResponseField name="url" type="string">
      Direct download URL.
    </ResponseField>

    <ResponseField name="quality" type="string">
      Quality label, e.g. `1080p`, `720p`, `480p`, `4K`. `"Unknown"` if the provider doesn't supply one.
    </ResponseField>

    <ResponseField name="size" type="string | null">
      Human-readable file size, e.g. `1.32 GB`, `412.00 MB`. `null` if unavailable.
    </ResponseField>

    <ResponseField name="format" type="string">
      Container format, e.g. `MP4`, `MKV`. Uppercase.
    </ResponseField>

    <ResponseField name="server" type="string">
      Server identifier, e.g. `1`, `2`.
    </ResponseField>
  </Expandable>
</ResponseField>

***

## Status Codes

| Status | Meaning                                               |
| ------ | ----------------------------------------------------- |
| `200`  | Downloads found and returned                          |
| `401`  | Missing or invalid authentication                     |
| `403`  | Key tier does not have download access (`public` key) |
| `500`  | Server error                                          |

***

## Usage Pattern

```javascript theme={null}
async function addTVDownloadButtons(tmdbId, season, episode, containerEl) {
  const res = await fetch(
    `https://1c34-y.hf.space/api/downloads/tv/${tmdbId}/${season}/${episode}`,
    { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
  );

  if (!res.ok) {
    containerEl.textContent = 'No downloads available';
    return;
  }

  const { downloads } = await res.json();

  if (!downloads.length) {
    containerEl.textContent = 'No downloads available';
    return;
  }

  downloads.forEach(dl => {
    const a = document.createElement('a');
    a.href    = dl.url;
    a.target  = '_blank';
    a.rel     = 'noopener noreferrer';
    a.textContent = `Download ${dl.quality}${dl.size ? ` — ${dl.size}` : ''}${dl.server ? ` — Server ${dl.server}` : ''}`;
    containerEl.appendChild(a);
  });
}
```

<Warning>
  Download links are sourced from a third-party provider and may expire or become unavailable. Always handle empty `downloads` arrays and errors gracefully.
</Warning>
