Skip to main content

Entities

Entities represent knowledge graph nodes -- people, organizations, technologies, and other named concepts. Link entities to memories to build a traversable knowledge graph across your agent's memory.

Entity Types​

TypeDescription
personA person or individual
organizationA company, team, or group
technologyA programming language, framework, or tool
projectA project or initiative
productA product or service
locationA physical or virtual location
documentA document, file, or URL
metricA KPI, measurement, or statistic
eventA meeting, milestone, or occurrence
skillA capability or competency
conceptAn abstract idea or topic
otherAnything that does not fit the above
Type Aliases

The alias place is accepted and automatically mapped to location.

Create Entity​

POST /v1/entities

Request Body​

FieldTypeRequiredDescription
namestringYesEntity name (1-255 characters)
entity_typestringYesOne of the entity types listed above (also accepts type as an alias)
metadataobjectNoCustom metadata (max 10KB)

Response 201 Created​

{
"object": "entity",
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "John Doe",
"entity_type": "person",
"metadata": {
"role": "customer",
"tier": "premium"
},
"memory_count": 0,
"relationship_count": 0,
"created_at": "2026-03-17T12:00:00Z",
"updated_at": "2026-03-17T12:00:00Z"
}

curl​

curl -X POST https://api.memoryrelay.net/v1/entities \
-H "Authorization: Bearer $MEMORYRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"entity_type": "person",
"metadata": { "role": "customer", "tier": "premium" }
}'

Python SDK​

from memoryrelay import MemoryRelay

client = MemoryRelay(api_key="mem_prod_...")

entity = client.entities.create(
name="John Doe",
entity_type="person",
metadata={"role": "customer", "tier": "premium"},
)
print(entity.id)

List Entities​

GET /v1/entities

Query Parameters​

ParameterTypeDefaultDescription
limitinteger20Results per page (1-100)
offsetinteger0Number of results to skip
entity_typestring--Filter by entity type

Response​

{
"object": "list",
"data": [
{
"object": "entity",
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "John Doe",
"entity_type": "person",
"metadata": { "role": "customer" },
"memory_count": 7,
"relationship_count": 3,
"created_at": "2026-03-17T12:00:00Z",
"updated_at": "2026-03-17T12:00:00Z"
}
],
"has_more": false,
"next_cursor": null,
"total_count": 1
}

curl​

curl "https://api.memoryrelay.net/v1/entities?entity_type=person&limit=20" \
-H "Authorization: Bearer $MEMORYRELAY_API_KEY"

Python SDK​

entities = client.entities.list(entity_type="person", limit=20)
for entity in entities.data:
print(f"{entity.name} ({entity.entity_type}): {entity.memory_count} memories")

Get Entity​

GET /v1/entities/{id}

Path Parameters​

ParameterTypeDescription
idUUIDEntity ID

Response​

Returns a single entity object.

curl​

curl https://api.memoryrelay.net/v1/entities/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer $MEMORYRELAY_API_KEY"

Python SDK​

entity = client.entities.get("550e8400-e29b-41d4-a716-446655440000")
print(f"{entity.name}: {entity.memory_count} linked memories")

Update Entity​

PATCH /v1/entities/{id}

Path Parameters​

ParameterTypeDescription
idUUIDEntity ID

Request Body​

FieldTypeRequiredDescription
namestringNoUpdated name (1-255 characters)
entity_typestringNoUpdated entity type
metadataobjectNoUpdated metadata (merged with existing)

Response​

Returns the updated entity object.

curl​

curl -X PATCH https://api.memoryrelay.net/v1/entities/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer $MEMORYRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "John Smith",
"metadata": { "tier": "enterprise" }
}'

Python SDK​

updated = client.entities.update(
"550e8400-e29b-41d4-a716-446655440000",
name="John Smith",
metadata={"tier": "enterprise"},
)

Delete Entity​

DELETE /v1/entities/{id}

Soft-delete an entity. Associated memory links are preserved but the entity is excluded from queries.

Path Parameters​

ParameterTypeDescription
idUUIDEntity ID

Response​

Returns 204 No Content on success.

curl​

curl -X DELETE https://api.memoryrelay.net/v1/entities/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer $MEMORYRELAY_API_KEY"

Python SDK​

client.entities.delete("550e8400-e29b-41d4-a716-446655440000")

POST /v1/entities/link

Create a connection between an entity and a memory with an optional relationship label. This builds the knowledge graph by associating entities with the memories that reference them.

Request Body​

FieldTypeRequiredDescription
entity_idUUIDYesID of the entity to link
memory_idUUIDYesID of the memory to link
relationshipstringNoRelationship label (default: mentioned_in). Examples: mentioned_in, created_by, relates_to, authored_by

Response 201 Created​

{
"entity_id": "550e8400-e29b-41d4-a716-446655440000",
"memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"relevance_score": 1.0,
"created_at": "2026-03-17T12:30:00Z"
}

curl​

curl -X POST https://api.memoryrelay.net/v1/entities/link \
-H "Authorization: Bearer $MEMORYRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entity_id": "550e8400-e29b-41d4-a716-446655440000",
"memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"relationship": "mentioned_in"
}'

Python SDK​

link = client.entities.link(
entity_id="550e8400-e29b-41d4-a716-446655440000",
memory_id="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
relationship="mentioned_in",
)
Auto-Extraction

When creating memories, set auto_extract_entities: true to automatically identify and link entities from the memory content. This uses NLP to detect names, organizations, technologies, and other entity types.