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

# Upload files

> Upload documents or videos to managed storage for processing.

Upload a file to the Data Ingestion service. The file is stored under your account and assigned a unique ID that remains valid until expiration.

## Request parameters

<ParamField body="file" type="binary" required>
  The file content to upload (multipart form data).
</ParamField>

<ParamField body="expires_in_days" type="integer" default="30">
  Number of days until the file expires and is automatically deleted.
</ParamField>

## Upload a file

<Tabs>
  <Tab title="TypeScript">
    ```ts theme={null}
    import { DataIngestionClient } from "@trelent/data-ingestion";
    import { readFileSync } from "fs";

    const client = new DataIngestionClient();

    const fileBuffer = readFileSync("document.pdf");
    const blob = new Blob([fileBuffer], { type: "application/pdf" });

    const upload = await client.uploadFile(blob, "document.pdf", { expiresInDays: 7 });
    console.log("File ID:", upload.id);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from pathlib import Path
    from trelent_data_ingestion_sdk import DataIngestionClient

    client = DataIngestionClient()

    file_data = Path("document.pdf").read_bytes()
    upload = client.upload_file(
        file_data,
        "document.pdf",
        content_type="application/pdf",
        expires_in_days=7,
    )
    print("File ID:", upload.id)
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X PUT "${API_URL}/v1/data-ingestion/files/" \
      -H "Authorization: Bearer ${API_TOKEN}" \
      -F "file=@document.pdf" \
      -F "expires_in_days=7"
    ```
  </Tab>
</Tabs>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "id": "e2d4c3d2-41c0-4a6b-a387-580807fb5ad2"
  }
  ```
</ResponseExample>

## Response fields

<ResponseField name="id" type="uuid">
  Unique identifier for the uploaded file. Use this ID when creating jobs with the [file connector](/data-ingestion/connectors/file-upload).
</ResponseField>

## Supported file types

The API accepts a wide range of document, video, and media formats:

| Category | Formats                                                                     |
| -------- | --------------------------------------------------------------------------- |
| Office   | DOCX, DOC, DOTX, DOTM, DOCM, PPTX, POTX, PPSX, PPTM, POTM, PPSM, XLSX, XLSM |
| PDF      | PDF                                                                         |
| Markup   | MD, HTML, HTM, XHTML, XML, NXML                                             |
| Data     | CSV, TXT, VTT                                                               |
| Images   | JPG, JPEG, PNG, TIF, TIFF, BMP, WEBP                                        |
| Video    | MP4, AVI, MOV, WMV, MKV, FLV, WEBM, M4V                                     |

<Tip>
  Set a shorter `expires_in_days` value if you only need the file for a single job. This reduces storage costs and keeps your file list clean.
</Tip>
