> ## 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 Output File

> Upload a local file so it can be attached to a trace output.

> [!WARNING]
>
> You are reading the docs of Galtea 5.14. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/trace/upload-output-file.md).

Use this when you build the trace output yourself. To attach files while logging a turn, pass `output_file_paths` to [Create Trace](https://docs.galtea.ai/v5.14/sdk/api/trace/create.md), [Update Trace](https://docs.galtea.ai/v5.14/sdk/api/trace/update.md) or [Create and Evaluate Trace](https://docs.galtea.ai/v5.14/sdk/api/trace/create-and-evaluate.md) instead: it is shorter and does the same upload.

The one thing this method gives you that `output_file_paths` does not is reuse. Upload a document once and attach the same `AttachedFile` to many turns, rather than uploading it per turn.

This is the answer-side twin of [Upload Input File](https://docs.galtea.ai/v5.14/sdk/api/test-case/upload-input-file.md).

## Returns

Returns an `AttachedFile` with `uri`, `filename` and `mime_type`. Place it in the output's `content` list.

The `uri` still carries the upload's signature and expires. The API replaces it with a signature-free storage reference when the turn is written, so `trace.actual_output_files` reads back a uri that does not expire and grants nobody the bytes on its own. Never treat either form as a link to the bytes: ask for a fresh one with [`galtea.storage.download()`](https://docs.galtea.ai/v5.14/sdk/api/storage/download) or [`galtea.storage.read()`](https://docs.galtea.ai/v5.14/sdk/api/storage/read).

> [!NOTE]
>
> `AttachedFile` is the object that used to be called `InputFile`, back when only an input could carry files. The same four fields now describe a file on either side. `InputFile` still works as a name for it, so code you already wrote keeps running, but it now warns with a `GalteaDeprecationWarning`. Switch to `AttachedFile` when you next touch that code.

## Example

```python theme={"system"}
lease = galtea.traces.upload_output_file("path/to/lease-agreement.pdf")

for question in ["Send me the lease again", "And a copy for my records"]:
    galtea.traces.create(
        session_id=session.id,
        input=question,
        output={"assistant_message": "Attached.", "content": [lease.model_dump(by_alias=True)]},
    )
```

## Parameters

**file\_path** `string` *required*

Path to the file on the machine running the SDK. One output accepts at most 20 files, 20 MB in total, and each must be one of these types: `pdf`, `docx`, `xlsx`, `pptx`, `rtf`, `png`, `jpg`, `jpeg`, `tiff`, `tif`, `bmp`, `webp`, `heic`, `heif`, `gif`, `txt`, `csv`, `md`, `html`, `xml`, `json`, `eml`. A storage URI is refused: there is nothing on this machine to upload, so attach it directly instead.

> [!WARNING]
>
> Evaluators cannot read output files yet. A metric that reads the output is **skipped** when no turn of the session answered with text of its own, counting neither a file nor a note sent beside one, with the reason `Evaluators cannot read output files yet.` One turn carrying text of its own is enough for this API check. On deployments that do not send files to the judge, the evaluator also skips LLM-as-a-judge metrics other than the DeepEval-based ones. It does so when any turn the metric reads carries an output file, and the reason names the file. Log the text your pipeline produced as the turn output, without the file, to have it scored. See [Output Files](https://docs.galtea.ai/v5.14/concepts/product/version/session/trace.md#trace-properties).

## Related Methods

* [Create Trace](https://docs.galtea.ai/v5.14/sdk/api/trace/create.md) - Log a turn and attach files in one call
* [Update Trace](https://docs.galtea.ai/v5.14/sdk/api/trace/update.md) - Attach files to a turn you already logged
* [Upload Input File](https://docs.galtea.ai/v5.14/sdk/api/test-case/upload-input-file.md) - The same method on the input side


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