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

# Overview

> Upload files for use in messages and conversations

## File Uploads

Leavo allows you to upload images, audio, videos, and documents for use in messages and conversations.

## Supported Formats

<CardGroup cols={2}>
  <Card title="Images" icon="image">
    `.jpg`, `.jpeg`, `.png`

    Max: 10 MB (auto-compressed above 2 MB)
  </Card>

  <Card title="Audio" icon="headphones">
    `.mp3`, `.wav`, `.ogg`, `.m4a`

    Max: 10 MB
  </Card>

  <Card title="Video" icon="video">
    `.mp4`, `.webm`, `.avi`

    Max: 10 MB
  </Card>

  <Card title="Documents" icon="file">
    `.pdf`, `.doc`, `.docx`, `.xls`, `.xlsx`, `.csv`, `.txt`

    Max: 10 MB
  </Card>
</CardGroup>

## Upload Flow

<Steps>
  <Step title="Send the file">
    Make a `POST /backend/uploads` with the file as multipart/form-data.
  </Step>

  <Step title="Receive the URL">
    The API returns file metadata including the public `file_url`.
  </Step>

  <Step title="Use in messages">
    Use the `file_url` to send media in messages or reference it in other contexts.
  </Step>
</Steps>

## Automatic Image Compression

Images larger than **2 MB** are automatically compressed:

* Max dimensions: 1920 x 1920 pixels (aspect ratio preserved)
* Quality: 85% (JPEG)
* Output format: JPEG

## Upload Status

| Status       | Description                            |
| ------------ | -------------------------------------- |
| `PENDING`    | Uploaded, not yet linked to any entity |
| `ASSOCIATED` | Linked to a message or conversation    |

<Note>
  Uploads with `PENDING` status for more than 24 hours may be automatically removed by the cleanup process.
</Note>

## Endpoints

| Method   | Endpoint                             | Description              |
| -------- | ------------------------------------ | ------------------------ |
| `POST`   | `/backend/uploads`                   | Upload file              |
| `GET`    | `/backend/uploads/{id}`              | Get upload by ID         |
| `GET`    | `/backend/uploads/tenant/{tenantId}` | List tenant uploads      |
| `DELETE` | `/backend/uploads/{id}`              | Delete upload            |
| `PUT`    | `/backend/uploads/{id}/status`       | Update status            |
| `POST`   | `/backend/uploads/cleanup`           | Cleanup orphaned uploads |
