Skip to main content
GET
/
:projectId
/
api
/
v7
/
push-notifications
/
preferences
Get Notification Preferences
curl --request GET \
  --url https://api.sublay.io/api/v6/:projectId/api/v7/push-notifications/preferences
import requests

url = "https://api.sublay.io/api/v6/:projectId/api/v7/push-notifications/preferences"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://api.sublay.io/api/v6/:projectId/api/v7/push-notifications/preferences', 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.sublay.io/api/v6/:projectId/api/v7/push-notifications/preferences",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$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.sublay.io/api/v6/:projectId/api/v7/push-notifications/preferences"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.sublay.io/api/v6/:projectId/api/v7/push-notifications/preferences")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.sublay.io/api/v6/:projectId/api/v7/push-notifications/preferences")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "disabledTypes": [
    "<string>"
  ]
}
Returns the set of notification event types the acting user has disabled for push. A user with no preference row is all-on — the response is an empty disabledTypes array. Disabling a type only suppresses push; the in-app notification is still written. Requires authentication. Acting-user-scoped: an end-user token (Authorization: Bearer <accessToken>) reads its own preferences. A service/master key acts on behalf of a named user via the optional userId query param — a service key without userId is rejected, and an end-user token may not name a different user. Requires the push bundle.

Query Parameters

userId
string
The acting user whose preferences are read. Service/master keys only — a service key must pass it; an end-user token infers it from the auth token and may not name a different user.

Response

Returns 200.
{ "disabledTypes": ["new-follow", "message"] }
disabledTypes
string[]
The event types the user has opted out of. Empty when no preferences are set (all-on). Values are drawn from the event palette.

Error Responses

{ "error": "Unauthorized", "code": "notification-preferences/unauthorized" }
403 notification-preferences/unauthorized when an end-user token names a userId other than its own. A 401 is returned when no valid credential is present.
{ "error": "Missing user ID", "code": "notification-preferences/missing-user-id" }
Returned when a service/master key omits the required userId (it has no implicit session user).
{ "error": "...", "code": "database/tables-not-available" }
Returned when the push bundle is not installed for this project.

See Also