History
Every dated value recorded for one subject, attribute by attribute, each with the day it held from and the turns it was read from.
POST /v1/memory/historyWhen a conversation is read in the background, statements of state become assertions: a subject, an attribute, a value and the day it held from. History returns every assertion for one subject. Nothing is overwritten, so an old value and the new one both appear. Makes no model call. See Values and history.
History is empty until the end user's items have been read.
Headers
AuthorizationstringBearer tm_…. A read key is enough.
X-Twin-AccountstringThe end user whose memory to read. See End users.
X-Request-IdstringYour id for this request, echoed on the response.
Body
subjectstringWho or what, by the name memory files it under, such as Alice Chen. Case and spacing do not matter. 1 to
512 characters. A name that misses returns the nearest recorded subjects.
attributestringOnly this attribute, such as home_city. Matched exactly.
Response
subjectstringThe subject as sent.
countintegerHow many assertions came back.
assertionsobject[]Sorted by attribute, then by valid_from, oldest first. Each has subject, attribute, value,
valid_from (the day it held from), polarity (1, or -1 when the statement says the value is not,
never was, or stopped being true) and source_turn_ids, the event ids it was read from.
errorstringnothing recorded, when the subject has no assertions.
subjectsstring[]With error: up to 10 recorded subjects nearest the name sent.
recordedintegerWith error: how many subjects this memory has assertions for.
Errors
400bad requestX-Twin-Account is missing or not a usable id.
401unauthorizedThe bearer is not a key this service issued.
404not foundno memory for end user 'user_42' yet.
422invalidAn empty subject.
503unavailableAt capacity, or this end user is being rebuilt. Retry after Retry-After seconds.
curl https://api.twinmemory.dev/v1/memory/history \
-H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
-H "X-Twin-Account: user_42" \
-H "Content-Type: application/json" \
-d '{ "subject": "Alice Chen" }'{
"subject": "Alice Chen",
"count": 3,
"assertions": [
{
"subject": "alice chen",
"attribute": "employer",
"value": "Acme",
"valid_from": "2026-10-01",
"polarity": 1,
"source_turn_ids": ["ev_620270db0bff9328"]
},
{
"subject": "alice chen",
"attribute": "home_city",
"value": "Berlin",
"valid_from": "2024-03-01",
"polarity": 1,
"source_turn_ids": ["ev_c2cef398cd2bc8ac"]
},
{
"subject": "alice chen",
"attribute": "home_city",
"value": "Lisbon",
"valid_from": "2026-10-01",
"polarity": 1,
"source_turn_ids": ["ev_620270db0bff9328"]
}
]
}{
"subject": "Alice",
"error": "nothing recorded",
"subjects": ["alice-chen"],
"recorded": 1
}