Skip to main content
An entity is the central content unit in Sublay — it can represent a post, article, product listing, video, or any other piece of content in your application. Entities support reactions, comments, votes, file attachments, geo-location, and more.
Entities are provided by the optional entities bundle. A project without it returns 403 database/tables-not-available for entity endpoints. See Bundles.

Properties

Nested Types

GeoPoint

NSFW flagging

An entity carries its own nsfw boolean and exposes a live-computed nsfwEffective:
  • nsfw — the entity’s own flag. It defaults to false and is what the owner, a service/master key, or a space moderator toggles.
  • nsfwEffective — never stored on the entity. It is computed on every read as:
    So an entity reads as effectively NSFW when either its own flag is set or the space it lives in is effectively NSFW (which itself folds in the space’s whole ancestor chain — see Space → NSFW flagging). A space-less entity (spaceId is null) falls back to its own flag; on a project without the spaces bundle, the space contribution is simply absent and nsfwEffective equals entity.nsfw.
The effect is a live OR: clearing an entity’s own nsfw cannot make it read safe while its space chain is still NSFW, and flagging a space instantly cascades to every entity inside it without stamping or backfilling entity rows. To filter a list by effective NSFW, pass nsfwFilter to Fetch many entities (include-all default / exclude / only).
Sublay only labels (nsfw) and filters (nsfwFilter) content. It does not blur, age-gate, add interstitials, or store a per-viewer “show mature content” preference — how NSFW-flagged content is presented is entirely the consuming app’s responsibility.

Top comments

include=topComments adds a preview of the entity’s best comments — for example, the top comment under each entity in a feed, or a few rotating ones.
  • Each item is a full Comment, with its author (user) always included.
  • Only top-level comments, ranked by the raw count of one reaction (topCommentsSortByReaction, default upvote), ties newest first.
  • topCommentsLimit sets how many per entity: a whole number of at least 1, default 1, maximum 5 (larger values are treated as 5). 0, a negative number or a non-integer value returns 400.
  • Real content only: deleted and moderator-removed comments are left out (for everyone, the author included), and so are comments whose author is block-edged with the requesting user, in either direction. So isAuthorBlocked and isUnavailable are always false here.
  • [] when no comment qualifies, on a project without the comments bundle, and on an entity whose author has blocked the requesting user (for example, one they saved to a collection before the block).
Sending topCommentsLimit or topCommentsSortByReaction without include=topComments returns 400. To render a full discussion — including placeholders, so replies stay in place — use Fetch Many Comments.

Includes

Pass include to populate optional fields. Each endpoint accepts its own list; an unknown value returns 400. “Entity fetches and lists” are Fetch Entity, by foreign ID, by short ID and Fetch Many Entities. On collection entities every item is already saved (isSaved: true).

See Also