Skip to main content
The public namespace provides queries that don’t require authentication. These power public space pages and can be used by third-party integrations.
All public endpoints are read-only queries. No mutations are available without authentication.

public.resolveSpaceBySlug

Resolves a space by its subdomain slug.
slug
string
required
The space slug (subdomain).
space
Space | null
The public space object, or null if not found or private.
const space = useQuery(api.public.resolveSpaceBySlug, {
  slug: "mario",
});
// Returns the space for mario.backpocket.my

public.resolveSpaceByDomain

Resolves a space by a custom domain.
domain
string
required
The custom domain.
space
Space | null
The public space object, or null if the domain is not mapped.
const space = useQuery(api.public.resolveSpaceByDomain, {
  domain: "links.example.com",
});

public.listPublicSaves

Returns paginated public saves for a space.
spaceId
Id<'spaces'>
required
The space ID (obtained from resolveSpaceBySlug or resolveSpaceByDomain).
query
string
Search text to filter by title and description.
tagId
Id<'tags'>
Filter by tag.
collectionId
Id<'collections'>
Filter by collection.
limit
number
Results per page. Range: 5-100. Default: 20.
cursor
string
Pagination cursor.
saves
Save[]
Array of public saves with tags.
nextCursor
string | null
Pagination cursor for next page.
const result = useQuery(api.public.listPublicSaves, {
  spaceId: spaceId,
  query: "react",
  limit: 20,
});

public.getPublicSave

Returns a single public save by ID.
saveId
Id<'saves'>
required
The save ID.
save
Save | null
The save object if it’s public, or null if private/not found.

public.listPublicTags

Returns all tags that have at least one public save in a space.
spaceId
Id<'spaces'>
required
The space ID.
tags
Tag[]
Array of tags with public save counts.

public.listPublicCollections

Returns all public collections for a space.
spaceId
Id<'spaces'>
required
The space ID.
collections
Collection[]
Array of public collections with save counts.

public.registerVisit

Registers a visit to a public space (increments the visit counter).
spaceId
Id<'spaces'>
required
The space ID being visited.
const registerVisit = useMutation(api.public.registerVisit);
await registerVisit({ spaceId: spaceId });
Visit registration is a simple counter increment. No visitor information (IP, browser, location) is collected or stored — consistent with Backpocket’s privacy-first approach.

public.getVisitCount

Returns the total visit count for a public space.
spaceId
Id<'spaces'>
required
The space ID.
count
number
Total visit count.

public.getPublicSaveSnapshot

Returns the active snapshot for a public save (for reader mode on public spaces).
saveId
Id<'saves'>
required
The save ID.
includeContent
boolean
Whether to include full HTML/text content.
snapshot
SaveSnapshot | null
The active snapshot if the save is public and has a ready snapshot.