Toggle notification mute
curl --request PATCH \
--url https://api.example.com/api/v1/me/notificationsimport requests
url = "https://api.example.com/api/v1/me/notifications"
response = requests.patch(url)
print(response.text)const options = {method: 'PATCH'};
fetch('https://api.example.com/api/v1/me/notifications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/me/notifications",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/me/notifications"
req, _ := http.NewRequest("PATCH", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/api/v1/me/notifications")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/me/notifications")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
response = http.request(request)
puts response.read_bodyMe
Toggle notification mute
Globally mute or unmute push notifications for the authenticated user. The worker honours this BEFORE consulting individual tokens.
PATCH
/
api
/
v1
/
me
/
notifications
Toggle notification mute
curl --request PATCH \
--url https://api.example.com/api/v1/me/notificationsimport requests
url = "https://api.example.com/api/v1/me/notifications"
response = requests.patch(url)
print(response.text)const options = {method: 'PATCH'};
fetch('https://api.example.com/api/v1/me/notifications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/me/notifications",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/me/notifications"
req, _ := http.NewRequest("PATCH", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/api/v1/me/notifications")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/me/notifications")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
response = http.request(request)
puts response.read_bodyOverview
Sets the user’snotificationsMuted boolean. The push-delivery worker consults this flag on every job and skips the send entirely when it’s true — except for jobs with kind: 'critical' (account banned, security alerts, etc.), which bypass the mute. See Push notification fan-out — Mute semantics for the precedence rules.
This is a global mute, not per-conversation. Per-conversation mutes are deferred to a later phase; the data model already has the user-side flag but no UI granularity exists today.
Authentication
Bearer <accessToken> required. requireAuth + requireOnboarded middleware applied.
Path parameters
None.Query parameters
None.Request body
| Field | Type | Required | Notes | Example |
|---|---|---|---|---|
notificationsMuted | boolean | yes | true to suppress all non-critical push for this user. false to resume normal delivery. | true |
Example payload
{ "notificationsMuted": true }
Response — 200 OK
| Field | Type | Notes | Example |
|---|---|---|---|
success | boolean | Always true. | true |
notificationsMuted | boolean | Echoes the value just set, so the client can update local state without a re-read. | true |
{ "success": true, "notificationsMuted": true }
What the mute affects
Push kind | When notificationsMuted: true |
|---|---|
message.new | Skipped by the worker. |
match.new | Skipped. |
tenancy.approved | Skipped. |
critical | Delivered — bypasses the mute. Reserved for security / account-state events that the user MUST see (account banned, password reset confirmation, etc.). Phase 7. |
Side effects
- Sets the user’s
notificationsMutedfield to the new value. - Does NOT cancel already-enqueued push jobs. A burst of messages delivered to BullMQ just before the user mutes may still result in 1–2 already-claimed jobs running, but they’ll be dropped at the worker’s mute check.
Error responses
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | notificationsMuted missing or not a boolean. |
| 401 | UNAUTHENTICATED | Missing, malformed, or expired access token. |
| 403 | ONBOARDING_INCOMPLETE | Caller has not finished onboarding. |
Example error — 400 VALIDATION_FAILED
{
"type": "https://api.swappr.co.uk/errors/validation-failed",
"title": "Validation failed",
"status": 400,
"code": "VALIDATION_FAILED",
"detail": "Request body failed validation",
"instance": "/api/v1/me/notifications",
"requestId": "01HZQ7K3M4N5P6Q7R8S9T0V1W2",
"errors": [
{ "path": "notificationsMuted", "message": "Invalid input: expected boolean", "code": "invalid_type" }
]
}
See also
- Push notification fan-out — the worker logic that honours the mute.
- Register push token — the per-device subscription side.
curl
curl -X PATCH https://api.swappr.co.uk/api/v1/me/notifications \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "notificationsMuted": true }'