Spanish Total.js
English
Documentation For AI agents
Contents

Send data over HTTP

Send a request to /sync/{channel}/ to deliver its data to the clients of that channel.

.md GitHub
On this page
GET    /sync/{channel}/
POST   /sync/{channel}/
PUT    /sync/{channel}/
PATCH  /sync/{channel}/
DELETE /sync/{channel}/

Send any of these requests, and OpenSync delivers it as a message to every client that can read {channel}. Pick any channel name, for example orders, stock or Orders-EU_2; channels do not need to be created first.

OpenSync answers 200 with an empty body, also when no client is connected. Sending needs no token. See Run in production to decide who can reach this address.

JSON

curl -X POST -H "Content-Type: application/json" -d '{"id":1002,"status":"paid"}' "https://sync.example.com/sync/orders/"

The clients receive the JSON as an object in body:

{"id":"24nb4004pu50d","type":"application/json","channel":"orders","method":"POST","headers":{"host":"sync.example.com","user-agent":"curl/8.7.1","accept":"*/*","content-type":"application/json","content-length":"27"},"ua":"","query":{},"body":{"id":1002,"status":"paid"},"ts":"2026-11-19T08:04:51.361Z","ip":"203.0.113.10","files":[]}

Form data

curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d "sku=A-100&qty=7" "https://sync.example.com/sync/stock/"

The fields arrive as an object of strings: "body":{"sku":"A-100","qty":"7"}.

Plain text and other types

Any other content type arrives as text. A PATCH with Content-Type: text/plain and the body hello arrives as "type":"text/plain" and "body":"hello".

Query arguments only

curl "https://sync.example.com/sync/orders/?id=1001&status=paid"
curl -X DELETE "https://sync.example.com/sync/orders/?id=1001"

The arguments arrive in query, for example "query":{"id":"1001","status":"paid"}, and body is an empty string.

Files

Send files as multipart/form-data with POST or PUT. See Send files.

Requests that are not delivered

RequestAnswer
Another method, for example OPTIONS404
A deeper path, for example /sync/a/b/404
A file upload larger than about 2 MB431

See Status codes and limits.

Made in Europe