API Documentation
Long-term memory service for creation, retrieval, semantic search, mutation, supersession handling, restoration, and recall observability.
/api/v1/memoriesList all memories for a subject. Use this for full memory management.
memories:readsubject_idrequiredlimitoffsetcurl -G "https://www.mnexium.com/api/v1/memories" \
-H "x-mnexium-key: $MNX_KEY" \
--data-urlencode "subject_id=user_123" \
--data-urlencode "limit=20"{
"data": [
{
"id": "mem_abc123",
"text": "User prefers dark mode interfaces",
"kind": "preference",
"importance": 75,
"created_at": "2024-12-15T10:30:00Z"
}
],
"count": 1
}/api/v1/memories/searchSemantic search over a subject's memories. Returns the most relevant items by similarity score.
memories:searchsubject_idrequiredqrequiredlimitcurl -G "https://www.mnexium.com/api/v1/memories/search" \
-H "x-mnexium-key: $MNX_KEY" \
--data-urlencode "subject_id=user_123" \
--data-urlencode "q=food preferences" \
--data-urlencode "limit=5"{
"data": [
{
"id": "mem_xyz789",
"text": "User is vegetarian and enjoys Italian cuisine",
"score": 0.92
},
{
"id": "mem_uvw012",
"text": "User is allergic to peanuts",
"score": 0.78
}
],
"query": "food preferences",
"count": 2
}/api/v1/memoriesManually create a memory. For automatic extraction with LLM-chosen classification, use the Responses or Chat API with learn: true instead.
memories:writelearn: true, the LLM automatically extracts memories and intelligently chooses the kind, importance, and tags based on conversation context. Use learn: "force" to always create a memory. This endpoint is for manual injection when you need direct control.subject_idrequiredtextrequiredkindvisibilityimportancetagsmetadatano_supersedelearn: true with the Responses/Chat API, the LLM intelligently chooses kind, visibility, importance, and tags based on context. The fallback values above only apply when manually creating memories via this endpoint.curl -X POST "https://www.mnexium.com/api/v1/memories" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject_id": "user_123",
"text": "User prefers dark mode interfaces",
"kind": "preference",
"importance": 75,
"no_supersede": false
}'{
"id": "mem_abc123",
"subject_id": "user_123",
"text": "User prefers dark mode interfaces",
"kind": "preference",
"created": true,
"superseded_count": 0,
"superseded_ids": []
}/api/v1/memories/:idGet a specific memory by ID.
memories:readidrequiredcurl "https://www.mnexium.com/api/v1/memories/mem_abc123" \
-H "x-mnexium-key: $MNX_KEY"{
"data": {
"id": "mem_abc123",
"subject_id": "user_123",
"text": "User prefers dark mode interfaces",
"kind": "preference",
"importance": 75,
"created_at": "2024-12-15T10:30:00Z"
}
}/api/v1/memories/:id/claimsGet structured claims/assertions extracted from a specific memory.
memories:readidrequiredcurl "https://www.mnexium.com/api/v1/memories/mem_abc123/claims" \
-H "x-mnexium-key: $MNX_KEY"{
"data": [
{
"id": "ast_abc123",
"predicate": "favorite_color",
"type": "string",
"value": "yellow",
"confidence": 0.95,
"status": "active",
"first_seen_at": "2024-12-15T10:30:00Z",
"last_seen_at": "2024-12-15T10:30:00Z"
}
],
"count": 1
}/api/v1/memories/:idUpdate an existing memory. Embeddings are regenerated if text changes.
memories:writeidrequiredtextkindimportancetagscurl -X PATCH "https://www.mnexium.com/api/v1/memories/mem_abc123" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "User strongly prefers dark mode",
"importance": 90
}'{
"id": "mem_abc123",
"updated": true
}/api/v1/memories/:idSoft-delete a memory. The memory is deactivated but retained for audit.
memories:deleteidrequiredcurl -X DELETE "https://www.mnexium.com/api/v1/memories/mem_abc123" \
-H "x-mnexium-key: $MNX_KEY"{
"ok": true,
"deleted": true
}/api/v1/memories/supersededList memories that have been superseded (replaced by newer memories). Useful for audit and debugging.
memories:readsubject_idrequiredlimitoffsetcurl -G "https://www.mnexium.com/api/v1/memories/superseded" \
-H "x-mnexium-key: $MNX_KEY" \
--data-urlencode "subject_id=user_123"{
"data": [
{
"id": "mem_old123",
"text": "Favorite fruit is blueberry",
"status": "superseded",
"superseded_by": "mem_new456",
"created_at": "2024-12-10T10:00:00Z"
}
],
"count": 1
}/api/v1/memories/:id/restoreRestore a superseded memory back to active status. Use this to undo an incorrect supersede.
memories:writeidrequiredcurl -X POST "https://www.mnexium.com/api/v1/memories/mem_old123/restore" \
-H "x-mnexium-key: $MNX_KEY"{
"ok": true,
"restored": true,
"id": "mem_old123",
"subject_id": "user_123",
"text": "Favorite fruit is blueberry"
}Memory Versioning & Conflict Resolution
Mnexium automatically handles conflicting memories. When a user updates a preference or fact, the system detects semantically similar memories and supersedes them.
Example: If a user has the memory "Favorite fruit is blueberry" and later says "my new favorite fruit is strawberry", the system will:
- Extract the new memory: "User's favorite fruit is strawberry"
- Detect the old "blueberry" memory as a conflict
- Mark the old memory as
superseded - Only the new "strawberry" memory will be recalled in future conversations
Memory Status
activeMemory is current and will be included in recall searches.supersededMemory has been replaced by a newer one. Excluded from recall but retained for audit.Usage Tracking
When memories are recalled during a chat completion with recall: true, the system automatically tracks:
last_seen_at— Timestamp of the most recent recallseen_count— Total number of times the memory has been recalled
/api/v1/memories/recallsQuery memory recall events for auditability. Track which memories were used in which conversations.
memories:readchat_idmemory_idstatslimitcurl -G "https://www.mnexium.com/api/v1/memories/recalls" \
-H "x-mnexium-key: $MNX_KEY" \
--data-urlencode "chat_id=550e8400-e29b-41d4-a716-446655440000"{
"data": [
{
"event_id": "evt_abc123",
"memory_id": "mem_xyz789",
"memory_text": "User prefers dark mode",
"similarity_score": 78.5,
"message_index": 0,
"recalled_at": "2024-12-15T10:30:00Z"
}
],
"count": 1,
"chat_id": "550e8400-e29b-41d4-a716-446655440000"
}curl -G "https://www.mnexium.com/api/v1/memories/recalls" \
-H "x-mnexium-key: $MNX_KEY" \
--data-urlencode "memory_id=mem_xyz789" \
--data-urlencode "stats=true"{
"memory_id": "mem_xyz789",
"stats": {
"total_recalls": 15,
"unique_chats": 8,
"avg_score": 72.4,
"first_recalled_at": "2024-12-01T09:00:00Z",
"last_recalled_at": "2024-12-15T10:30:00Z"
}
}chat_logged field indicates whether the chat was saved to history (log: true). When chat_logged = 0, the recall event is tracked but the chat messages are not stored.