Skip to main content
GET
/
:projectId
/
api
/
v7
/
entities
/
by-foreign-id
Fetch Entity by Foreign ID
curl --request GET \
  --url https://api.replyke.com/api/v6/:projectId/api/v7/entities/by-foreign-id
Returns an entity matching the given foreignId within the project. Optionally creates a blank entity if none exists — useful for automatically bootstrapping entities when a user first visits a page or URL in your application.

Query Parameters

foreignId
string
required
The foreign ID to look up. This is the identifier from your application (URL, slug, database ID, etc.).
createIfNotFound
string
When "true", creates a blank entity with this foreignId if no entity is found. The new entity has no title, content, or user attribution. Defaults to "false".
include
string
Comma-separated list of associations to include:
  • user — the author’s user profile
  • space — the space the entity belongs to
  • topComment — the highest-voted comment
  • saved — whether the authenticated user has saved this entity
  • files — uploaded file/image attachments

Response

Returns an Entity object.
This endpoint returns entities regardless of moderation status, so the client can display the appropriate moderation state. Draft entities are only returned to their author (or with a service/master key).

Error Responses

{ "error": "Entity not found", "code": "entity/not-found" }
Returned when no entity with this foreignId exists and createIfNotFound is not "true".