Skip to main content
The spaces namespace manages user spaces — profile settings, public space configuration, slug management, custom domains, and data export.

spaces.getMySpace

Returns the current user’s space with all settings.
space
Space
The user’s space object, including:
const space = useQuery(api.spaces.getMySpace);

spaces.ensureSpace

Creates a space for the current user if one doesn’t exist. Called automatically during sign-up.

spaces.updateSettings

Updates space settings — name, bio, avatar, visibility, layout, theme, and default domain.
name
string
Display name.
bio
string
Bio text.
avatar
string
Avatar URL.
visibility
'public' | 'private'
Space visibility.
layout
'list' | 'grid'
Public space layout.
defaultDomain
string
Default domain for shared links.
const updateSettings = useMutation(api.spaces.updateSettings);

await updateSettings({
  name: "Mario's Reads",
  visibility: "public",
  layout: "grid",
});

spaces.updatePublicTheme

Updates the public space’s theme customization — colors, fonts, patterns, light/dark mode settings.
publicTheme
PublicTheme
required
Complete theme configuration object with colors, fonts, and patterns for both light and dark modes.
const updateTheme = useMutation(api.spaces.updatePublicTheme);

await updateTheme({
  publicTheme: {
    preset: "custom",
    light: {
      primary: "#16A34A",
      background: "#FFFFFF",
      text: "#1A1A1A",
      card: "#F9F9F9",
    },
    dark: {
      primary: "#07C983",
      background: "#0A0A0A",
      text: "#E5E5E5",
      card: "#1A1A1A",
    },
    headingFont: "Inter",
    bodyFont: "Inter",
  },
});

spaces.updateSlug

Changes the space’s URL slug (subdomain).
slug
string
required
New slug. Must be unique, lowercase, 3+ characters, letters/numbers/hyphens only.
Changing your slug immediately changes your public space URL. Old URLs stop working with no redirect.

spaces.checkSlugAvailability

Checks if a slug is available.
slug
string
required
The slug to check.
available
boolean
Whether the slug is available.

spaces.getStats

Returns statistics for the current user’s space.
stats
object

Custom domain management

spaces.addDomain

Adds a custom domain to the space.
domain
string
required
The domain to add (e.g., links.example.com).

spaces.removeDomain

Removes a custom domain.
domain
string
required
The domain to remove.

spaces.verifyDomain

Triggers domain verification.
domain
string
required
The domain to verify.

spaces.listDomains

Returns all domains associated with the space and their statuses.
domains
DomainMapping[]
Array of domain mappings with status: pending_verification, verified, active, error, or disabled.

spaces.getDomainStatus

Returns the current status of a specific domain.
domain
string
required
The domain to check.

spaces.exportAllData

Exports all user data as a JSON object — saves, tags, collections, settings, and metadata.
export
object
Complete data export including all saves with their tags and collections, space settings, and metadata.
const exportData = useAction(api.spaces.exportAllData);
const data = await exportData();
// Download as JSON file