Forget
Hard-delete items, sessions, threads or events from one end user's memory, with every copy and everything learned from them, and get a receipt.
POST /v1/memory/forgetForget erases what you name from the end user's memory: the ledger entries, the passages cut from them, their words in the index and their vectors, the facts and assertions read from them, every version, and every page that quoted them. A thread with nothing left goes whole. Copies still waiting to land are removed too. Makes no model call. See Erasure and receipts.
Each erased event id is kept as a tombstone, so a copy still on its way in cannot bring it back. Adding the same item again on purpose lifts the tombstone.
The cost is linear in this end user's history: the rest of their memory is rebuilt from what remains.
Headers
AuthorizationstringBearer tm_…. The key must read and write.
X-Twin-AccountstringThe end user to erase from. See End users.
X-Request-IdstringYour id for this request, echoed on the response.
Body
itemsstring[]Item ids as you gave them to add. Up to 500.
sessionsstring[]Sessions, every day of each. Up to 500.
threadsstring[]Thread ids (th_…), as results return them. Up to 500.
eventsstring[]Event ids (ev_…). Up to 500.
At least one list must name something. Any mix is allowed.
Response
eventsintegerHow many events were erased. 0 when nothing matched.
threads_emptiedintegerThreads with nothing left, removed whole.
ledgerintegerLedger entries deleted.
recordsintegerFacts deleted: those citing an erased event, or read from a window that held one.
assertionsintegerAssertion lines deleted.
correctionsintegerRetractions resting on an erased event, deleted.
actionsintegerAction lines deleted.
lessonsintegerLessons deleted.
unowned_vectorsintegerVectors no passage or fact owns any more, deleted.
log_emptiedbooleanWhether the database's write-ahead log was emptied after the delete.
tablesobjectRow counts for this end user, before and after, per table: events, threads, passages,
mentions, facts, vectors, codes, parties, withdrawals, passages_fts, facts_fts, files.
files can rise: the tombstone and the pages folded again are written.
inboxintegerItems accepted and not yet landed, removed before they landed.
versionsintegerItem versions erased.
queueinteger | nullCopies removed from the delivery queue. null when the queue could not be reached; the erasure from
memory stands either way, and you can send the same request again.
When nothing matched, the receipt is {"events": 0, "inbox": 0, "versions": 0, "queue": 0}.
Errors
400bad requestX-Twin-Account is missing or not a usable id.
401unauthorizedThe bearer is not a key this service issued.
403forbiddenthis key reads; writing takes a key that writes.
413too largebody over 1000000 bytes.
422invalidforget names nothing: give events, threads, items or sessions, or a list over 500.
503unavailableAt capacity, or this end user is being rebuilt. Retry after Retry-After seconds.
curl https://api.twinmemory.dev/v1/memory/forget \
-H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
-H "X-Twin-Account: user_42" \
-H "Content-Type: application/json" \
-d '{ "items": ["pref-diet"] }'{
"events": 1,
"threads_emptied": 1,
"lessons": 0,
"ledger": 1,
"records": 0,
"corrections": 0,
"actions": 0,
"assertions": 0,
"unowned_vectors": 0,
"log_emptied": true,
"tables": {
"events": { "before": 4, "after": 3 },
"threads": { "before": 3, "after": 2 },
"passages": { "before": 3, "after": 2 },
"mentions": { "before": 13, "after": 11 },
"facts": { "before": 0, "after": 0 },
"vectors": { "before": 0, "after": 0 },
"codes": { "before": 0, "after": 0 },
"parties": { "before": 2, "after": 2 },
"withdrawals": { "before": 0, "after": 0 },
"passages_fts": { "before": 3, "after": 2 },
"facts_fts": { "before": 0, "after": 0 },
"files": { "before": 18, "after": 19 }
},
"inbox": 0,
"versions": 2,
"queue": 0
}