Create Workspace
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"metadata": {},
"parentWorkspaceId": "<string>",
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspaces"
payload = {
"name": "<string>",
"metadata": {},
"parentWorkspaceId": "<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({
name: '<string>',
metadata: {},
parentWorkspaceId: '<string>',
actingUserId: '<string>'
})
};
fetch('https://api.sublay.io/v7/:projectId/workspaces', 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",
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([
'name' => '<string>',
'metadata' => [
],
'parentWorkspaceId' => '<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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"parentWorkspaceId\": \"<string>\",\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"parentWorkspaceId\": \"<string>\",\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspaces")
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 \"name\": \"<string>\",\n \"metadata\": {},\n \"parentWorkspaceId\": \"<string>\",\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyWorkspace Endpoints
Create Workspace
Create a root or child workspace
Create Workspace
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"metadata": {},
"parentWorkspaceId": "<string>",
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspaces"
payload = {
"name": "<string>",
"metadata": {},
"parentWorkspaceId": "<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({
name: '<string>',
metadata: {},
parentWorkspaceId: '<string>',
actingUserId: '<string>'
})
};
fetch('https://api.sublay.io/v7/:projectId/workspaces', 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",
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([
'name' => '<string>',
'metadata' => [
],
'parentWorkspaceId' => '<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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"parentWorkspaceId\": \"<string>\",\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"parentWorkspaceId\": \"<string>\",\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspaces")
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 \"name\": \"<string>\",\n \"metadata\": {},\n \"parentWorkspaceId\": \"<string>\",\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCreates a workspace. The authenticated caller becomes the
Also returned when a service or master key creates a root workspace on behalf of an unverified
A service/master key called this route without naming an
A plain user token sent an
See also: useCreateWorkspace · createWorkspace (node-sdk)
ownerId. Omit parentWorkspaceId to create a root workspace; pass it to create a child.
- Root creation requires the creator to have a verified email (else
403 workspace/email-not-verified). This is not a key-bypass gate: a service or master key acting as a namedactingUserIdstill requires that user to be verified. On a purely external-auth project this makes root creation unavailable — see the external-auth limitation. - Child creation requires the
create-sub-workspacecapability on the parent (held directly or via reach). The creator becomes the child’s owner. No separate verified-email gate (the capability-holder is already a verified member up-tree).
inheritsFromParent is never accepted from client input — it is server-set from the project default at creation, and cannot be overridden when the project’s default is enforced. depth is likewise server-computed.Body Parameters
string
required
Display name for the workspace. 1–100 characters.
object
Optional arbitrary developer-defined data (opaque JSON). Defaults to
{}.string
Optional UUID of a parent workspace. Absent → root workspace. Requires the
create-sub-workspace capability on the parent.string
required
Service/master keys only — the user to act as (the created workspace’s owner). Required for a key: this route has no unbounded path, so a key that names nobody is refused with
400 workspace/missing-user-id. The named user must satisfy the same gates a self-driven call would: for a root workspace they must have a verified email.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
Returns the created Workspace object.Error Responses
Email Not Verified — 403
Email Not Verified — 403
{ "error": "A verified email is required to create a root workspace.", "code": "workspace/email-not-verified" }
actingUserId — keys do not bypass this gate. Ownership has exactly three doors (create, accept an invite, receive a transfer) and all three enforce it identically, which is what guarantees every workspace participant has a confirmed email.Unauthorized — 403
Unauthorized — 403
{ "error": "The 'create-sub-workspace' capability on the parent is required.", "code": "workspace/unauthorized" }
Parent Not Found — 404
Parent Not Found — 404
{ "error": "Parent workspace not found.", "code": "workspace/not-found" }
Max Depth Exceeded — 400
Max Depth Exceeded — 400
{ "error": "Maximum nesting depth (10) exceeded.", "code": "workspace/max-depth-exceeded" }
Missing Acting User — 400
Missing Acting User — 400
{ "error": "Missing user ID", "code": "workspace/missing-user-id" }
actingUserId. There is no unbounded path here — a workspace has to be created by somebody, so the key must name that user.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.
