Skip to main content

Entities API

Extract, manage, and query named entities from your memories to build a knowledge graph.

Overview

Entities are named things (people, organizations, places, etc.) automatically extracted from your memories. They form the nodes of a knowledge graph that connects related information across your entire memory store.

Automatic Extraction: Entities are extracted automatically when memories are created. You can also manually trigger extraction or add custom entities.

List Entities

Endpoint
GET /knowledge/entities

Returns entities extracted from your memories, optionally filtered by type.

Query Parameters

FieldTypeDescription
space_idstringSpace UUID (for hub-scoped accounts).
typestringFilter by entity type (see the entity-types table below).
limitintegerMaximum entities to return. Default: 100, Max: 200.
offsetintegerOffset for pagination. Default: 0.

Response (200)

Example Response
{
  "entities": [
    {
      "id": "<uuid>",
      "name": "John Smith",
      "type": "person",
      "created_at": "2026-04-05T09:00:00Z"
    },
    {
      "id": "<uuid>",
      "name": "Sarah Johnson",
      "type": "person",
      "created_at": "2026-04-07T14:00:00Z"
    }
  ],
  "total": 2,
  "limit": 10,
  "offset": 0,
  "has_more": false
}

Count entities by countable category

Endpoint
GET /knowledge/entities/count

Returns the number of entities in a countable category, optionally within a time window.

Query Parameters

FieldTypeDescription
countable_categorystring (required)Countable category (e.g. person).
time_startstringOptional ISO 8601 lower bound.
time_endstringOptional ISO 8601 upper bound.

List entities valid at a point in time

Endpoint
GET /knowledge/entities/at-time

Bi-temporal query: returns entities that were valid at the given point in time.

Query Parameters

FieldTypeDescription
as_ofstringISO 8601 timestamp. Defaults to now.
typestringFilter by entity type.
limitintegerMaximum entities to return. Default: 100, Max: 200.

Get Entity

Endpoint
GET /knowledge/entities/:id

Retrieves an entity along with its relationship and fact counts.

Path Parameters

FieldTypeDescription
idstring (required)The entity UUID.

Response (200)

Example Response
{
  "entity": {
    "id": "<uuid>",
    "name": "John Smith",
    "type": "person",
    "relationship_count": 5,
    "fact_count": 12,
    "created_at": "2026-04-05T09:00:00Z",
    "updated_at": "2026-04-12T16:30:00Z"
  },
  "relationships": [],
  "facts": []
}

Get bi-temporal entity history

Endpoint
GET /knowledge/entities/:id/timeline

Returns a timeline of changes for the entity.

Get Entity Relationships

Endpoint
GET /knowledge/entities/:id/relationships

Returns all relationships for a specific entity.

Path Parameters

FieldTypeDescription
idstring (required)The entity UUID.

Query Parameters

FieldTypeDescription
directionstringRelationship direction: outgoing, incoming, or both (default).
session_idstringFilter relationships by session UUID.

Response (200)

Example Response
{
  "entity_id": "<uuid>",
  "relationships": [
    {
      "target_entity_id": "<uuid>",
      "target_name": "Acme Corp",
      "target_type": "organization",
      "relationship_type": "works_at",
      "weight": 0.95
    }
  ],
  "total": 1
}

Get Entity Facts

Endpoint
GET /knowledge/entities/:id/facts

Returns facts that reference the entity.

Path Parameters

FieldTypeDescription
idstring (required)The entity UUID.

Query Parameters

FieldTypeDescription
limitintegerMaximum facts to return. Default: 50, Max: 200.

Merge Entities

Endpoint
POST /knowledge/entities/merge

Merges a source entity into a target entity. The source is invalidated; the target absorbs its relationships and facts.

Body Parameters

FieldTypeDescription
source_idstring (required)Entity UUID to merge from (will be invalidated).
target_idstring (required)Entity UUID to merge into (will be updated).
space_idstringSpace UUID (for hub-scoped accounts).

Response (200)

Example Response
{
  "merged": true,
  "target_id": "<uuid>",
  "source_id": "<uuid>"
}

Warning: Merging invalidates the source entity. This cannot be undone.

Entity Subgraph & Path

N-hop subgraph around an entity

Endpoint
GET /knowledge/graph/subgraph/:entityId

Returns the neighborhood around an entity up to hops hops.

Path Parameters

FieldTypeDescription
entityIdstring (required)Center entity UUID.

Query Parameters

FieldTypeDescription
hopsintegerNumber of hops. Default: 2, Max: 5.
includeRelationshipsbooleanInclude relationship edges. Default: true.

Shortest path between two entities

Endpoint
GET /knowledge/graph/path

Finds the shortest path between two entities in the knowledge graph.

Query Parameters

FieldTypeDescription
fromstring (required)Starting entity UUID.
tostring (required)Target entity UUID.
maxHopsintegerMax path length. Default: 5, Max: 10.

Entity Object

The entity object contains the following fields:

FieldTypeDescription
idstringUUID identifier for the entity.
namestringThe primary name of the entity.
typestringEntity type (see the enum below).
relationship_countintegerNumber of active relationships on this entity. Populated by GET /knowledge/entities/:id.
fact_countintegerNumber of active facts that reference this entity. Populated by GET /knowledge/entities/:id.
created_atstringISO 8601 timestamp of when the entity was first extracted.
updated_atstringISO 8601 timestamp of when the entity was last updated.

Entity Types

Trix recognizes the following entity types:

TypeDescriptionExamples
personIndividual peopleColleagues, friends, contacts
organizationCompanies, teams, groupsAcme Corp, Engineering Team
locationPlaces and addressesSan Francisco, Office Building A
productProducts, tools, softwareSlack, PostgreSQL, iPhone
conceptAbstract concepts and topicsMachine Learning, Agile
eventMeetings, conferences, milestonesQ4 Planning, Product Launch
skillTechnologies, abilitiesPython, Project Management
dateDates and time periodsJanuary 2024, Last Quarter

Relationship Types

Common relationship types between entities:

TypeDescription
works_atPerson works at an organization
reports_toPerson reports to another person
collaborates_withTwo entities work together
located_inEntity is located at a location
usesEntity uses a product or skill
knowsPerson knows another person
part_ofEntity is part of another entity
related_toGeneral relationship