Versions
Every version of one added item, oldest first, and when and why it went. Behind the write key, because it holds what was edited away.
POST /v1/memory/versionsAdding an item again with the same id and other words, title, author, about, metadata or expiry is an
edit. Reuse an id only to fix the same statement; when something changes, add a new item. Search only shows the newest copy. Versions keeps each copy memory took, whole, until the item goes. A
retry of the same item is not a new version. Makes no model call. See Versions and edits.
When the item is forgotten or expires, every version is erased with it. One line stays: when it went and why,
with no word of what it said. Adding the same id again after that starts its versions again, after that
line.
Headers
AuthorizationstringBearer tm_…. The key must read and write: a read key is refused, because versions hold text the end user
has since changed.
X-Twin-AccountstringThe end user the item was added for. See End users.
X-Request-IdstringYour id for this request, echoed on the response.
Body
idstringThe item's id, as you gave it to add. 1 to 512 characters.
Response
idstringstatestringlive, expired, forgotten, or unknown for an id memory never took.
historyobject[]Oldest first. A version is {event: "version", at, version, item}: when memory took it, its number, and the
item as it was held (id, kind, text, title, at, author, session, about, metadata,
expires, each where set). role is not shown. A tombstone is
{event: "gone", at, why}, where why is forgotten or expired.
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.
422invalidAn empty id.
503unavailableAt capacity, or this end user is being rebuilt. Retry after Retry-After seconds.
curl https://api.twinmemory.dev/v1/memory/versions \
-H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
-H "X-Twin-Account: user_42" \
-H "Content-Type: application/json" \
-d '{ "id": "pref-diet" }'{
"id": "pref-diet",
"state": "live",
"history": [
{
"event": "version",
"at": "2026-10-21T10:23:40.598077+00:00",
"version": 1,
"item": {
"id": "pref-diet",
"kind": "note",
"text": "Alice is vegetarian and allergic to peanuts.",
"at": "2026-10-02T12:00:00+00:00",
"metadata": { "source": "crm" }
}
},
{
"event": "version",
"at": "2026-10-21T10:23:40.600223+00:00",
"version": 2,
"item": {
"id": "pref-diet",
"kind": "note",
"text": "Alice is vegan and allergic to peanuts.",
"at": "2026-10-02T12:00:00+00:00",
"metadata": { "source": "crm" }
}
}
]
}{
"id": "pref-diet",
"state": "forgotten",
"history": [{ "event": "gone", "at": "2026-10-21T10:23:40.619860+00:00", "why": "forgotten" }]
}{ "id": "nope", "state": "unknown", "history": [] }