Transfer Ownership
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"newOwnerId": "<string>",
"previousOwnerDisposition": "<string>",
"previousOwnerRank": 123,
"previousOwnerCapabilities": [
"<string>"
],
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership"
payload = {
"newOwnerId": "<string>",
"previousOwnerDisposition": "<string>",
"previousOwnerRank": 123,
"previousOwnerCapabilities": ["<string>"],
"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({
newOwnerId: '<string>',
previousOwnerDisposition: '<string>',
previousOwnerRank: 123,
previousOwnerCapabilities: ['<string>'],
actingUserId: '<string>'
})
};
fetch('https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership', 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/transfer-ownership",
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([
'newOwnerId' => '<string>',
'previousOwnerDisposition' => '<string>',
'previousOwnerRank' => 123,
'previousOwnerCapabilities' => [
'<string>'
],
'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/transfer-ownership"
payload := strings.NewReader("{\n \"newOwnerId\": \"<string>\",\n \"previousOwnerDisposition\": \"<string>\",\n \"previousOwnerRank\": 123,\n \"previousOwnerCapabilities\": [\n \"<string>\"\n ],\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/transfer-ownership")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"newOwnerId\": \"<string>\",\n \"previousOwnerDisposition\": \"<string>\",\n \"previousOwnerRank\": 123,\n \"previousOwnerCapabilities\": [\n \"<string>\"\n ],\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership")
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 \"newOwnerId\": \"<string>\",\n \"previousOwnerDisposition\": \"<string>\",\n \"previousOwnerRank\": 123,\n \"previousOwnerCapabilities\": [\n \"<string>\"\n ],\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyWorkspace Endpoints
Transfer Ownership
Owner-only ownership transfer, keeping ownerId and member rows disjoint
Transfer Ownership
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"newOwnerId": "<string>",
"previousOwnerDisposition": "<string>",
"previousOwnerRank": 123,
"previousOwnerCapabilities": [
"<string>"
],
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership"
payload = {
"newOwnerId": "<string>",
"previousOwnerDisposition": "<string>",
"previousOwnerRank": 123,
"previousOwnerCapabilities": ["<string>"],
"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({
newOwnerId: '<string>',
previousOwnerDisposition: '<string>',
previousOwnerRank: 123,
previousOwnerCapabilities: ['<string>'],
actingUserId: '<string>'
})
};
fetch('https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership', 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/transfer-ownership",
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([
'newOwnerId' => '<string>',
'previousOwnerDisposition' => '<string>',
'previousOwnerRank' => 123,
'previousOwnerCapabilities' => [
'<string>'
],
'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/transfer-ownership"
payload := strings.NewReader("{\n \"newOwnerId\": \"<string>\",\n \"previousOwnerDisposition\": \"<string>\",\n \"previousOwnerRank\": 123,\n \"previousOwnerCapabilities\": [\n \"<string>\"\n ],\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/transfer-ownership")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"newOwnerId\": \"<string>\",\n \"previousOwnerDisposition\": \"<string>\",\n \"previousOwnerRank\": 123,\n \"previousOwnerCapabilities\": [\n \"<string>\"\n ],\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspaces/:id/transfer-ownership")
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 \"newOwnerId\": \"<string>\",\n \"previousOwnerDisposition\": \"<string>\",\n \"previousOwnerRank\": 123,\n \"previousOwnerCapabilities\": [\n \"<string>\"\n ],\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyReassigns a workspace’s
Every path id on the workspaces bundle is checked for UUID shape before the route runs, so a malformed one is a plain
Every workspaces endpoint declares its fields exactly, and a top-level field it does not declare is refused rather than ignored — in the request body and in the query string alike, for every caller. Two or more at once are named together:
Returned when a service/master key sends a body with a
ownerId. Doable by the workspace’s own owner OR any ancestor owner (owners only — never a capability or reach). Runs in one transaction with a row lock to serialize concurrent transfers.
- The new owner must be a verified user (any verified user in the tenant — need not already be a member).
- The new owner’s existing member row (if any) is removed to keep
ownerIdand member rows disjoint (firesworkspace.member.removed). - The previous owner is either demoted into a fresh member row (fires
workspace.member.added) or removed. It defaults toremovewhenever the field is omitted — on a voluntary self-transfer as much as on an ancestor-owner reassign. SendpreviousOwnerDisposition: "demote"to keep the outgoing owner on the roster. On demote, rank defaults to one rung below the acting user — rank0for the usual apex actor, but one below their own row when the acting ancestor owner also sits in this workspace’s ladder.
Ancestor-owner transfer is what makes offboarding resolvable — a manager can reassign a fired member’s owned sub-workspace without that member’s access.
Path Parameters
string
required
The workspace UUID.
Body Parameters
string
required
The new owner — any verified user in the tenant.
string
"demote" or "remove". Defaults to "remove" when omitted, on every path — including a voluntary self-transfer.number
On demote, the ex-owner’s rank. Absolute only — there is no relative form here.Defaults to one rung below the acting user’s own anchor: rank
0 when the actor is apex (an owner or ancestor owner with no member row on this workspace, which is the usual case), and actorRank + 1 when the acting ancestor owner does hold a row here — so the default never seats the outgoing owner above the person doing the transfer. An explicit value is honored verbatim and is deliberately unbounded, matching the other ownership carve-outs.string[]
On demote, the ex-owner’s capabilities.
string
Service/master keys only — the user to act as. Enforced: the owner-only guard runs against the named user, so a key naming a non-owner is refused exactly as that user would be. Omitting it alongside
newOwnerId is a supported unbounded call — newOwnerId is a declared field of this endpoint, so it is accepted on its own terms. Omit it to act as the app itself (unbounded) — but on a call that hands the workspace to a new owner, prefer naming the current owner so the request carries a user id. See Acting on behalf of a user.The node SDK is stricter than this endpoint: it types actingUserId as required here, so omitting it is only possible by calling the REST route directly.Several shapes are refused rather than ignored on this path. actingUserId: "" or null is a 400 — it reads as an attempt to name someone, not as “nobody”. So is every top-level field this endpoint does not declare, in the body and in the query string alike, for every caller: onBehalfOf, acting_user_id and impersonate all come back as Unrecognized key: "…" rather than being quietly dropped. A key that differs from actingUserId only in capitalization — actingUserID, actinguserid — is refused too, but with a “did you mean actingUserId?” message instead of the generic one. And when the request names nobody, so is any body whose Content-Type is not application/json — an unparsed body discards the actingUserId inside it just as surely as a misspelling would. See Shapes the server rejects.Response
Returns the updated Workspace object with the newownerId.
Error Responses
Unauthorized — 403
Unauthorized — 403
{ "error": "Owner access required", "code": "workspace/unauthorized" }
New Owner Not Verified — 403
New Owner Not Verified — 403
{ "error": "The new owner must have a verified email.", "code": "workspace/email-not-verified" }
Invalid Target — 404
Invalid Target — 404
{ "error": "Target user not found.", "code": "workspace/invalid-target" }
Relative Rank Not Accepted — 400
Relative Rank Not Accepted — 400
{
"error": "previousOwnerRelativeRank: transfer-ownership does not accept a relative rank. Use previousOwnerRank (absolute), or omit it — the default already seats the previous owner one rung below you.",
"code": "workspace/invalid-body"
}
previousOwnerRelativeRank is declared purely so it can be refused with an explanation. An undeclared field is already refused, but generically (Unrecognized key: "…"); declaring this one buys the message that names what to send instead — and the default this route already applies is one rung below the actor.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.Undeclared Field — 400
Undeclared Field — 400
{ "error": "Unrecognized key: \"onBehalfOf\"", "code": "workspace/invalid-body" }
Unrecognized keys: "onBehalfOf", "impersonate". An offender in the query string carries workspace/invalid-query instead. Send only the fields documented above, plus actingUserId and projectId, which every workspaces route accepts. See Shapes the server rejects.Unparsed Body — 400
Unparsed Body — 400
{
"error": "This request carries a body with content-type \"text/plain;charset=UTF-8\", which no parser reads, so any `actingUserId` inside it was discarded and this request names no acting user. Send the body as application/json.",
"code": "workspace/invalid-body"
}
Content-Type other than application/json and no actingUserId was read. Sublay parses only application/json, so the actor inside such a body is discarded and the request would fall through to the unbounded path. fetch() sends text/plain;charset=UTF-8 when you pass a stringified body and set no headers — set the header. An empty JSON body and a bodiless request both pass. See Shapes the server rejects.
