Remove From Subtree
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree"
payload = { "actingUserId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({actingUserId: '<string>'})
};
fetch('https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree', 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/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'actingUserId' => '<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/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree"
payload := strings.NewReader("{\n \"actingUserId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"removedCount": 123,
"removed": [
{}
],
"skippedCount": 123,
"skipped": [
{}
]
}Workspace — Membership
Remove From Subtree
Offboarding convenience — remove a user from this workspace and the descendants you can reach
Remove From Subtree
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree"
payload = { "actingUserId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({actingUserId: '<string>'})
};
fetch('https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree', 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/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'actingUserId' => '<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/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree"
payload := strings.NewReader("{\n \"actingUserId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspaces/:id/members/:userId/remove-from-subtree")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"removedCount": 123,
"removed": [
{}
],
"skippedCount": 123,
"skipped": [
{}
]
}Removes the target user’s direct memberships on this workspace and every descendant you can reach, in one action. An owner (or ancestor owner) reaches the whole subtree via the god-path; a non-owner reaches a descendant when they hold
A service/master key called this route without naming an
A plain user token sent an
Every path id on the workspaces bundle is checked for UUID shape before the route runs, so a malformed one is a plain
remove-member there — which they may hold either by reaching in through an unbroken open inherit chain, or by holding a direct member row on that node. So sealing (inheritsFromParent = false) stops authority reaching in from above; it does not stop authority held locally. A non-owner who is a direct member of a sealed child with remove-member there does sweep it. The credential does not widen this — actingUserId is required here, so a service/master key always sweeps as the user it names, with that user’s reach; act as the owner for a full sweep. Reach-based access auto-revokes with the relevant ancestor membership. Each membership-row deletion fires workspace.member.removed. Rank rules apply per node — the sweep is refused (403 workspace/insufficient-rank) if you are outranked by the target at any node where you both hold a direct member row.
Owned-descendant handling — block + report. Because owners have no member row, this sweep does not cover descendant workspaces the user owns. Instead it blocks and reports them (409 workspace/owns-descendants) rather than silently orphaning ownership. An admin or any ancestor owner then reassigns each via transfer-ownership or deletes it. No silent ownership change.
A non-owner’s sweep may be partial — check
skipped before you call someone offboarded. If the target still holds a membership in a descendant you cannot reach, the 200 reports it in skippedCount / skipped. removedCount alone does not mean the user is gone from the subtree: treat any skippedCount > 0 as “still a member somewhere” and escalate to an owner or ancestor owner of that node. Only an owner or ancestor owner is guaranteed skippedCount: 0. A service/master key is not — it must name an actingUserId on this route, and inherits that user’s reach, so a key acting as a mid-level admin can absolutely come back with skippedCount > 0. See Acting on behalf of a user.Path Parameters
string
required
The workspace UUID (subtree root).
string
required
The user to offboard.
Body Parameters
string
required
Service/master keys only — the acting user (must hold
remove-member, rank-bounded per node). Required for a key: there is no unbounded path on this route, so the sweep’s reach is always that user’s — a key that names nobody is refused with 400 workspace/missing-user-id. Name the owner for a full-subtree sweep.A plain user token omits it — the actor is the token’s own user. The field is not ignored for such a token: sending your own user id is a harmless no-op, but sending anyone else’s is a 403 workspace/unauthorized. See Acting on behalf of a user.Response
{
"removedCount": 3,
"removed": [
{ "workspaceId": "ws_a", "userId": "u_pat" },
{ "workspaceId": "ws_b", "userId": "u_pat" },
{ "workspaceId": "ws_c", "userId": "u_pat" }
],
"skippedCount": 2,
"skipped": [
{ "id": "ws_d", "name": "Finance", "reason": "out-of-reach" },
{ "id": null, "name": null, "reason": "out-of-reach" }
]
}
number
How many membership rows were torn down.
object[]
One
{ workspaceId, userId } entry per removed membership.number
How many memberships the target retained because the sweep could not reach them.
0 for an owner or ancestor owner. A service/master key gets whatever its acting user gets — the credential grants no extra reach here. Equals skipped.length.object[]
One entry per retained membership — the descendants where the target is still a member after this call.
id/name— the workspace, mirroring theownedWorkspacesshape on the 409. Both arenullwhen you have no standing on that workspace: the sweep tells you a membership survived, but does not disclose the existence or name of a sealed sub-workspace you have no authority over. This is the same sealing fence the roster read applies toinclude=descendants. Get an owner or ancestor owner of that branch to finish the offboarding.reason— currently always"out-of-reach": your authority does not extend to removing members there.
skipped covers surviving memberships only. Descendants the target owns are handled by the separate 409 workspace/owns-descendants block, and an owned descendant outside a non-owner’s reach is neither swept nor reported here — an owner re-running the sweep will surface it as the 409.Error Responses
Owns Descendants — 409
Owns Descendants — 409
{
"error": "The user owns workspaces in this subtree. Transfer or delete them first.",
"code": "workspace/owns-descendants",
"ownedWorkspaces": [{ "id": "ws_d", "name": "Client X" }]
}
Insufficient Rank — 403
Insufficient Rank — 403
{ "error": "You may only remove members ranked strictly below you.", "code": "workspace/insufficient-rank" }
Missing Acting User — 400
Missing Acting User — 400
{ "error": "Missing user ID", "code": "workspace/missing-user-id" }
actingUserId. The sweep’s reach is defined by the acting user’s standing per node, so it must be performed as somebody.Acted as Another User — 403
Acted as Another User — 403
{ "error": "Unauthorized", "code": "workspace/unauthorized" }
actingUserId naming a different user. Only a service/master key may act as someone else.Invalid Path Parameter — 400
Invalid Path Parameter — 400
{ "error": "Invalid workspace id: expected a UUID.", "code": "workspace/invalid-params" }
400 rather than a 500 from the database.
