MemNexus
Reference

Memories API

Memory management and retrieval endpoints

Memory management and retrieval endpoints

GET /api/memories

List memories

Query parameters:

ParameterTypeRequiredDescription
idPrefixstringNoFilter memories by ID prefix (git-style short ID lookup). Minimum 6 characters.
limitintegerNoMaximum number of memories to return
offsetintegerNoNumber of memories to skip
pageintegerNoPage number (alternative to offset)
sortBycreatedAt \updatedAt \eventTime
orderasc \descNo
fromstringNoFilter memories created on or after this ISO 8601 timestamp (ingestion time lower bound)
tostringNoFilter memories created on or before this ISO 8601 timestamp (ingestion time upper bound)
recentstringNoShorthand time filter relative to now (e.g. "24h", "7d", "2w"). Sets the lower bound for ingestion time. Takes precedence over from when both are provided.

Response: 200 List of memories

FieldTypeRequiredDescription
dataMemory[]No
paginationPaginationNo
filtersAppliedobjectNo

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

POST /api/memories

Create a memory

Request body:

FieldTypeRequiredDescription
conversationIdstringNoConversation ID - use "NEW" to always create a new conversation, provide an existing ID to append to it, or omit to auto-assign via claudeSessionId session grouping.
claudeSessionIdstringNoAgent session ID (e.g. MCP session ID, Claude Code session UUID). When conversationId is omitted, reuses or creates a conversation for this session (automatic grouping). Ignored when conversationId is explicitly provided. Works with any MCP client (Claude, Copilot, Cursor, etc.).
namestringNoOptional human-readable name for deterministic retrieval. Must be unique per user.
contentstringYesMemory content
memoryTypeepisodic \semantic \procedural
roleuser \assistant \system
contextstringNoContext or domain
topicsstring[]NoAssociated topics
eventTimestringNoEvent time (when the event actually occurred in reality, ISO 8601 format)
validFromstringNoValidity start time (when this fact becomes valid, ISO 8601 format)
validTostringNoValidity end time (when this fact expires, ISO 8601 format, omit for never expires)

Response: 201 Memory created successfully

FieldTypeRequiredDescription
dataMemoryYes
metaCreateMemoryResponseMetaYes

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

GET /api/memories/{id}

Get memory by ID

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe memory ID

Query parameters:

ParameterTypeRequiredDescription
detailminimal \standard \full

Response: 200 Memory retrieved successfully

FieldTypeRequiredDescription
dataMemoryYes

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/mem_abc123" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

PUT /api/memories/{id}

Update a memory

Path parameters:

ParameterTypeRequiredDescription
idstringYesMemory ID

Request body:

FieldTypeRequiredDescription
contentstringNoUpdated memory content
nameanyNoAssign or remove a name. Set to a valid name to assign, empty string to remove.
memoryTypeepisodic \semantic \procedural
contextstringNoUpdated context or domain
topicsstring[]NoUpdated topics

Response: 200 Memory updated successfully

FieldTypeRequiredDescription
dataMemoryNo

Example:

curl -X PUT "https://api.dev.memnexus.ai/api/memories/mem_abc123" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

DELETE /api/memories/{id}

Delete memory

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe memory ID

Response: 204 No Content

Example:

curl -X DELETE "https://api.dev.memnexus.ai/api/memories/mem_abc123" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

GET /api/memories/{id}/conversation-memories

Find memories from same conversation

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe source memory ID

Query parameters:

ParameterTypeRequiredDescription
limitintegerNoMaximum number of conversation memories to return

Response: 200 Conversation memories found

FieldTypeRequiredDescription
dataRelatedMemoryResult[]No
sourceMemoryMemoryNo
conversationIdstringNoThe conversation ID (null if memory has no conversation)

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/mem_abc123/conversation-memories" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

POST /api/memories/{id}/detect-relationships

Detect potential relationships for a memory

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe memory ID

Request body:

