API Documentation
Real-time SSE event stream for memory/profile change propagation with typed event envelopes and optional per-subject filtering.
Real-time Events
Subscribe to real-time memory events using Server-Sent Events (SSE). Get instant notifications when memories are created, updated, superseded, or when profile fields change.
GET
/api/v1/events/memoriesSubscribe to real-time memory events via Server-Sent Events (SSE). The connection stays open and streams events as they occur.
Scope:
memories:read or events:readsubject_idstring
Optional. Filter events to a specific subject. If omitted, receives all events for the project.
Request
bash
curl -N "https://www.mnexium.com/api/v1/events/memories?subject_id=user_123" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Accept: text/event-stream"Event Types
connected - Initial connection confirmationmemory.created - A new memory was createdmemory.updated - A memory was updatedmemory.deleted - A memory was deletedmemory.superseded - A memory was superseded by a newer oneprofile.updated - Profile fields were updatedheartbeat - Keepalive signal (every 30s)Example Events
event: connected
data: {"project_id":"proj_abc","subject_id":"user_123","timestamp":"2024-12-15T10:30:00Z"}
event: memory.created
data: {"id":"mem_xyz","subject_id":"user_123","text":"User prefers dark mode","kind":"preference","importance":75}
event: memory.superseded
data: {"id":"mem_old123","superseded_by":"mem_xyz"}
event: profile.updated
data: {"subject_id":"user_123","fields":{"name":"John","timezone":"America/New_York"},"updated_at":"2024-12-15T10:31:00Z"}
event: heartbeat
data: {"timestamp":"2024-12-15T10:31:30Z"}Usage Example
bash
# SSE stream stays open — events arrive in real time
curl -N "https://www.mnexium.com/api/v1/events/memories?subject_id=user_123" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Accept: text/event-stream"Recommendation: Use SSE instead of polling for real-time updates. Events are delivered immediately when memories change and reduce unnecessary API traffic.