Around
The passages either side of one passage you already hold, in its own thread. Addressed, never ranked.
POST /v1/memory/aroundA passage is a piece of one thread: a day of a session, a document, a note. When a hit is the middle of a conversation, around returns what came before and after it, in order. 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
passage_idstringA passage id from a search, grep or latest result, such as th_8b5e5d4c8946d815/p_0001. 1 to 512
characters.
widthintegerHow many passages on each side. 1 to 5, default 2.
Response
ofstringThe passage id as sent.
passagesobject[]The passage and its neighbours in thread order, each with path, id, thread and text (up to 1,400
characters). A thread with one passage returns that passage alone. 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.
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 passage_id, or a width outside 1 to 5.
503unavailableAt capacity, or this end user is being rebuilt. Retry after Retry-After seconds.
curl https://api.twinmemory.dev/v1/memory/around \
-H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
-H "X-Twin-Account: user_42" \
-H "Content-Type: application/json" \
-d '{ "passage_id": "th_1c3a2421d280764f/p_0001", "width": 1 }'{
"of": "th_1c3a2421d280764f/p_0001",
"passages": [
{
"path": "passages/memory/notes/th_1c3a2421d280764f/p_0001.md",
"id": "th_1c3a2421d280764f/p_0001",
"thread": "th_1c3a2421d280764f",
"text": "Context: notes (memory), 2 Oct 2026. Alice is vegan and allergic to peanuts..\n\nAlice is vegan and allergic to peanuts."
}
]
}