FieldTypeRequiredDescription
autoCreatebooleanNoAutomatically create high-confidence relationships
minConfidencenumberNoMinimum confidence threshold for suggestions

Response: 200 Relationship candidates detected

FieldTypeRequiredDescription
dataobject[]No
autoCreatedbooleanNo

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/mem_abc123/detect-relationships" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /api/memories/{id}/explain-relationship

Generate LLM explanation for a memory relationship

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe ID of the source memory

Request body:

FieldTypeRequiredDescription
otherMemoryIdstringYes
relationshipTypestringYes

Response: 200 Explanation generated

FieldTypeRequiredDescription
dataobjectNo

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/mem_abc123/explain-relationship" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

GET /api/memories/{id}/related

Find related memories by topics

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe source memory ID

Query parameters:

ParameterTypeRequiredDescription
limitintegerNoMaximum number of related memories to return

Response: 200 Related memories found

FieldTypeRequiredDescription
dataany[]No
sourceMemoryMemoryNo

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/mem_abc123/related" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

GET /api/memories/{id}/relationships

Get relationships for a memory

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe memory ID

Query parameters:

ParameterTypeRequiredDescription
directionoutgoing \incoming \both

Response: 200 Relationships retrieved successfully

FieldTypeRequiredDescription
dataMemoryRelationship[]Yes
sourceMemoryIdstringYesThe source memory ID these relationships are for
directionoutgoing \incoming \both

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/mem_abc123/relationships" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

POST /api/memories/{id}/relationships

Create a relationship between memories

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe source memory ID

Request body:

FieldTypeRequiredDescription
targetMemoryIdstringYesID of the target memory to create a relationship with
typeSUPERSEDES \FOLLOWS \RESOLVES \
confidencenumberNoConfidence score for the relationship (0-1, defaults to 1.0 for manual)
reasonstringNoOptional explanation for the relationship

Response: 201 Relationship created successfully

FieldTypeRequiredDescription
dataMemoryRelationshipNo

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/mem_abc123/relationships" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

DELETE /api/memories/{id}/relationships/{relationshipId}

Delete a relationship

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe source memory ID
relationshipIdstringYesThe relationship ID to delete

Response: 204 Relationship deleted successfully

Example:

curl -X DELETE "https://api.dev.memnexus.ai/api/memories/mem_abc123/relationships/rel_abc123" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

GET /api/memories/{id}/similar

Find similar memories

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe source memory ID

Query parameters:

ParameterTypeRequiredDescription
limitintegerNoMaximum number of similar memories to return

Response: 200 Similar memories found

FieldTypeRequiredDescription
dataRelatedMemoryResult[]No
sourceMemoryMemoryNo

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/mem_abc123/similar" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

GET /api/memories/{id}/timeline

Get timeline context for a memory

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe memory ID

Query parameters:

ParameterTypeRequiredDescription
beforeintegerNoNumber of preceding memories to return
afterintegerNoNumber of following memories to return

Response: 200 Timeline context retrieved successfully

FieldTypeRequiredDescription
dataobjectNo

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/mem_abc123/timeline" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

POST /api/memories/batch

Get multiple memories by IDs

Request body:

FieldTypeRequiredDescription
idsstring[]YesArray of memory IDs to retrieve. Non-existent or malformed IDs are returned in the 'missing' array rather than failing the request.
detailminimal \standard \full

Response: 200 Memories retrieved successfully

FieldTypeRequiredDescription
dataMemory[]Yes
metaBatchGetMemoriesMetaYes

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/batch" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /api/memories/build-context

Build a context briefing

Request body:

FieldTypeRequiredDescription
contextstringYesWhat you are about to work on
filesstring[]NoFile paths you will be touching
recentHoursnumberNoHow far back to look for recent activity (hours, default 24)

Response: 200 Context briefing generated successfully

