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

Removed entities

An entity a moderator removed (moderationStatus: "removed") is returned in full only to its author. Everyone else — other users, moderators, signed-out requests and a service key naming nobody — gets a placeholder:
  • userId, user, title, content, location and metadata are null.
  • mentions, attachments and keywords are [], and so is files when include contains "files".
  • Everything else is kept: id, shortId, foreignId, sourceId, spaceId, space, reactionCounts, commentsCount, views, score, timestamps, nsfw, nsfwEffective, moderationStatus, topComments, and the requester’s own userReaction and saved.
  • grants is the zero summary for everyone, the author included: a removed entity takes its grants with it.
The placeholder is what Fetch Entity, Fetch Entity by Short ID, Fetch Entity by Foreign ID and Remove Entity Reaction return for a removed entity, so a shared link still opens and your app can show its own “removed” state. Lists leave removed entities out instead: Fetch Many Entities includes them only when the requester lists their own entities, saved collections leave them out, and a comment’s included entity is null. Nothing is written into title or content; render your own wording. Notifications already sent about the entity, such as a mention, keep the title, content excerpt and author they were sent with. A removed entity can’t take new reactions, but a reaction already on it can still be removed. Its moderation fields follow Moderation fields: moderationStatus is always kept, and the other three are filled only for the requesters listed there.

Moderation fields

moderationStatus is returned to everyone. The other three moderation fields are returned only to some requesters, on every entity response; everyone else gets null. The requester is the signed-in user, or the user a service key names in actingUserId (the key then gets exactly that user’s view); a service key naming nobody is treated as signed out: An entity with no space has no space moderators: only project-role admins and moderators and the entity’s author qualify.

Nested Types

GeoPoint

EntitySaved

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 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.

Saved state

include=saved adds saved, the current user’s saved state for each entity: whether it is saved, and the collections it is in. It works the same on a single fetch and on a list, so a feed can show which of the user’s collections hold each entity without another request.
Only the current user’s own collections are listed. With no current user (a request with no credentials, or a service key without actingUserId), saved is { "isSaved": false, "collections": [] }. A service key that names a user in actingUserId gets that user’s saved state. On a project without the collections bundle, saved is also { "isSaved": false, "collections": [] }. In the React and React Native SDKs, adding an entity to a collection or removing it from one through useCollections or useCollectionsActions updates saved on the entity in every entity list that carries it; lists fetched without include=saved don’t gain the field. Renaming a collection through updateCollection updates its name in saved the same way, and deleting a collection through deleteCollection drops it, and every collection under it, from saved.collections; isSaved stays true only while another collection is listed. These updates, like those for reactions, edits and comment counts, reach lists loaded with useEntityList, and an EntityProvider given one of their entities. They don’t reach an EntityProvider that fetched the entity itself, or entities held by useFetchManyEntitiesWrapper; fetch those again to see the change.

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, and on a project without the comments bundle.
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. Collection entities don’t take "saved": every entity listed there is in that collection.

See Also