Spanish Total.js
English
Documentation For AI agents
Contents

Send files

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

.md GitHub
On this page

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

Upload

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:

{"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

FieldMeaning
nameThe name of the form field, here file.
filenameThe original file name.
extensionThe file extension.
typeThe content type of the file.
sizeThe size in bytes.
width, heightThe size of an image in pixels, 0 for other files.
urlThe download link. It starts with the address the sender used to reach OpenSync.

Download

Open the url, or fetch it:

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.

Made in Europe