FieldTypeRequiredDescription
activeWorkBuildContextActiveWorkYes
relevantFactsBuildContextFact[]YesFacts related to the context terms
gotchasBuildContextGotcha[]YesGotchas — facts appearing in 2+ source memories
recentActivityBuildContextActivity[]YesRecent relevant memories within the time window
relatedPatternsBuildContextPattern[]YesBehavioral patterns related to the context
metaBuildContextMetaYes

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/build-context" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

DELETE /api/memories/bulk

Bulk delete multiple memories

Request body:

FieldTypeRequiredDescription
idsstring[]YesMemory IDs to delete (max 100)
confirmDeletiontrueYesMust be true to confirm bulk deletion

Response: 200 Bulk delete results

FieldTypeRequiredDescription
deletedintegerYesNumber of memories successfully deleted
failedintegerYesNumber of memories that failed to delete
errorsobject[]YesPer-item error details

Example:

curl -X DELETE "https://api.dev.memnexus.ai/api/memories/bulk" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /api/memories/bulk-tag

Bulk add or remove topics from memories

Request body:

FieldTypeRequiredDescription
idsstring[]YesMemory IDs to modify tags on (max 100)
addTopicsstring[]NoTopics to add to all specified memories
removeTopicsstring[]NoTopics to remove from all specified memories

Response: 200 Bulk tag results

FieldTypeRequiredDescription
modifiedintegerYesNumber of memories successfully modified
failedintegerYesNumber of memories that failed to modify
errorsobject[]YesPer-item error details

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/bulk-tag" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /api/memories/bulk-update

Bulk update multiple memories

Request body:

FieldTypeRequiredDescription
idsstring[]YesMemory IDs to update (max 100)
updatesobjectYesFields to update on all specified memories

Response: 200 Bulk update results

FieldTypeRequiredDescription
updatedintegerYesNumber of memories successfully updated
failedintegerYesNumber of memories that failed to update
errorsobject[]YesPer-item error details

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/bulk-update" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /api/memories/digest

Generate memory digest

Request body:

FieldTypeRequiredDescription
querystringYesThe topic or subject to generate a digest for
recentstringNoTime window filter (e.g., "7d", "24h", "2w", "30m"). Only considers memories within this window.
topicsstring[]NoFilter to memories with these topics
conversationIdsstring[]NoLimit to specific conversation IDs
formatstructured \narrative \timeline \
maxSourcesintegerNoMaximum number of memories to consider (1-500, default 100)
includeMemoryIdsbooleanNoWhether to include source memory IDs in the response

Response: 200 Digest generated successfully

FieldTypeRequiredDescription
digeststringYesThe generated digest content (markdown formatted)
metadataDigestMetadataYes
sourcesDigestSource[]YesSource memories used to generate the digest, for traceability
keyFactsDigestKeyFact[]NoTop extracted facts relevant to the digest, deduplicated and ranked by frequency
entitiesDigestEntity[]NoKey entities mentioned across source memories
effectiveStateBreakdownEffectiveStateBreakdownNo

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/digest" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /api/memories/export

Export memories matching filters

Request body:

FieldTypeRequiredDescription
querystringNoOptional search query to filter memories for export
topicsstring[]NoFilter by topics
memoryTypeepisodic \semantic \procedural
formatjson \csvNo
fieldsstring[]NoOptional field selection. If omitted, all standard fields are included.
limitintegerNoMaximum results to export (default 100, max 1000)

Response: 200 Exported memories

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/export" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

GET /api/memories/named/{name}

Get a memory by name

Path parameters:

ParameterTypeRequiredDescription
namestringYesMemory name (kebab-case, 2-64 chars)

Query parameters:

ParameterTypeRequiredDescription
detailminimal \standard \full

Response: 200 Memory retrieved successfully

FieldTypeRequiredDescription
dataMemoryYes

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/named/{name}" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

PUT /api/memories/named/{name}

Update a named memory (create new version)

Path parameters:

