> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch entity by short ID

> Fetch a single entity by its auto-generated short ID

<Note>
  **Requires the `entities` bundle.** A project without the entities bundle returns `403 database/tables-not-available`. See [Bundles](/v8/bundles).
</Note>

## Overview

`useFetchEntityByShortId` returns a function that fetches an entity by its `shortId` — the auto-generated short identifier that Sublay assigns to every entity. Short IDs are useful for building readable sharing URLs.

## Usage Example

```tsx theme={null}
import { useFetchEntityByShortId } from "@sublay/react-js";
import { useParams } from "react-router-dom";

function SharePage() {
  const { shortId } = useParams<{ shortId: string }>();
  const fetchEntity = useFetchEntityByShortId();

  const load = async () => {
    const entity = await fetchEntity({ shortId });
    console.log(entity);
  };

  return <button onClick={load}>Load Shared Entity</button>;
}
```

## Parameters

<ParamField path="shortId" type="string" required>
  The short ID to look up. This is the value from `entity.shortId`.
</ParamField>

<ParamField path="include" type="string | EntityInclude[]">
  Optional. Populate related fields. Accepted values: `"user"`, `"space"`, `"topComments"`, `"saved"`, `"files"`, `"grants"`.
</ParamField>

<ParamField path="topCommentsLimit" type="number">
  With `"topComments"` included: how many top comments per entity. Server default `1`, maximum `5`. Not sent when `include` doesn't contain `"topComments"`.
</ParamField>

<ParamField path="topCommentsSortByReaction" type="ReactionType">
  With `"topComments"` included: the reaction whose raw count ranks the top comments. Server default `"upvote"`. Not sent when `include` doesn't contain `"topComments"`.
</ParamField>

## Returns

<ResponseField name="Entity" type="Entity">
  The fetched entity. See [Entity data model](/v8/data-models/entity).
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.