Spanish Total.js
English
Documentation For AI agents
Contents

Message format

The fields of the messages that OpenSync sends to clients.

.md GitHub
On this page

Every request to /sync/{channel}/ and every WebSocket notify becomes one JSON message. Clients get the same message over WebSocket and Server-Sent Events.

Example

{"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":[]}

Fields

FieldTypeMeaning
idstringA unique ID of the message.
typestringThe content type of the request, without parameters such as boundary: application/json, application/x-www-form-urlencoded, multipart/form-data, text/plain… Empty for a request without a body. Always application/json for a WebSocket message.
channelstringThe channel.
methodstringGET, POST, PUT, PATCH, DELETE, or SOCKET for a WebSocket message.
headersobjectThe request headers, with lower-case names. Empty for a WebSocket message.
uastringA short form of the browser and system from the User-Agent header, for example Mac Chrome. Empty for scripts and tools such as curl.
queryobjectThe query arguments, as strings.
bodyobject or stringJSON and form data as an object, other content as text, an empty string without a body.
tsstringThe time OpenSync received the request (ISO 8601, UTC).
ipstringThe IP address of the sender.
filesarrayThe uploaded files. See Send files.
dtcreatedstringOnly while Log all requests is on: the time the message was logged.

The init message

When a client connects, it first gets:

{"type":"init","name":"Demo sync","version":1,"id":"OpenSync"}
FieldMeaning
typeAlways init.
nameThe instance name from the Setup page.
versionThe OpenSync version number, 1.
idAlways OpenSync.
Made in Europe