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. A signed-in user’s entity is always theirs. Without a signed-in user, the entity has no author, and the request is allowed only while the project’s Who can create entities without an author setting is Everyone (the default); otherwise it fails with403 entity/authorless-creation-not-allowed. See Create Entity.
string
Your application’s identifier for this entity. Used for idempotent lookups via
fetchEntityByForeignId.string | null
An optional secondary identifier for grouping or filtering entities. For no source, leave it out or pass
null. "none", "null" and "undefined" are reserved and refused with 400 entity/invalid-body.string
The space this entity belongs to.
string
Title text for the entity.
string
Body/content text for the entity.
Record<string, any>[]
File or media attachments.
string[]
Tags or keywords used for filtering and discovery.
Mention[]
User mentions embedded in the entity.
object
Geographic coordinates
{ latitude: number; longitude: number }.Record<string, any>
Arbitrary public metadata.
boolean
The entity’s own NSFW flag. Defaults to
false. Effective NSFW also inherits from the entity’s space. See Entity NSFW flagging.boolean
When
true, the entity is created as an unpublished draft.Promise<Entity>
fetchEntity
Fetches a single entity by its Sublay ID.string
required
The Sublay entity ID.
EntityIncludeParam
Associations to populate, as a single value or an array:
"user", "space", "topComments", "saved", "files", "grants". "topComments" adds the entity’s best top-level comments as full Comment objects — see Top comments.number
With
include containing "topComments": how many top comments per entity. Server default 1, maximum 5. Rejected (400) without "topComments" in include.ReactionType
With
include containing "topComments": the reaction whose raw count ranks the top comments. Server default "upvote". Rejected (400) without "topComments" in include.Promise<Entity>
fetchEntityByForeignId
Fetches an entity by your application’s own identifier. Optionally creates it if not found.string
required
Your application’s entity identifier.
boolean
When
true, creates a stub entity if no match is found. The new entity has no author, so the project’s Who can create entities without an author setting decides who may create it: everyone by default. When it is set to Signed-in users only (a visitor with no session is refused) or No one from the client (only a service key may create it), a refused caller gets 403 entity/authorless-creation-not-allowed and nothing is created. See Fetch Entity by Foreign ID.EntityIncludeParam
Associations to populate, as a single value or an array:
"user", "space", "topComments", "saved", "files", "grants". "topComments" adds the entity’s best top-level comments as full Comment objects — see Top comments.number
With
include containing "topComments": how many top comments per entity. Server default 1, maximum 5. Rejected (400) without "topComments" in include.ReactionType
With
include containing "topComments": the reaction whose raw count ranks the top comments. Server default "upvote". Rejected (400) without "topComments" in include.Promise<Entity>
fetchEntityByShortId
Fetches an entity by its short, human-readable ID (used in share URLs).string
required
The entity’s short ID.
EntityIncludeParam
Associations to populate, as a single value or an array:
"user", "space", "topComments", "saved", "files", "grants". "topComments" adds the entity’s best top-level comments as full Comment objects — see Top comments.number
With
include containing "topComments": how many top comments per entity. Server default 1, maximum 5. Rejected (400) without "topComments" in include.ReactionType
With
include containing "topComments": the reaction whose raw count ranks the top comments. Server default "upvote". Rejected (400) without "topComments" in include.Promise<Entity>
fetchManyEntities
Fetches a filtered, paginated list of entities (feeds). Supports rich filtering by metadata, keywords, location, and more.string | "none"
Only entities from this source, or
"none" for entities with no source. Left out: any source.string | "none"
Only entities in this space, or
"none" for entities in no space. Left out: any space, or none.string
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.string
Sort direction:
"asc" or "desc". Not accepted with "hot" or "controversial", which rank one way only.string
How to interpret a metadata sort value:
"auto", "numeric", "text", "boolean", or "timestamp".string
Which reaction
top ranks by: "upvote", "downvote", "like", "love", "wow", "sad", "angry", or "funny". Defaults to "upvote". Only valid with sortBy: "top" — the server rejects it with any other sort.number
Page number (1-indexed).
number
Results per page.
EntityIncludeParam
Associations to populate, as a single value or an array:
"user", "space", "topComments", "saved", "files", "grants". "topComments" adds the entity’s best top-level comments as full Comment objects — see Top comments.number
With
include containing "topComments": how many top comments per entity. Server default 1, maximum 5. Rejected (400) without "topComments" in include.ReactionType
With
include containing "topComments": the reaction whose raw count ranks the top comments. Server default "upvote". Rejected (400) without "topComments" in include.string
Time window to restrict results to:
"hour", "day", "week", "month", or "year".string
Author filter: returns only entities whose
userId is this user."true" | "false"
When
"true", returns only entities from users the signed-in user follows.object
Filter by keyword tags:
{ includes?: string[]; doesNotInclude?: string[] }.object
Filter by metadata fields:
{ includes?: object; includesAny?: object[]; doesNotInclude?: object; exists?: string[]; doesNotExist?: string[] }.object
Filter by title:
{ hasTitle?: "true" | "false"; includes?: string | string[]; doesNotInclude?: string | string[] }.object
Filter by content:
{ hasContent?: "true" | "false"; includes?: string | string[]; doesNotInclude?: string | string[] }.object
Filter by attachments:
{ hasAttachments?: "true" | "false" }.object
Filter within a geographic radius:
{ latitude: string; longitude: string; radius: string }."include-all" | "exclude" | "only"
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."exclude" | "include-outbound-blocked"
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.string
required
The Sublay entity ID to update.
string
New title.
string
New content body.
Record<string, any>[]
Updated attachments list.
string[]
Updated keywords list.
Mention[]
Updated user mentions list.
object
Updated coordinates
{ latitude: number; longitude: number }.Record<string, any>
Updated metadata. Merged with existing values.
boolean
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.string
required
The Sublay entity ID to delete.
Promise<void>
fetchDrafts
Fetches the logged-in user’s unpublished draft entities.number
Page number (1-indexed).
number
Results per page.
string | "none"
Only drafts from this source, or
"none" for drafts with no source. Left out: any source.string | "none"
Only drafts in this space, or
"none" for drafts in no space. Left out: any space, or none.DraftIncludeParam
Associations to populate:
"user", "space", "files", "grants" (a single value or an array).Promise<PaginatedResponse<Entity>>
publishDraft
Publishes a draft entity, making it publicly visible.string
required
The Sublay entity ID of the draft to publish.
Promise<Entity>
addReaction
Adds the logged-in user’s reaction to an entity and returns the updated entity.string
required
The Sublay entity ID.
ReactionType
required
One of:
"upvote", "downvote", "like", "love", "wow", "sad", "angry", "funny".Promise<Entity>
removeReaction
Removes the logged-in user’s reaction from an entity and returns the updated entity.string
required
The Sublay entity ID.
Promise<Entity>
If the entity’s author has blocked the user, this fails with 404 entity/not-found and nothing changes.
fetchReactions
Fetches a paginated list of reactions on an entity, optionally filtered by reaction type.string
required
The Sublay entity ID.
ReactionType
Filter to a specific reaction type.
number
Page number (1-indexed).
number
Results per page.
string
Sort direction:
"asc" or "desc".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.
string
required
The Sublay entity ID.
Promise<{ reactionType: ReactionType | null }>
isEntitySaved
Checks whether the logged-in user has saved an entity, and in which collections.string
required
The Sublay entity ID.
Promise<{ saved: boolean; collections: { id: string; name: string }[] }>
