Skip to main content

Overview

useCreateSpace returns a callable function for creating a new space. The request can include avatar and banner image uploads. The creator is automatically added as an admin.

Usage Example

Parameters

string
required
Display name for the space. 3–100 characters.
string
Optional URL slug. Must be unique per project. Supports letters, numbers, hyphens, and underscores (Unicode allowed).
string
Optional description. Up to 1,000 characters.
{ file: File | Blob; options: UploadImageOptions }
Optional avatar image to upload. The options object controls format, quality, dimensions, and variants.
{ file: File | Blob; options: UploadImageOptions }
Optional banner image to upload.
"anyone" | "members"
Who may read content, for your app to enforce. Defaults to "anyone". The v7 API reports it in memberPermissions.canRead but doesn’t hide the content inside the space; see Content inside a space and the v8 rules.
"anyone" | "members" | "admins"
Who may post entities, for your app to enforce. Defaults to "members". The v7 API reports it in memberPermissions.canPost but doesn’t refuse entities that don’t match it; see Content inside a space and the v8 rules.
"public" | "unlisted" | "private"
Who can find and see the space. Defaults to "public". Independent of readingPermission. "unlisted" hides the space from discovery and search but keeps it reachable by direct link; "private" hides the space, and the spaces under it, from everyone except its active members — it answers 404 like a nonexistent space and can’t be joined. The content inside it stays readable in v7; see Content inside a space and the v8 rules. See Space visibility.
boolean
The space’s own NSFW flag. Defaults to false. If the space is created under an NSFW parent, its effective NSFW status is true regardless of this value (a live rollup — see Space NSFW flagging). Sublay labels and filters NSFW content; it does not blur or age-gate it.
boolean
Whether new members must be approved. Defaults to true.
Record<string, any>
Optional custom metadata. Up to 1 MB.
string
Optional UUID of a parent space. The creator must be an admin of the parent space.

Returns

Returns the created Space object.
When creating a child space, all admins and moderators of the parent space are automatically added to the new child space with their same roles.