Skip to content

Relationships

Relationships connect memories in the knowledge graph. They are created automatically during retain and reflect operations.

{
"id": "r1-uuid",
"source_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"target_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"type": "is_about",
"strength": 0.85,
"created_at": "2025-01-15T10:30:00Z"
}
FieldTypeDescription
idUUIDRelationship identifier
source_idUUIDOrigin memory
target_idUUIDTarget memory
typestringRelationship kind
strengthfloat (0-1)Connection strength
created_atISO 8601When created

Types are flexible — the LLM infers appropriate types during retain and reflect. Common types:

TypeExample
is_aboutA fact describes a person or topic
related_toThematic connection
part_ofBelongs to a broader concept
contradictsConflicting information
supportsReinforcing evidence

Fetch relationships for multiple memories in a single request.

Terminal window
curl -X POST https://api.memlayer.dev/api/v1/relationships/batch \
-H "Content-Type: application/json" \
-d '["a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6a7-8901-bcde-f12345678901"]'

The request body is a JSON array of memory UUIDs. The response includes all relationships where any of the provided UUIDs appear as source_id or target_id.

You can also fetch relationships for a single memory:

Terminal window
curl https://api.memlayer.dev/api/v1/memories/a1b2c3d4-e5f6-7890-abcd-ef1234567890/relationships