Skip to main content
PATCH
/
v4
/
memories
Update a memory (creates new version)
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    containerTag: 'user_123',
    newContent: 'John now prefers light mode',
    id: 'mem_abc123',
    content: 'John prefers dark mode',
    metadata: {}
  })
};

fetch('https://api.supermemory.ai/v4/memories', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "mem_xyz789",
  "memory": "John now prefers light mode",
  "version": 2,
  "parentMemoryId": "mem_abc123",
  "rootMemoryId": "mem_abc123",
  "createdAt": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
containerTag
string
required

Container tag / space identifier. Required to scope the operation.

Example:

"user_123"

newContent
string
required

The new content that will replace the existing memory

Minimum string length: 1
Example:

"John now prefers light mode"

id
string

ID of the memory entry to operate on

Example:

"mem_abc123"

content
string

Exact content match of the memory entry to operate on. Use this when you don't have the ID.

Example:

"John prefers dark mode"

metadata
object

Optional metadata. If not provided, inherits from the previous version.

Response

Memory updated successfully

Response after updating a memory

id
string
required

ID of the newly created memory version

Example:

"mem_xyz789"

memory
string
required

The content of the new memory version

Example:

"John now prefers light mode"

version
number
required

Version number of this memory entry

Example:

2

parentMemoryId
string | null
required

ID of the memory this version updates

Example:

"mem_abc123"

rootMemoryId
string | null
required

ID of the first memory in this version chain

Example:

"mem_abc123"

createdAt
string<datetime>
required

When this memory version was created