Skip to main content

Overview

Adds the authenticated user to the specified space. Public spaces can be joined without an invite code. Private spaces require a valid invite_code.

Endpoint

POST /api/spaces/:spaceId/join
Requires authentication. Include a Bearer token in the Authorization header.

Request

Path parameters

spaceId
string
required
The unique ID of the space to join.

Body parameters

invite_code
string
An invite code for the space. Required when joining a private space. Optional for public spaces.

Response

message
string
A confirmation message indicating the user successfully joined the space.

Example

TypeScript
import { joinSpace } from "./api/Spaces";

// Join a public space
const result = await joinSpace("abc123");
console.log(result.message); // "Successfully joined the space"

// Join a private space with an invite code
const privateResult = await joinSpace("prv001", { invite_code: "INVITE-XYZ" });
console.log(privateResult.message); // "Successfully joined the space"