Core memory operations
Update a memory
Replace a memory's content. Korely re-runs fact extraction on the new text, changed values supersede prior facts, unchanged facts dedupe, so your typed knowledge stays in sync.
PATCH
/v1/memories/{memory_id}
SDK: korely.update(memory_id, content=...). The update path
re-runs the intelligence, embeddings and typed-fact extraction with
bi-temporal contradiction checking, on the new content. Changed values
supersede prior facts; unchanged facts are deduped. You never write supersede
logic.
Authentication
HTTP header, required: Authorization: Bearer kor_live_....
Path parameter
| Parameter | Type | Required | Description |
|---|---|---|---|
memory_id | string | Required | The public memory id (mem_) to update. A malformed id returns 404. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
content | string | Required | New content. 1-16,000 characters. Stripped and rejected if blank or whitespace-only (422). |
expected_updated_at | string | Optional | Optimistic concurrency token. If set and it doesn't match the record's current updated_at (or created_at) within a 1-second tolerance, the write is rejected with 409 stale_write. Defaults to null (no concurrency check). |
Example request
curl -X PATCH https://api.korely.ai/v1/memories/mem_8f2c1a \ -H "Authorization: Bearer kor_live_..." \ -H "Content-Type: application/json" \ -d '{ "content": "Giulia now prefers in-person standups.", "expected_updated_at": "2026-03-01T09:14:22+00:00" }'Response
200 OK. The updated memory, plus the typed facts freshly
re-extracted from the new content.
{ "id": "mem_8f2c1a", "content": "Giulia now prefers in-person standups.", "user_id": "customer-giulia-4812", "agent_id": "onboarding-bot", "run_id": null, "metadata": {"source": "slack"}, "created_at": "2026-03-01T09:14:22+00:00", "updated_at": "2026-03-02T11:02:10+00:00", "facts": [ { "id": "fct_b2", "subject": "Giulia", "subject_type": "person", "predicate": "prefers", "predicate_raw": "prefers", "object": "in-person standups", "object_is_literal": true, "predicate_family": "preference", "confidence": 0.88, "user_id": "customer-giulia-4812", "agent_id": "onboarding-bot", "valid_from": "2026-03-02T11:02:10+00:00", "invalid_at": null, "invalidated_by": null, "source_memory_id": "mem_8f2c1a", "created_at": "2026-03-02T11:02:11+00:00" } ]}| Field | Type | Description |
|---|---|---|
id | string | The public memory id (mem_). |
content | string | The updated content, echoed back. |
user_id | string · null | The end user this memory belongs to (null if not scoped). |
agent_id | string · null | The agent namespace (null if not scoped). |
run_id | string · null | The run namespace (null if not scoped). |
metadata | object | The metadata dict stored with the memory. |
created_at | string · null | ISO 8601 timestamp. |
updated_at | string · null | ISO 8601 timestamp. |
facts | array | Typed (subject, predicate, object) facts freshly re-extracted from the new content. Changed values supersede prior facts via the contradiction pipeline; unchanged facts are deduped. |
Errors
| Status | Code | Cause |
|---|---|---|
401 | invalid_key | Missing or invalid kor_live_ key, Invalid or missing API key. |
403 | forbidden | Key lacks the memories:write scope, API key missing required scope(s): memories:write. |
404 | not_found | Malformed memory_id, or the memory doesn't exist (including when checked against expected_updated_at), Memory not found. |
409 | stale_write | expected_updated_at was provided but doesn't match the current record, expected_updated_at does not match the current record. |
422 | invalid_request | content is empty or whitespace-only, or its length is outside 1-16,000 characters. |
429 | rate_limit_exceeded | Rate limit exceeded, returned with a Retry-After header. |
Notes
- It's a write. Update requires the
memories:writescope and does not meter the read query quota. - Facts stay in sync. The PATCH re-runs fact extraction on the new content, changed values supersede prior facts (their
invalid_atis set), and unchanged facts are deduped. - Optimistic concurrency. The
expected_updated_attolerance is 1 second. A missing or unparseable current timestamp is treated as stale, so the safe write is rejected rather than allowed to clobber. - No webhook. Updates do not emit a webhook event.
Related
- Update a memory, guide, the narrative walkthrough with context.
- Add a memory, store a new memory.
- Get facts, read back the re-extracted typed facts.