> ## 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 Many Entities

> Get a paginated, filtered list of entities

> [!NOTE]
>
> **Requires the `entities` bundle.** A project without the entities bundle returns `403 database/tables-not-available`. See [Bundles](https://docs.sublay.io/v7/bundles.md).

Returns a paginated list of entities for the project. Supports rich filtering by source, space, user, keywords, metadata, title, content, location, and time. Excludes drafts — use [Fetch Drafts](https://docs.sublay.io/v7/api-reference/entities/fetch-drafts.md) for those.

## Query Parameters

### Pagination

**page** `number` (default: 1)

Page number (1-indexed).

**limit** `number` (default: 10)

Number of entities per page. Maximum `100`.

### Sorting

**sortBy** `string` (default: createdAt)

Sort algorithm. One of:

* `createdAt` — chronological by creation time (honors `sortDir`; newest first by default)
* `top` — by reaction count (use `sortByReaction` to specify which type)
* `hot` — by computed engagement score (decays over time)
* `controversial` — high total votes with a close up/down split (entities with no votes sort last)
* `metadata.<property>` — sort by a metadata field (e.g. `metadata.memberCount`)

> [!NOTE]
>
> `new` is a deprecated alias for `createdAt` (removed in v8). It still works and
> behaves identically, but requests using it receive a non-blocking `Deprecation`
> response header — switch to `createdAt`.

**sortDir** `string` (default: DESC)

Sort direction. `ASC` or `DESC`.

**sortType** `string` (default: auto)

When using `sortBy=metadata.*`, the type of the metadata field. One of `auto`, `numeric`, `text`, `boolean`, `timestamp`. `auto` infers the type at query time.

**sortByReaction** `string` (default: upvote)

When `sortBy=top`, which reaction type to rank by. One of `upvote`, `downvote`, `like`, `love`, `wow`, `sad`, `angry`, `funny`.

### Filtering

**timeFrame** `string`

Restrict to entities created within the last period. One of `hour`, `day`, `week`, `month`, `year`.

**sourceId** `string`

Filter by `sourceId`. Pass `"null"` to return entities with no `sourceId`.

**spaceId** `string`

Filter by space ID.

**userId** `string`

Filter by the author's user ID. When this matches the authenticated user's ID, moderation-removed entities are also included (author can see their own removed posts).

**followedOnly** `string`

When `"true"`, only returns entities from users the authenticated user follows. Requires authentication.

**blockedFilter** `string` (default: exclude)

Controls how entities authored by users the viewer is [block-edged](https://docs.sublay.io/v7/sdk/moderation/overview.md#blocking) with are treated. `"exclude"` (default) hides those entities. `"include-outbound-blocked"` re-includes entities authored **only** by users the viewer themselves blocked (their own "view anyway" choice); it never surfaces content from users who blocked the viewer. Counts reflect what the viewer sees (computed post-filter). Has no effect when the `moderation` bundle is not installed.

**keywordsFilters** `object`

Filter by keywords. Pass as a JSON string or bracket-notation query params:

```json theme={null}
{ "includes": ["react", "typescript"], "doesNotInclude": ["vue"] }
```

**titleFilters** `object`

Filter by title content:

```json theme={null}
{
  "hasTitle": "true",
  "includes": "tutorial",
  "doesNotInclude": "beginner"
}
```

* `hasTitle`: `"true"` or `"false"` — filter for presence/absence of a title
* `includes`: substring(s) to match (case-insensitive)
* `doesNotInclude`: substring(s) to exclude

**contentFilters** `object`

Filter by content text. Same structure as `titleFilters` (`hasContent`, `includes`, `doesNotInclude`).

**attachmentsFilters** `object`

Filter by attachment presence:

```json theme={null}
{ "hasAttachments": "true" }
```

**locationFilters** `object`

Filter to entities within a radius of a point:

```json theme={null}
{ "latitude": "40.7128", "longitude": "-74.0060", "radius": "5000" }
```

`radius` is in meters.

**metadataFilters** `object`

Filter by metadata values. Supports complex conditions:

```json theme={null}
{
  "includes": { "status": "published" },
  "includesAny": [{ "type": "video" }, { "type": "image" }],
  "doesNotInclude": { "hidden": true },
  "exists": ["category"],
  "doesNotExist": ["archivedAt"]
}
```

* `includes` — all key/value pairs must match (AND)
* `includesAny` — at least one object must match (OR)
* `doesNotInclude` — none of these key/value pairs may match
* `exists` — keys that must be present
* `doesNotExist` — keys that must be absent

### Optional Associations

**include** `string`

Comma-separated list of associations to include in each entity:

* `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
* `grants` — the [reputation-grant summary](https://docs.sublay.io/v7/data-models/reputation-grant.md#grantsummary) for the entity

### Space-scoped reputation

This endpoint has a space in context, so it accepts the opt-in reputation params. They add a `spaceReputation` field to each populated author `user`, alongside the always-present `reputation` total. Requires the `reputation` bundle. See the [Reputation data model](https://docs.sublay.io/v7/data-models/reputation.md) for the full contract.

**spaceReputationId** `string`

Opt-in. Adds a `spaceReputation` number to each returned user,
scoped to a single space. Requires the `reputation` bundle.
The `reputation` total is always present regardless;
`spaceReputation` only appears when you pass this. See the
[Reputation data model](https://docs.sublay.io/v7/data-models/reputation.md) for the
full contract.

Accepts a space **`<uuid>`** (that
space's bucket), **`none`** (the
project-general, space-less bucket), or
**`context`** (the space derived from the
request context — resolved per-row on lists, or the single space on
member/team/conversation surfaces).

The empty string is rejected (400). The legacy `general` / `null` aliases
are rejected (400). Missing buckets read as `0`.
**spaceReputationDescendants** `boolean`

When `true`, `spaceReputation` is the
**subtree sum** — the named space plus all of its
descendant spaces (the root space's own bucket included).
Ignored unless `spaceReputationId` is a space
`<uuid>`.

## Response

Returns a paginated response object:

```json theme={null}
{
  "data": [ ...Entity[] ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 42,
    "totalPages": 5,
    "hasMore": true
  }
}
```

Each item in `data` is an [Entity](https://docs.sublay.io/v7/data-models/entity.md) object. File URLs are signed and ready to use.

> [!NOTE]
>
> Viewing scores (`hot` sort) are updated asynchronously after each fetch. Scores decay at a rate set per project ([feed decay](https://docs.sublay.io/v7/sdk/entity-lists/fetch-entities.md#feed-decay)). Entities with equal scores are ordered newest first.

## See Also

* [Reputation data model](https://docs.sublay.io/v7/data-models/reputation.md) — the `spaceReputation` contract
* [Entity data model](https://docs.sublay.io/v7/data-models/entity.md)


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