Memories
Create a memory
Save or replace a note by namespace and key.
POST
/
api
/
v2
/
memories
from hai_agents import Client
client = Client()
note = client.memories.create_memory(
namespace="market-research", key="preferences/report-format",
value="Tables, with a source link per row.", delete_after_min=None,
)
print(note.id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const note = await client.memories.createMemory({
namespace: "market-research", key: "preferences/report-format",
value: "Tables, with a source link per row.", deleteAfterMin: null,
});
console.log(note.id);
curl -X POST https://agp.eu.hcompany.ai/api/v2/memories \
-H "Authorization: Bearer $HAI_API_KEY" -H "Content-Type: application/json" \
-d '{"namespace":"market-research","key":"preferences/report-format","value":"Tables, with a source link per row.","delete_after_min":null}'
holo memories set market-research preferences/report-format \
"Tables, with a source link per row." --forever
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"namespace": "market-research",
"key": "preferences/report-format",
"value": "Tables, with a source link per row.",
"created_at": "2026-12-02T10:00:00Z",
"updated_at": "2026-12-02T10:00:00Z",
"delete_after_min": null
}
Request body
1 to 255 characters. Agents’
memory.namespace setting has a tighter limit of 127 characters, so use at most 127 for notes an agent should access.1 to 1024 characters. Slash paths such as
preferences/report-format are useful for grouping notes.Minutes after this write before the note expires, from
1 to 2147483647. Omit it, or pass null, to keep the note until explicit deletion. Your privacy retention setting does not apply. Every write restarts the window and chooses the retention again, including an update that omits this field.Response
201 for a new note, 200 for a replacement. Both return the memory object.
from hai_agents import Client
client = Client()
note = client.memories.create_memory(
namespace="market-research", key="preferences/report-format",
value="Tables, with a source link per row.", delete_after_min=None,
)
print(note.id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const note = await client.memories.createMemory({
namespace: "market-research", key: "preferences/report-format",
value: "Tables, with a source link per row.", deleteAfterMin: null,
});
console.log(note.id);
curl -X POST https://agp.eu.hcompany.ai/api/v2/memories \
-H "Authorization: Bearer $HAI_API_KEY" -H "Content-Type: application/json" \
-d '{"namespace":"market-research","key":"preferences/report-format","value":"Tables, with a source link per row.","delete_after_min":null}'
holo memories set market-research preferences/report-format \
"Tables, with a source link per row." --forever
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"namespace": "market-research",
"key": "preferences/report-format",
"value": "Tables, with a source link per row.",
"created_at": "2026-12-02T10:00:00Z",
"updated_at": "2026-12-02T10:00:00Z",
"delete_after_min": null
}
Errors
422 for invalid input. See common errors.Was this page helpful?
⌘I
from hai_agents import Client
client = Client()
note = client.memories.create_memory(
namespace="market-research", key="preferences/report-format",
value="Tables, with a source link per row.", delete_after_min=None,
)
print(note.id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const note = await client.memories.createMemory({
namespace: "market-research", key: "preferences/report-format",
value: "Tables, with a source link per row.", deleteAfterMin: null,
});
console.log(note.id);
curl -X POST https://agp.eu.hcompany.ai/api/v2/memories \
-H "Authorization: Bearer $HAI_API_KEY" -H "Content-Type: application/json" \
-d '{"namespace":"market-research","key":"preferences/report-format","value":"Tables, with a source link per row.","delete_after_min":null}'
holo memories set market-research preferences/report-format \
"Tables, with a source link per row." --forever
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"namespace": "market-research",
"key": "preferences/report-format",
"value": "Tables, with a source link per row.",
"created_at": "2026-12-02T10:00:00Z",
"updated_at": "2026-12-02T10:00:00Z",
"delete_after_min": null
}