Skip to main content
Requires the entities bundle. A project without the entities bundle returns 403 database/tables-not-available. See Bundles.

Overview

useFetchEntityByForeignId returns a function that fetches an entity using the foreign ID from your system. It only reads: an entity that doesn’t exist rejects with a 404. To create the entity when it is missing, use useFetchOrCreateEntityByForeignId. An entity a moderator removed resolves in full for its author and as a placeholder for everyone else.

Usage Example

Parameters

string
required
The foreign ID to look up. This is the identifier from your own system.
EntityIncludeParam
Optional. Populate related fields, as a single value or an array. Accepted values: "user", "space", "topComments", "saved", "files", "grants".
number
With "topComments" included: how many top comments per entity. Server default 1, maximum 5. Not sent when include doesn’t contain "topComments".
ReactionType
With "topComments" included: the reaction whose raw count ranks the top comments. Server default "upvote". Not sent when include doesn’t contain "topComments".

Returns

Entity
The fetched entity. See Entity data model.