> ## Documentation Index
> Fetch the complete documentation index at: https://replyke-feat-push-rich-payload-fields.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Entity

The **Entity** object represents a core item within Replyke. It can model anything from a social media post or product listing to a static page or location-based record. It supports rich metadata, votes, mentions, optional location tagging and more.

### Properties

| **Property**     | **Type**                                                   | **Description**                                                                          |
| ---------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `id`             | `string`                                                   | Unique identifier for the entity (UUID).                                                 |
| `projectId`      | `string`                                                   | Identifier of the project this entity belongs to (UUID).                                 |
| `sourceId`       | `string \| null`                                           | Optional source identifier for logical content separation within a project.              |
| `foreignId`      | `string \| null`                                           | Optional external or static identifier (e.g., `"about-page"`). May not be a UUID.        |
| `shortId`        | `string`                                                   | Auto-generated unique short identifier used for sharing or routing.                      |
| `user`           | `UserLean \| null`                                         | Optional lightweight user object representing the creator.                               |
| `title`          | `string \| null`                                           | Optional title or heading for the entity.                                                |
| `content`        | `string \| null`                                           | Optional main content or description.                                                    |
| `mentions`       | `Mention[]`                                                | Array of users mentioned in the content. Each item includes user ID (UUID) and username. |
| `attachments`    | `Record<string, any>[]`                                    | Flexible array of media/info objects (e.g., URLs, sizes, formats).                       |
| `keywords`       | `string[]`                                                 | Tags or keywords associated with the entity.                                             |
| `upvotes`        | `string[]`                                                 | Array of user IDs (UUIDs) who upvoted the entity.                                        |
| `downvotes`      | `string[]`                                                 | Array of user IDs (UUIDs) who downvoted the entity.                                      |
| `repliesCount`   | `number`                                                   | Total number of comments and replies associated with the entity.                         |
| `views`          | `number`                                                   | Total view count.                                                                        |
| `score`          | `number`                                                   | Activity-based score ("hotness") used for ranking.                                       |
| `scoreUpdatedAt` | `Date`                                                     | Timestamp of the last score calculation.                                                 |
| `location`       | `{ type: "Point", coordinates: [number, number] } \| null` | Optional GeoJSON-style location (\[longitude, latitude]).                                |
| `metadata`       | `Record<string, any>`                                      | Flexible metadata (up to 10KB) to store additional project-specific info.                |
| `topComment`     | `TopComment \| null`                                       | Top-rated comment for this entity, if one exists.                                        |
| `createdAt`      | `Date`                                                     | Timestamp when the entity was created.                                                   |
| `updatedAt`      | `Date`                                                     | Timestamp of the most recent update.                                                     |
| `deletedAt`      | `Date \| null`                                             | Timestamp when the entity was deleted, if applicable.                                    |

***

### Supporting Types

#### `TopComment`

| **Property**   | **Type**   | **Description**                         |
| -------------- | ---------- | --------------------------------------- |
| `id`           | `string`   | ID of the comment (UUID).               |
| `user`         | `UserLean` | User who posted the comment.            |
| `upvotesCount` | `number`   | Number of upvotes the comment received. |
| `content`      | `string`   | Text content of the comment.            |
| `createdAt`    | `string`   | Timestamp the comment was created.      |

***

### Example Use Cases

#### Social Media Post

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "content": "Check out this amazing sunset!",
  "attachments": [{ "url": "https://example.com/media/sunset.jpg", "size": "2MB" }],
  "keywords": ["sunset", "nature"],
  "user": { "id": "550e8400-e29b-41d4-a716-446655440001", "name": "John Doe" }
}
```

#### Marketplace Product

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440002",
  "title": "Wireless Earbuds",
  "content": "Experience high-quality sound with our new earbuds.",
  "attachments": [],
  "keywords": ["electronics", "audio"]
}
```

#### Static Page (About Us)

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440003",
  "foreignId": "about-page",
  "title": "About Us",
  "content": "Welcome to our platform. Here is what we do.",
  "attachments": [],
  "user": null
}
```

#### Location-Based Listing (Hotel)

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440004",
  "title": "Cozy Beachside Hotel",
  "content": "Enjoy your stay at our beautiful beachside hotel.",
  "location": { "type": "Point", "coordinates": [34.0522, -118.2437] },
  "metadata": { "rating": 4.5, "price": "199.99" },
  "user": { "id": "550e8400-e29b-41d4-a716-446655440005", "name": "Sunrise Hotels" }
}
```

***

### Integration Notes

* The `Entity` structure is intentionally flexible for integration into varied content pipelines, including static, dynamic, or externally referenced data.
* `foreignId` enables mapping to external datasets without requiring UUIDs.
* `attachments`, `metadata`, and `location` provide extensibility without schema changes.
