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

# Download File

> Download a gallery file or follow the redirect to the provider playback URL.

## Method

`GET` `/v1/gallery/download/:id`

## Path Parameters

<ParamField path="id" type="string">Gallery file ID.</ParamField>

## Headers

<ParamField header="Authorization" type="string">Bearer token (e.g. <code>Authorization: Bearer YOUR\_API\_KEY</code>)</ParamField>

## Request Example

<RequestExample>
  ```bash cURL theme={null}
  curl -L "https://api.voyantcloud.com/v1/gallery/download/gal_file_123" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -o hero.jpg
  ```

  ```javascript Node.js theme={null}
  const res = await fetch("https://api.voyantcloud.com/v1/gallery/download/gal_file_123", {
    headers: { Authorization: `Bearer ${process.env.VOYANT_API_KEY}` },
  })

  if (res.redirected) {
    console.log("Follow redirect to", res.url)
  } else {
    const buffer = await res.arrayBuffer()
    await fs.promises.writeFile("hero.jpg", Buffer.from(buffer))
  }
  ```

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

  resp = requests.get(
    "https://api.voyantcloud.com/v1/gallery/download/gal_file_123",
    headers={"Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}"},
    allow_redirects=True,
  )

  with open("hero.jpg", "wb") as fh:
    fh.write(resp.content)
  ```
</RequestExample>

## Response

* **302 redirect** – Videos stored in Cloudflare Stream (or other providers with playback URLs) redirect to the playback URL (`hls`, `dash`, or `primary`).
* **200 OK** – For assets stored in R2 or Cloudflare Images, the API streams the binary file with `Content-Disposition: attachment`.

<Note>Files in `status: deleting` or `deleted` return `404`. Respect the redirect URL’s authentication model (Stream URLs expire if you configured signed delivery).</Note>
