MemNexus
Reference

Narratives API

Narrative thread management endpoints

Narrative thread management endpoints

GET /api/narratives

List narrative threads

Query parameters:

ParameterTypeRequiredDescription
limitintegerNoMaximum number of narratives to return
offsetintegerNoNumber of narratives to skip
stateopen \resolved \reopened \
topicsstringNoComma-separated list of topics to filter by

Response: 200 List of narratives

FieldTypeRequiredDescription
dataNarrativeThread[]Yes
paginationobjectYes

Example:

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

POST /api/narratives

Create a narrative thread

Request body:

FieldTypeRequiredDescription
titlestringYesTitle for the narrative thread
rootMemoryIdstringYesID of the first memory in this narrative
topicsstring[]NoTopics to associate with this narrative

Response: 201 Narrative created successfully

FieldTypeRequiredDescription
dataNarrativeThreadYes

Example:

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

GET /api/narratives/{id}

Get a narrative thread

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe narrative ID

Response: 200 Narrative retrieved successfully

FieldTypeRequiredDescription
dataNarrativeThreadYes

Example:

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

PATCH /api/narratives/{id}

Update a narrative thread

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe narrative ID

Request body:

FieldTypeRequiredDescription
titlestringNoUpdated title for the narrative
stateopen \resolved \reopened \
resolutionMemoryIdstringNoID of the memory that resolves this narrative
topicsstring[]NoUpdated topics for the narrative

Response: 200 Narrative updated successfully

FieldTypeRequiredDescription
dataNarrativeThreadYes

Example:

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

DELETE /api/narratives/{id}

Delete a narrative thread

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe narrative ID

Response: 204 Narrative deleted successfully

Example:

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

POST /api/narratives/{id}/memories

Add a memory to a narrative

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe narrative ID

Request body:

FieldTypeRequiredDescription
memoryIdstringYesID of the memory to add to the narrative
positionintegerNoPosition in the narrative (0-indexed, omit for append)

Response: 200 Memory added to narrative successfully

FieldTypeRequiredDescription
dataNarrativeThreadYes

Example:

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

DELETE /api/narratives/{id}/memories/{memoryId}

Remove a memory from a narrative

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe narrative ID
memoryIdstringYesThe memory ID to remove

Response: 204 Memory removed from narrative successfully

Example:

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

GET /api/narratives/{id}/timeline

Get narrative timeline

Path parameters:

ParameterTypeRequiredDescription
idstringYesThe narrative ID

Query parameters:

ParameterTypeRequiredDescription
limitintegerNoMaximum number of memories to return
offsetintegerNoNumber of memories to skip

Response: 200 Narrative timeline retrieved successfully

FieldTypeRequiredDescription
dataNarrativeMemory[]Yes
narrativeNarrativeThreadYes
paginationobjectYes

Example:

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