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

# Download File

> Save a file from the platform's object storage to this machine.

> [!WARNING]
>
> You are reading the docs of Galtea 5.10. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/storage/download.md).

Use this to fetch the bytes behind a stored reference: a document attached to a test case, or any other URI this organization uploaded. [`datasets.download()`](https://docs.galtea.ai/v5.10/sdk/api/dataset/download) calls this method for its own dataset file.

To see it inside a whole workflow, see [Evaluate Document Inputs](https://docs.galtea.ai/v5.10/sdk/tutorials/evaluate-document-inputs.md).

## Returns

Returns the path the file was saved to.

## Example

```python theme={"system"}
downloaded_path = galtea.storage.download(test_case.input_files[0], output_directory="./.temp")
```

## Parameters

**file** `string | AttachedFile` *required*

The file to fetch: an [`AttachedFile`](https://docs.galtea.ai/v5.10/sdk/api/test-case/upload-input-file) read from `test_case.input_files`, `trace.input_files` or `trace.actual_output_files`, or the URI of any file this organization uploaded.

**output\_directory** `string` (default: the current directory)

Directory to write into, created when it does not exist. Defaults to the current directory.

**filename** `string`

Name to save the file under. Defaults to the `AttachedFile`'s own `filename`, and otherwise to the name the object is stored at, which is a random id rather than the name the file was uploaded with.

## Errors

| Error | Cause |
| - | - |
| `ValueError` | No URI was given. |
| `Exception` | The link expired, the file belongs to another organization, the platform returned no link, or the transfer failed. |

> [!NOTE]
>
> A failed download raises instead of returning `None`, and the message never contains the
> presigned link.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.