---
title: Send files
project: OpenSync
version: 1.0
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/opensync/1-0/reference/files/
updated: 2026-11-19T09:22:09.965Z
---

# Send files

> Upload files to a channel and download them from the link in the message.

Send files as `multipart/form-data` with `POST` or `PUT` to `/sync/{channel}/`. A request can be up to about 2 MB.

## Upload

```bash
curl -F "file=@invoice.txt" "https://sync.example.com/sync/invoices/"
```

OpenSync answers `200` with an empty body. The clients get a message with `"type":"multipart/form-data"` and one entry in `files` for each file:

```json
{"id":"24nb4005pu51d","type":"multipart/form-data","channel":"invoices","method":"POST","headers":{"host":"sync.example.com","user-agent":"curl/8.7.1","accept":"*/*","content-length":"230","content-type":"multipart/form-data; boundary=------------------------XS4ofo3RtD8jr9XpifhgO5"},"ua":"","query":{},"body":"","ts":"2026-11-19T08:04:51.696Z","ip":"203.0.113.10","files":[{"name":"file","filename":"invoice.txt","extension":"txt","type":"text/plain","size":29,"width":0,"height":0,"url":"https://sync.example.com/download/wzsufi.dat"}]}
```

## File fields

| Field | Meaning |
|---|---|
| `name` | The name of the form field, here `file`. |
| `filename` | The original file name. |
| `extension` | The file extension. |
| `type` | The content type of the file. |
| `size` | The size in bytes. |
| `width`, `height` | The size of an image in pixels, `0` for other files. |
| `url` | The download link. It starts with the address the sender used to reach OpenSync. |

## Download

Open the `url`, or fetch it:

```bash
curl -o invoice.txt "https://sync.example.com/download/wzsufi.dat"
```

The file comes back as a download with its original name (`Content-Disposition: attachment`). The link needs no token.

Download the file as soon as your client gets the message. Links are temporary: they stop working when OpenSync restarts, and an unknown link answers `404`.

## Too large

A file upload larger than about 2 MB is refused with `431`, and no message is sent. To share larger files, store them somewhere else and send their address in a JSON message.