ParameterTypeRequiredDescription
namestringYesMemory name (kebab-case, 2-64 chars)

Request body:

FieldTypeRequiredDescription
contentstringYesNew content for the named memory version
memoryTypeepisodic \semantic \procedural
contextstringNoContext or domain
topicsstring[]NoAssociated topics

Response: 201 New version created successfully

FieldTypeRequiredDescription
dataMemoryNo
metaobjectNo

Example:

curl -X PUT "https://api.dev.memnexus.ai/api/memories/named/{name}" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

GET /api/memories/named/{name}/history

Get version history for a named memory

Path parameters:

ParameterTypeRequiredDescription
namestringYesMemory name (kebab-case, 2-64 chars)

Response: 200 Version history retrieved successfully

FieldTypeRequiredDescription
namestringYesHuman-readable name for deterministic retrieval (kebab-case, 2-64 chars)
versionsobject[]Yes

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/named/{name}/history" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

POST /api/memories/repair-effective-state

Repair orphaned effectiveState values

Response: 200 Repair results

FieldTypeRequiredDescription
repairedintegerNo
memoriesobject[]No

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/repair-effective-state" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

GET /api/memories/search

Search memories (GET)

Query parameters:

ParameterTypeRequiredDescription
qstringYesSearch query string
searchMethodkeyword \semantic \hybrid
limitintegerNoMaximum number of results to return
offsetintegerNoNumber of results to skip for pagination
thresholdnumberNoMinimum similarity threshold for semantic search
modeunified \content \facts
vectorWeightnumberNoWeight for vector similarity in hybrid search
fulltextWeightnumberNoWeight for fulltext matching in hybrid search
topicsstringNoComma-separated list of topics to filter by (include memories with ANY of these topics)
excludeTopicsstringNoComma-separated list of topics to exclude (exclude memories with ANY of these topics)
memoryTypeepisodic \semantic \procedural
conversationIdstringNoFilter by conversation ID
explainbooleanNoInclude detailed match explanations in results
includeTopicsbooleanNoInclude associated topics in results
includeEntitiesbooleanNoInclude mentioned entities in results
includeFactsbooleanNoInclude extracted facts in results
asOfTimestringNoPoint-in-time query (ISO 8601 datetime)
validAtTimestringNoFilter by validity time (ISO 8601 datetime)
eventTimeFromstringNoEvent time range start (ISO 8601 datetime)
eventTimeTostringNoEvent time range end (ISO 8601 datetime)
ingestionTimeFromstringNoIngestion time range start (ISO 8601 datetime)
ingestionTimeTostringNoIngestion time range end (ISO 8601 datetime)
includeExpiredbooleanNoInclude expired memories in results
temporalModecurrent \historical \evolution
sortByrelevance \createdAt \updatedAt \
orderasc \descNo
expandEntitiesbooleanNoEnable entity graph traversal branch in hybrid search
expandTopicsbooleanNoEnable topic graph traversal branch in hybrid search
expandFactsbooleanNoEnable fact graph traversal branch in hybrid search
includeSupersededbooleanNoInclude superseded and contradicted memories in results
entityWeightnumberNoWeight for entity graph branch in hybrid search
topicWeightnumberNoWeight for topic graph branch in hybrid search
factWeightnumberNoWeight for fact graph branch in hybrid search
includeFacetsbooleanNoInclude facet aggregation (topics, memoryType, effectiveState) in response

Response: 200 Search results

FieldTypeRequiredDescription
dataSearchResult[]YesFlattened search results with memory fields and search metadata
metaSearchMetaYes
facetsFacetsNo

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/search" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"

POST /api/memories/search

Search all memories

Request body:

