MemorySync
API Reference

Batch Update Memory

Apply up to 100 metadata edits in one request and read a per-item outcome for every one.

Endpoint and request fields

POST/memory/batch-update
207 Multi-Status
FieldTypeContract
itemsarrayRequired; 1–100 edits.
items[].memory_idintegerRequired positive identifier.
items[].tagsstring[]Optional replacement tag list. [] clears all tags.
items[].importancenumberOptional value from 0 to 1.
items[].metadataobjectOptional replacement metadata bag. Reserved keys are filtered out.
items[].sourcestringOptional source label.
items[].event_type / eventTypestringOptional event label.

Each item needs at least one editable field. An item that changes nothing is a request error, not a silent no-op.

Edit several memories

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="usr_7f3a9c2e",
)
from memorysync import BatchUpdateItem
result = client.batch_update([
BatchUpdateItem(memory_id=101, tags=["preference", "verified"], importance=0.9),
BatchUpdateItem(memory_id=102, metadata={"reviewed_by": "support"}),
])

Result paths

MeaningPython pathNode.js pathREST path
Totalsresult.total, .updated, .not_foundresult.total, .updated, .notFoundtotal, updated, not_found
Per-item outcomeresult.results[i].statusresult.results[i].statusresults[i].status
Fields changedresult.results[i].changed_fieldsresult.results[i].changedFieldsresults[i].changed_fields
207-response.json
{"total":3,"updated":2,"not_found":1,"results":[{"index":0,"memory_id":101,"status":"updated","changed_fields":["tags","importance"]},{"index":1,"memory_id":102,"status":"updated","changed_fields":["metadata"]},{"index":2,"memory_id":99999999,"status":"not_found","changed_fields":[]}]}

What is and is not atomic

All applied edits land in one transaction, so the batch either commits or it does not. An id the caller cannot see is reported as not_found rather than failing the request — it was never part of the transaction.

Reserved metadata keys

content_type, source, event_type, user_id, project_id, environment, feedback_log and feedback_patterns are platform-owned. A caller-supplied bag cannot set or overwrite them, and they survive a bag replacement. The first four drive retrieval filtering and data isolation, so being able to set them through metadata would let a memory answer for a different scope.

Errors and next action

A 422 means the request shape is wrong: an empty list, more than 100 items, the same memory_id twice, or an item with no editable field. Two edits to one memory have no defined order, so the duplicate is refused rather than resolved by position.

Safety notes