Ban Member
curl --request PATCH \
--url https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban"
payload = { "reason": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban', 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/v8/:projectId/spaces/:spaceId/members/:memberId/ban",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"membership": {}
}Space — Membership
Ban Member
Ban a member from a space
Ban Member
curl --request PATCH \
--url https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban"
payload = { "reason": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban', 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/v8/:projectId/spaces/:spaceId/members/:memberId/ban",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/ban")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"membership": {}
}Sets a member’s status to
See also: useBanMember, Unban Member
"banned", in this space and the child spaces where they are an active member (a pending or rejected request in a child space is left as it is), and ends their membership of those spaces’ chats, so they can no longer post to or receive them (they keep read access to messages from before the ban). A request to join that is still pending can be banned too. Requires the caller to be a moderator or admin. Moderators can only ban regular members. Only the space creator can ban admins, and the last admin cannot be banned.
Path Parameters
string
required
UUID of the space.
string
required
UUID of the membership record to ban.
Body
string
Optional reason for the ban, kept with who banned them in the space’s ban log.
Response
string
Confirmation message.
object
The updated membership record with
status: "banned".Error Responses
Membership Not Found — 404
Membership Not Found — 404
{ "error": "Membership not found.", "code": "space/membership-not-found" }
Already Banned — 409
Already Banned — 409
The member is already banned here. The ban is still re-applied to their active memberships in child spaces, under the same rules as a first ban, so a repeated ban can instead return one of the errors below.
{ "error": "This member is already banned.", "code": "space/already-banned" }
Insufficient Permissions — 403
Insufficient Permissions — 403
A moderator banning someone who is a moderator or admin in this space or in a child space the ban reaches.
spaceId names that space.{ "error": "Moderators can only ban regular members.", "code": "space/insufficient-permissions", "spaceId": "…" }
Creator Required — 403
Creator Required — 403
Someone other than the space creator banning a member who is an admin in this space or in a child space the ban reaches.
spaceId names that space.{ "error": "Only the space creator can ban admins.", "code": "space/creator-required", "spaceId": "…" }
Last Admin — 400
Last Admin — 400
The member is the last admin of this space or of a child space the ban reaches.
spaceId names that space.{ "error": "Cannot ban the last admin. Promote another member to admin first.", "code": "space/last-admin", "spaceId": "…" }

