Create Space
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/api/v7/spaces \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"readingPermission": "<string>",
"postingPermission": "<string>",
"requireJoinApproval": true,
"metadata": {},
"parentSpaceId": "<string>"
}
'import requests
url = "https://api.sublay.io/api/v6/:projectId/api/v7/spaces"
payload = {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"readingPermission": "<string>",
"postingPermission": "<string>",
"requireJoinApproval": True,
"metadata": {},
"parentSpaceId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
description: '<string>',
readingPermission: '<string>',
postingPermission: '<string>',
requireJoinApproval: true,
metadata: {},
parentSpaceId: '<string>'
})
};
fetch('https://api.sublay.io/api/v6/:projectId/api/v7/spaces', 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/api/v6/:projectId/api/v7/spaces",
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>',
'slug' => '<string>',
'description' => '<string>',
'readingPermission' => '<string>',
'postingPermission' => '<string>',
'requireJoinApproval' => true,
'metadata' => [
],
'parentSpaceId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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/api/v6/:projectId/api/v7/spaces"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"readingPermission\": \"<string>\",\n \"postingPermission\": \"<string>\",\n \"requireJoinApproval\": true,\n \"metadata\": {},\n \"parentSpaceId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/api/v6/:projectId/api/v7/spaces")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"readingPermission\": \"<string>\",\n \"postingPermission\": \"<string>\",\n \"requireJoinApproval\": true,\n \"metadata\": {},\n \"parentSpaceId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/api/v7/spaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"readingPermission\": \"<string>\",\n \"postingPermission\": \"<string>\",\n \"requireJoinApproval\": true,\n \"metadata\": {},\n \"parentSpaceId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodySpace Endpoints
Create Space
Create a new community space
POST
/
:projectId
/
api
/
v7
/
spaces
Create Space
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/api/v7/spaces \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"readingPermission": "<string>",
"postingPermission": "<string>",
"requireJoinApproval": true,
"metadata": {},
"parentSpaceId": "<string>"
}
'import requests
url = "https://api.sublay.io/api/v6/:projectId/api/v7/spaces"
payload = {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"readingPermission": "<string>",
"postingPermission": "<string>",
"requireJoinApproval": True,
"metadata": {},
"parentSpaceId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
description: '<string>',
readingPermission: '<string>',
postingPermission: '<string>',
requireJoinApproval: true,
metadata: {},
parentSpaceId: '<string>'
})
};
fetch('https://api.sublay.io/api/v6/:projectId/api/v7/spaces', 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/api/v6/:projectId/api/v7/spaces",
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>',
'slug' => '<string>',
'description' => '<string>',
'readingPermission' => '<string>',
'postingPermission' => '<string>',
'requireJoinApproval' => true,
'metadata' => [
],
'parentSpaceId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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/api/v6/:projectId/api/v7/spaces"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"readingPermission\": \"<string>\",\n \"postingPermission\": \"<string>\",\n \"requireJoinApproval\": true,\n \"metadata\": {},\n \"parentSpaceId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/api/v6/:projectId/api/v7/spaces")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"readingPermission\": \"<string>\",\n \"postingPermission\": \"<string>\",\n \"requireJoinApproval\": true,\n \"metadata\": {},\n \"parentSpaceId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/api/v7/spaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"readingPermission\": \"<string>\",\n \"postingPermission\": \"<string>\",\n \"requireJoinApproval\": true,\n \"metadata\": {},\n \"parentSpaceId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCreates a new space. The authenticated user is automatically added as an admin. Supports optional avatar and banner image upload via multipart form data.
See also: useCreateSpace
Body Parameters
string
Display name for the space. Must be 3–100 characters.
string
Optional URL slug. Must be unique per project. Supports Unicode letters, numbers, hyphens, and underscores.
string
Optional description. Up to 1,000 characters.
string
Who can read content:
"anyone" or "members". Defaults to "anyone".string
Who can post entities:
"anyone", "members", or "admins". Defaults to "members".boolean
Whether new joins require approval. Defaults to
true.object
Optional arbitrary key-value data. Up to 1 MB.
string
Optional UUID of a parent space. The caller must be an admin of the parent space.
file
Optional avatar image. Multipart form field. Requires
avatarFile.options when provided.file
Optional banner image. Multipart form field. Requires
bannerFile.options when provided.Response
Returns the created Space object withmembersCount, childSpacesCount, and optional file associations.
Error Responses
Auth Required — 401
Auth Required — 401
{ "error": "Authentication required to create a space.", "code": "space/auth-required" }
Slug Taken — 409
Slug Taken — 409
{ "error": "A space with this slug already exists.", "code": "space/slug-taken" }
Parent Not Found — 404
Parent Not Found — 404
{ "error": "Parent space not found.", "code": "space/parent-not-found" }
Parent Admin Required — 403
Parent Admin Required — 403
{ "error": "Only admins of the parent space can create child spaces.", "code": "space/parent-admin-required" }
Max Depth Exceeded — 400
Max Depth Exceeded — 400
{ "error": "Maximum nesting depth (10) exceeded.", "code": "space/max-depth-exceeded" }
File Too Large — 413
File Too Large — 413
{ "code": "space/file-too-large", "message": "Avatar image exceeds 50MB limit." }
⌘I

