Latest
The most recent passages, newest first, or every passage between two dates. Ordered by time, never ranked.
POST /v1/memory/latestRecency is not a similarity: a search for "the latest message" scores those words against the text. Latest
orders by time instead. With no dates it returns the newest few passages; with after or before it
returns what happened in that window. Makes no model call.
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
kintegerHow many passages. 1 to 50, default 10.
placestringEither segment of a passage path under passages/, such as memory or notes. Default "", everywhere.
Up to 512 characters.
afterdateOnly passages from this day on, as YYYY-MM-DD or a full ISO time.
beforedateOnly passages from before this day.
Response
placestringThe place as sent, or a sentence saying the whole memory was searched.
windowstringThe dates applied, such as the beginning to now.
foundintegerHow many passages came back.
passagesobject[]Newest first, each with path, id, thread and text (up to 1,400 characters). Each also carries content: "stored" and roles, who spoke in it (user, assistant), so you can quote it
as data; see Using memory with an LLM.
placesstring[]When a place matched nothing: the places this memory holds, so the next call can name one.
whystringWith places: why the list is empty.
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.
422invalidA k outside 1 to 50, or a date that is not a real day.
503unavailableAt capacity, or this end user is being rebuilt. Retry after Retry-After seconds.
curl https://api.twinmemory.dev/v1/memory/latest \
-H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
-H "X-Twin-Account: user_42" \
-H "Content-Type: application/json" \
-d '{ "k": 2 }'{
"place": "everywhere, except this twin's own Claude Code sessions",
"window": "the beginning to now",
"found": 2,
"passages": [
{
"path": "passages/memory/documents/th_a4c4bfb9e995f6bc/p_0001.md",
"id": "th_a4c4bfb9e995f6bc/p_0001",
"thread": "th_a4c4bfb9e995f6bc",
"text": "Context: documents (memory), 3 Oct 2026. Porto trip plan.\n\nDay 1: train from Lisbon to Porto at 08:00. …"
},
{
"path": "passages/memory/notes/th_1c3a2421d280764f/p_0001.md",
"id": "th_1c3a2421d280764f/p_0001",
"thread": "th_1c3a2421d280764f",
"text": "Context: notes (memory), 2 Oct 2026. …\n\nAlice is vegan and allergic to peanuts."
}
]
}{
"place": "slack",
"window": "the beginning to now",
"found": 0,
"passages": [],
"places": ["memory/documents", "memory/messages", "memory/notes"],
"why": "nothing under 'slack'. `places` lists what this store actually holds."
}