Update Member Role
curl --request PATCH \
--url https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>"
}
'import requests
url = "https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role"
payload = { "role": "<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({role: '<string>'})
};
fetch('https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role', 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/role",
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([
'role' => '<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/role"
payload := strings.NewReader("{\n \"role\": \"<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/role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role")
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 \"role\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"membership": {}
}Space — Membership
Update Member Role
Update a member’s role within a space
Update Member Role
curl --request PATCH \
--url https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>"
}
'import requests
url = "https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role"
payload = { "role": "<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({role: '<string>'})
};
fetch('https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role', 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/role",
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([
'role' => '<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/role"
payload := strings.NewReader("{\n \"role\": \"<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/role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/spaces/:spaceId/members/:memberId/role")
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 \"role\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"membership": {}
}Changes a member’s role. Only space admins can perform this action. The role also applies in the space’s child spaces. Raising someone’s role gives it to them there too, but never lowers a role they already hold there: someone who is a regular member here and an admin of a child space stays an admin there when made a moderator here. Lowering someone’s role lowers it there too: an admin made a moderator becomes a moderator in the child spaces, and a regular member loses
Lowering a role also lowers it in the child spaces, so it is refused too when the member is the last admin of one of them, named by
See also: useUpdateMemberRole
"admin" and "moderator" there. Giving someone the role they already have changes nothing, here or in the child spaces.
Path Parameters
string
required
UUID of the space.
string
required
UUID of the membership record to update.
Body Parameters
string
required
New role:
"admin", "moderator", or "member".Response
string
Confirmation message.
object
Updated membership with
id, role, status, joinedAt, and userId.Errors
Membership Not Found — 404
Membership Not Found — 404
{ "error": "Membership not found.", "code": "space/membership-not-found" }
Creator Required — 403
Creator Required — 403
Someone other than the space creator (or a service or master key) promoting a member to, or demoting them from,
"admin".{ "error": "Only the space creator can promote or demote admins.", "code": "space/creator-required" }
Last Admin — 400
Last Admin — 400
{ "error": "Cannot demote the last admin. Promote another member to admin first.", "code": "space/last-admin" }
spaceId:{ "error": "This member is the last admin of a child space. Promote another member to admin there first.", "code": "space/last-admin", "spaceId": "…" }
Member Banned — 409
Member Banned — 409
Raising a member to
"moderator" or "admin" while they are banned in this space or in one of its child spaces (the role also applies in the child spaces). Lowering a banned member’s role is allowed. bannedSpaceIds lists where the bans are, so they can be lifted first with Unban Member.{ "error": "This member is banned in this space or one of its child spaces. Lift those bans before giving them a role.", "code": "space/member-banned", "bannedSpaceIds": ["…"] }
Member Not Active — 409
Member Not Active — 409
Raising a member to
"moderator" or "admin" while their request is pending or was rejected.{ "error": "Only an active member can be given a role.", "code": "space/member-not-active" }

