> ## 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.

# Upload File

> Upload a local file to the platform's object storage.

Attaching a file to a test case input or a trace output? Use [`test_cases.upload_input_file()`](/sdk/api/test-case/upload-input-file) / `input_file_paths`, or [`traces.upload_output_file()`](/sdk/api/trace/upload-output-file) / `output_file_paths`, instead: each calls this method for you and returns the reference in the shape it expects.

Reach for this method directly to store a file for another purpose, or when you need the raw URI rather than an `AttachedFile`.

## Returns

Returns the URI the file is stored under. It still carries the upload's signature and expires. Attaching it to a test case input or to a trace output replaces it with a signature-free storage reference when the entity is written, so what you read back never expires. Never treat the uri you get here as a link to the bytes: it expires. Ask for a fresh one with [`galtea.storage.download()`](/sdk/api/storage/download) or [`galtea.storage.read()`](/sdk/api/storage/read).

## Example

```python theme={"system"}
uri = galtea.storage.upload("path/to/lease-agreement.pdf")
```

## Parameters

<ResponseField name="file_path" type="string" required>
  Path to the file on the machine running the SDK.
</ResponseField>

<ResponseField name="file_type" type="string" default="file" optional>
  What the file is for, which decides the folder it is stored under and who may read it. The default, `"file"`, is an attachment on a test case input or a trace output. The platform also accepts `"groundTruth"`, `"testFile"`, `"testCaseExport"`, `"dataCatalog"` and `"audio"`.
</ResponseField>

<ResponseField name="key" type="string" optional>
  The name the platform records the object under. Defaults to the file's own name.
</ResponseField>

## Errors

| Error | Cause |
| - | - |
| `Exception` | The platform returned no upload link, the transfer to storage failed, or storage accepted the file but returned no reference to it. |

<Note>
  A failed upload raises an error naming the file and the cause. The message never contains
  the presigned link, which grants write access to that object for 24 hours.
</Note>


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