Fetch User Spaces
curl --request GET \
--url https://api.sublay.io/v7/:projectId/spaces/user-spaces \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/v7/:projectId/spaces/user-spaces"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sublay.io/v7/:projectId/spaces/user-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/v7/:projectId/spaces/user-spaces",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v7/:projectId/spaces/user-spaces"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sublay.io/v7/:projectId/spaces/user-spaces")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/spaces/user-spaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"membershipId": "<string>",
"role": "<string>",
"status": "<string>",
"joinedAt": "<string>"
}
],
"pagination": {}
}Space Endpoints
Fetch User Spaces
Get spaces the authenticated user is a member of
Fetch User Spaces
curl --request GET \
--url https://api.sublay.io/v7/:projectId/spaces/user-spaces \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/v7/:projectId/spaces/user-spaces"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sublay.io/v7/:projectId/spaces/user-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/v7/:projectId/spaces/user-spaces",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v7/:projectId/spaces/user-spaces"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sublay.io/v7/:projectId/spaces/user-spaces")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/spaces/user-spaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"membershipId": "<string>",
"role": "<string>",
"status": "<string>",
"joinedAt": "<string>"
}
],
"pagination": {}
}Returns a paginated list of spaces the authenticated user has a membership in, along with their membership details for each space. By default only active memberships are returned; use
status to list pending join requests or spaces the user was banned from. Only spaces the user can see are listed: a pending or banned membership in a private space (or in a space under one the user isn’t an active member of) is left out, and totals match.
Query Parameters
Membership status to list:
"active" (default), "pending", or "banned"."pending" surfaces join requests still awaiting admin approval — useful for a “waiting to join” screen on spaces that have requireJoinApproval enabled.Filter by role. Single value (
"admin", "moderator", "member") or comma-separated list (e.g. "admin,moderator").Optional comma-separated includes. Pass
"files" to include avatar and banner file objects on each space.Pass
"true" to return all memberships without pagination. When used, the response omits the pagination field.Response
See also: useFetchUserSpaces

