Endpoint
POST
https://notification.magicrunez.com/send
Headers
| Header | Required | Description |
| Content-Type |
required |
Must be application/json |
| X-Tenant-ID |
optional |
Scopes the message to a specific tenant. Falls back to the server's default tenant when omitted. |
Request Body
| Field | Required | Description |
| to |
required |
Array of targets. Each target has a type ("user" or "group")
and an id (string or array of strings).
|
| type |
optional |
A label for the kind of message, e.g. "alert", "chat". Defaults to an empty string. |
| message |
optional |
Human-readable notification text. |
| data |
optional |
Arbitrary payload. Can be a JSON object or a pre-stringified JSON string. |
{
"to": [
{ "type": "user", "id": "1" },
{ "type": "group", "id": ["1", "8"] }
],
"type": "alert",
"message": "Server-side push",
"data": { "priority": "high" }
}
Example Request
curl
curl -X POST https://notification.magicrunez.com/send \
-H "Content-Type: application/json" \
-H "X-Tenant-ID: cf351165-3655-11f1-bd36-00505661e513" \
-d '{
"to": [
{ "type": "user", "id": "1" },
{ "type": "group", "id": ["1", "8"] }
],
"type": "alert",
"message": "Server-side push",
"data": { "priority": "high" }
}'
JavaScript (fetch)
await fetch('https://notification.magicrunez.com/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Tenant-ID': 'cf351165-3655-11f1-bd36-00505661e513',
},
body: JSON.stringify({
to: [{ type: 'user', id: '1' }, { type: 'group', id: ['1', '8'] }],
type: 'alert',
message: 'Server-side push',
data: { priority: 'high' },
}),
});
Response
Success — 200 OK
{
"ok": true,
"tenantId": "cf351165-3655-11f1-bd36-00505661e513",
"delivered": 3,
"to": [{ "type": "user", "id": "1" }, { "type": "group", "id": ["1", "8"] }],
"type": "alert",
"message": "Server-side push",
"data": "{\"priority\":\"high\"}"
}
delivered is the number of connected WebSocket clients the message was sent to at the time of the request. Clients that are offline will not receive it.
Errors
| Status | Reason |
| 400 | to is missing, empty, or contains a target without type / id |
| 400 | target.type is not "user" or "group" |
Targeting
The to array can mix users and groups in one request. A single id targets one recipient; an array of ids targets multiple in one entry.
| Example | Targets |
{ "type": "user", "id": "42" } |
User 42 only |
{ "type": "group", "id": "admins" } |
All connected members of the admins group |
{ "type": "group", "id": ["admins", "support"] } |
All connected members of admins and support |
The tenant is determined by the X-Tenant-ID header. Messages are only delivered to clients registered under the same tenant.