FieldTypeRequiredDescription
querystringYesSearch query
modeunified \content \facts
searchMethodkeyword \semantic \hybrid
limitintegerNoMaximum number of results (defaults to 20)
offsetintegerNoOffset for pagination (defaults to 0)
vectorWeightnumberNoWeight for vector (semantic) results in hybrid search (0-1, defaults to 0.7)
fulltextWeightnumberNoWeight for fulltext (keyword) results in hybrid search (0-1, defaults to 0.3)
thresholdnumberNoMinimum similarity threshold for semantic search (0-1, defaults to 0.5)
explainbooleanNoIf true, include detailed explanation of how each result was matched
asOfTimestringNoPoint-in-time query: show what the system knew at this time (ISO 8601 format)
validAtTimestringNoValidity query: show facts that were valid at this time (ISO 8601 format)
eventTimeFromstringNoEvent time range start (ISO 8601 format)
eventTimeTostringNoEvent time range end (ISO 8601 format)
ingestionTimeFromstringNoIngestion time range start (ISO 8601 format)
ingestionTimeTostringNoIngestion time range end (ISO 8601 format)
includeExpiredbooleanNoInclude expired facts (defaults to false)
temporalModecurrent \historical \evolution
topicsstring[]NoFilter by topics - returns memories that have ANY of the specified topics
memoryTypeepisodic \semantic \procedural
conversationIdstringNoFilter by conversation ID
includeTopicsbooleanNoInclude topics associated with matched memories (defaults to false for performance)
includeEntitiesbooleanNoInclude entities mentioned in matched memories (defaults to false for performance)
includeFactsbooleanNoInclude facts extracted from matched memories (defaults to false for performance)
entityTypesstring[]NoFilter entities by type (e.g., PERSON, TECHNOLOGY, PROJECT)
expandEntitiesbooleanNoEnable entity graph traversal branch in hybrid search (default false)
expandTopicsbooleanNoEnable topic graph traversal branch in hybrid search (default false)
expandFactsbooleanNoEnable fact graph traversal branch in hybrid search (default false)
includeSupersededbooleanNoInclude superseded and contradicted memories in results (default false)
entityWeightnumberNoWeight for entity graph branch in hybrid search (0-1, default 0.7)
topicWeightnumberNoWeight for topic graph branch in hybrid search (0-1, default 0.5)
factWeightnumberNoWeight for fact graph branch in hybrid search (0-1, default 0.6)
sortByrelevance \createdAt \updatedAt \
orderasc \descNo
includeFacetsbooleanNoInclude facet aggregation (topics, memoryType, effectiveState) in response (defaults to false)

Response: 200 Search results

FieldTypeRequiredDescription
dataSearchResult[]YesFlattened search results with memory fields and search metadata
metaSearchMetaYes
facetsFacetsNo

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/search" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /api/memories/search/feedback

Record behavioral feedback on a search result

Request body:

FieldTypeRequiredDescription
memoryIdstringYesID of the memory result being rated
actionselected \not_selectedYes
searchMethodstringNoSearch method used (hybrid, semantic, keyword)

Response: 204 Feedback recorded

Example:

curl -X POST "https://api.dev.memnexus.ai/api/memories/search/feedback" \
  -H "Authorization: Bearer cmk_live_xxx.yyy" \
  -H "Content-Type: application/json" \
  -d '{}'

GET /api/memories/stats

Aggregated memory analytics

Query parameters:

ParameterTypeRequiredDescription
groupByday \week \month \
afterstringNoFilter memories on or after this ISO 8601 timestamp
beforestringNoFilter memories on or before this ISO 8601 timestamp
recentstringNoShorthand time window relative to now (e.g. 7d, 2w, 1mo). Sets the lower bound. Takes precedence over after.
topicstringNoPre-filter to memories that contain this topic before grouping
limitintegerNoMaximum number of buckets to return

Response: 200 Aggregated memory statistics

FieldTypeRequiredDescription
groupByday \week \month \
dataobject[]No
totalintegerNo
filtersobjectNo

Example:

curl -X GET "https://api.dev.memnexus.ai/api/memories/stats" \
  -H "Authorization: Bearer cmk_live_xxx.yyy"