Memory Graph
curl --request GET \
--url https://api.memoclaw.com/v1/memories/{id}/graphimport requests
url = "https://api.memoclaw.com/v1/memories/{id}/graph"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.memoclaw.com/v1/memories/{id}/graph', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memoclaw.com/v1/memories/{id}/graph",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.memoclaw.com/v1/memories/{id}/graph"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.memoclaw.com/v1/memories/{id}/graph")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memoclaw.com/v1/memories/{id}/graph")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"root": {
"id": "<string>",
"content": "<string>",
"importance": 123
},
"nodes": [
{}
],
"edges": [
{
"source_id": "<string>",
"target_id": "<string>",
"relation_type": "<string>"
}
],
"depth": 123
}API Reference
Memory Graph
GET /v1/memories//graph — Traverse the memory knowledge graph.
GET
/
v1
/
memories
/
{id}
/
graph
Memory Graph
curl --request GET \
--url https://api.memoclaw.com/v1/memories/{id}/graphimport requests
url = "https://api.memoclaw.com/v1/memories/{id}/graph"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.memoclaw.com/v1/memories/{id}/graph', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memoclaw.com/v1/memories/{id}/graph",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.memoclaw.com/v1/memories/{id}/graph"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.memoclaw.com/v1/memories/{id}/graph")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memoclaw.com/v1/memories/{id}/graph")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"root": {
"id": "<string>",
"content": "<string>",
"importance": 123
},
"nodes": [
{}
],
"edges": [
{
"source_id": "<string>",
"target_id": "<string>",
"relation_type": "<string>"
}
],
"depth": 123
}This endpoint requires wallet authentication for identity. It is free — no payment required.
Path Parameters
string
required
UUID of the starting memory.
Query Parameters
number
Maximum hops to traverse. Default:
2. Max: 5.number
Maximum total memories to return. Default:
50. Max: 200.string
Comma-separated list of relation types to include:
related_to, derived_from, contradicts, supersedes, supports.Response (200 OK)
object
array
All memories discovered in the graph traversal.
array
number
Actual depth traversed.
Example
curl "https://api.memoclaw.com/v1/memories/550e8400-e29b-41d4-a716-446655440000/graph?depth=2" \
-H "x-wallet-auth: 0xYourWallet:1699900000:0xSignature..."
const response = await fetch(
"https://api.memoclaw.com/v1/memories/550e8400-e29b-41d4-a716-446655440000/graph?depth=2",
{ headers: { "x-wallet-auth": await getAuthHeader() } }
);
const data = await response.json();
from memoclaw import MemoClaw
client = MemoClaw()
result = client.get_memory_graph(
"550e8400-e29b-41d4-a716-446655440000",
depth=2,
)
print(f"Found {len(result.nodes)} nodes and {len(result.edges)} edges")
import { MemoClawClient } from "memoclaw";
const client = new MemoClawClient();
const result = await client.getMemoryGraph(
"550e8400-e29b-41d4-a716-446655440000",
{ depth: 2 }
);
console.log(`Found ${result.nodes.length} nodes and ${result.edges.length} edges`);
Response
{
"root": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"content": "User prefers dark mode",
"importance": 0.8
},
"nodes": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"content": "User prefers dark mode",
"importance": 0.8
},
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"content": "Dark mode saves battery",
"importance": 0.5
},
{
"id": "770e8400-e29b-41d4-a716-446655440002",
"content": "User uses vim keybindings",
"importance": 0.7
}
],
"edges": [
{
"source_id": "550e8400-e29b-41d4-a716-446655440000",
"target_id": "660e8400-e29b-41d4-a716-446655440001",
"relation_type": "supports"
},
{
"source_id": "550e8400-e29b-41d4-a716-446655440000",
"target_id": "770e8400-e29b-41d4-a716-446655440002",
"relation_type": "related_to"
}
],
"depth": 2
}