Requires the
entities bundle. A project without the entities bundle returns 403 database/tables-not-available for entity calls. See Bundles.entities module gives you full control over their lifecycle, reactions, and drafts. All actions are performed on behalf of the logged-in user.
createEntity
Creates a new entity, optionally as a draft or without attributing it to the logged-in user.Your application’s identifier for this entity. Used for idempotent lookups via
fetchEntityByForeignId.The entity’s own NSFW flag. Defaults to
false. Effective NSFW also inherits from the entity’s space. See Entity NSFW flagging.Promise<Entity>
fetchEntity
Fetches a single entity by its Sublay ID.Promise<Entity>
fetchEntityByForeignId
Fetches an entity by your application’s own identifier. Optionally creates it if not found.Promise<Entity>
fetchEntityByShortId
Fetches an entity by its short, human-readable ID (used in share URLs).Promise<Entity>
fetchManyEntities
Fetches a filtered, paginated list of entities (feeds). Supports rich filtering by metadata, keywords, location, and more.Sort order:
"createdAt" (chronological — honors sortDir), "hot" (trending), "top" (highest scored), or "controversial". A "metadata.<prop>" value is also accepted to sort by a metadata field.Sort by the count of a specific reaction:
"upvote", "downvote", "like", "love", "wow", "sad", "angry", or "funny".Filter by metadata fields:
{ includes?: object; includesAny?: object[]; doesNotInclude?: object; exists?: string[]; doesNotExist?: string[] }.Filter by title:
{ hasTitle?: "true" | "false"; includes?: string | string[]; doesNotInclude?: string | string[] }.Filter by content:
{ hasContent?: "true" | "false"; includes?: string | string[]; doesNotInclude?: string | string[] }.Filter by effective NSFW (
entity.nsfw OR its space's nsfwEffective). "include-all" (default) adds no predicate; "exclude" drops effective-NSFW entities; "only" returns only them. See Entity NSFW flagging.How to treat entities authored by users the viewer is block-edged with.
"exclude" (default) hides them; "include-outbound-blocked" re-includes only the viewer’s own outbound-blocked authors — never content from users who blocked the viewer. No effect without the moderation bundle.Promise<PaginatedResponse<Entity>>
updateEntity
Updates fields on an existing entity.Updated NSFW own-flag. A space moderator flagging another user’s entity uses
spaces.setSpaceEntityNsfw instead. See Entity NSFW flagging.Promise<Entity>
deleteEntity
Permanently deletes an entity and its associated data. Deleting a published entity takes back the author’s reputation for creating it, once: not for a draft, and not again for one already soft-deleted.Promise<void>
fetchDrafts
Fetches the logged-in user’s unpublished draft entities.Promise<PaginatedResponse<Entity>>
publishDraft
Publishes a draft entity, making it publicly visible.Promise<Entity>
fetchTopComment
Fetches the highest-scored (top) comment on an entity. Returnsnull if the entity has no comments.
Promise<TopComment | null>
addReaction
Adds the logged-in user’s reaction to an entity and returns the updated entity.Promise<Entity>
removeReaction
Removes the logged-in user’s reaction from an entity and returns the updated entity.Promise<Entity>
fetchReactions
Fetches a paginated list of reactions on an entity, optionally filtered by reaction type.Promise<{ data: Reaction[]; pagination: { page: number; limit: number; total: number; totalPages: number; hasMore: boolean } }>
getUserReaction
Gets the logged-in user’s reaction on an entity. Returnsnull if there is no reaction.
Promise<{ reactionType: ReactionType | null }>
isEntitySaved
Checks whether the logged-in user has saved an entity, and in which collections.Promise<{ saved: boolean; collections: { id: string; name: string }[] }>
