Skip to main content
POST
https://api.memoclaw.com
/
v1
/
memories
/
{id}
/
relations
Memory Relations
curl --request POST \
  --url https://api.memoclaw.com/v1/memories/{id}/relations \
  --header 'Content-Type: application/json' \
  --data '
{
  "target_id": "<string>",
  "relation_type": "<string>",
  "metadata": {}
}
'
Price: FREE Relations let you create explicit links between memories. Use them to build knowledge graphs, track contradictions, or group related facts.

Relation Types

TypeDescription
related_toGeneral relationship between related memories
derived_fromMemory was derived/synthesized from another (e.g. consolidation)
contradictsMemories that conflict (useful for tracking corrections)
supersedesNew memory replaces old one
supportsMemory provides supporting evidence for another

POST /v1/memories/:id/relations

Create a relationship from one memory to another.

Path Parameters

id
string
required
Source memory UUID.

Request Body

target_id
string
required
Target memory UUID to link to.
relation_type
string
required
One of: related_to, derived_from, contradicts, supersedes, supports.
metadata
object
Optional metadata for the relationship.

Example

curl -X POST https://api.memoclaw.com/v1/memories/550e8400-e29b-41d4-a716-446655440001/relations \
  -H "Content-Type: application/json" \
  -d '{
    "target_id": "550e8400-e29b-41d4-a716-446655440002",
    "relation_type": "supersedes",
    "metadata": {
      "reason": "User corrected their timezone preference"
    }
  }'
Response
{
  "id": "rel-123e4567-e89b-12d3-a456-426614174000",
  "source_id": "550e8400-e29b-41d4-a716-446655440001",
  "target_id": "550e8400-e29b-41d4-a716-446655440002",
  "relation_type": "supersedes",
  "metadata": {
    "reason": "User corrected their timezone preference"
  },
  "created_at": "2024-02-11T10:45:00Z"
}

GET /v1/memories/:id/relations

List all relationships for a memory (both incoming and outgoing).

Path Parameters

id
string
required
Memory UUID.

Example

curl
curl https://api.memoclaw.com/v1/memories/550e8400-e29b-41d4-a716-446655440001/relations
Response
{
  "relations": [
    {
      "id": "rel-123e4567-e89b-12d3-a456-426614174000",
      "source_id": "550e8400-e29b-41d4-a716-446655440001",
      "target_id": "550e8400-e29b-41d4-a716-446655440002",
      "relation_type": "supersedes",
      "direction": "outgoing",
      "created_at": "2024-02-11T10:45:00Z"
    },
    {
      "id": "rel-223e4567-e89b-12d3-a456-426614174001",
      "source_id": "550e8400-e29b-41d4-a716-446655440005",
      "target_id": "550e8400-e29b-41d4-a716-446655440001",
      "relation_type": "supports",
      "direction": "incoming",
      "created_at": "2024-02-10T08:30:00Z"
    }
  ]
}

DELETE /v1/memories/:id/relations/:relationId

Remove a relationship.

Path Parameters

id
string
required
Memory UUID.
relationId
string
required
Relation UUID to delete.

Example

curl
curl -X DELETE https://api.memoclaw.com/v1/memories/550e8400-e29b-41d4-a716-446655440001/relations/rel-123e4567-e89b-12d3-a456-426614174000
Response
{
  "deleted": true
}