Overview
Sessions track which memories are accessed together during a conversation or task. This co-activation data powers Trix's learning system, helping it understand which memories are contextually related and should be retrieved together.
Automatic Tracking: Sessions are created and updated automatically when you use the search and recall APIs. You typically don't need to manage them directly.
List Sessions
GET /sessions — List activation sessions
Returns a paginated list of activation sessions, showing which memories were accessed together.
Query Parameters
| Name | Type | Description |
|---|---|---|
limit | integer | Maximum number of sessions to return. Default: 20, Max: 100. |
offset | integer | Number of sessions to skip for pagination. Default: 0. |
is_closed | boolean | Filter by session status. true for closed sessions, false for active. |
since | string | ISO 8601 lower bound on started_at. |
sort | string | Sort field: started_at (default) or last_activity_at. |
order | string | asc or desc (default). |
Response (200)
Returns { data: [...], pagination: { total, limit, offset, has_more } }.
curl -X GET "https://api.trixdb.com/v1/sessions?limit=10" \
-H "Authorization: Bearer $TRIX_API_KEY"{
"data": [
{
"id": "<uuid>",
"session_key": "conversation_12345",
"started_at": "2026-04-10T10:30:00Z",
"last_activity_at": "2026-04-10T10:45:00Z",
"memory_count": 3,
"is_closed": false
}
],
"pagination": {
"total": 42,
"limit": 10,
"offset": 0,
"has_more": true
}
}Get Active Sessions
GET /sessions/active — Get currently active sessions
Returns all sessions that are still open (not yet closed). Useful for monitoring ongoing conversations.
Query Parameters
| Name | Type | Description |
|---|---|---|
limit | integer | Maximum number of sessions to return. Default: 20, Max: 100. |
Response (200)
Returns { data: [...], pagination: { total, limit, offset, has_more } } ordered by most recent activity.
{
"data": [
{
"id": "<uuid>",
"session_key": "agent_task_789",
"started_at": "2026-04-14T10:30:00Z",
"last_activity_at": "2026-04-14T10:55:00Z",
"memory_count": 2,
"is_closed": false
}
],
"pagination": {
"total": 1,
"limit": 20,
"offset": 0,
"has_more": false
}
}Get Session
GET /sessions/:id — Get session details
Retrieves detailed information about a specific activation session.
Path Parameters
| Name | Type | Description |
|---|---|---|
id | string (required) | The session UUID. |
Response (200)
Returns the session object with full details (including the memory_ids array).
{
"id": "<uuid>",
"session_key": "conversation_12345",
"started_at": "2026-04-10T10:30:00Z",
"last_activity_at": "2026-04-10T10:45:00Z",
"memory_ids": ["<uuid>", "<uuid>", "<uuid>"],
"is_closed": true,
"api_key_id": "<uuid>"
}Get Session Memories
GET /sessions/:id/memories — Get memories from a session
Returns the full memory objects that were accessed during a session, ordered by access time.
Path Parameters
| Name | Type | Description |
|---|---|---|
id | string (required) | The session UUID. |
Query Parameters
| Name | Type | Description |
|---|---|---|
limit | integer | Maximum memories to return. Default: 20, Max: 100. |
offset | integer | Number of memories to skip. Default: 0. |
Response (200)
Returns { data: [...], pagination: { total, limit, offset, has_more } }.
{
"data": [
{
"id": "<uuid>",
"content": "User prefers dark mode and compact layouts",
"content_type": "text",
"tags": [],
"created_at": "2026-04-04T09:00:00Z"
},
{
"id": "<uuid>",
"content": "Project uses React with TypeScript",
"content_type": "text",
"tags": [],
"created_at": "2026-04-06T14:00:00Z"
}
],
"pagination": {
"total": 2,
"limit": 20,
"offset": 0,
"has_more": false
}
}Export & Report
GET /sessions/:id/export — Export session data
Exports session metadata, memories, and relationships in Markdown, JSON, CSV or HTML.
Query Parameters
| Name | Type | Description |
|---|---|---|
format | string | One of markdown (default), json, csv, html. |
GET /sessions/:id/report — Get a session report
Returns a structured report summarising the session's memories and optional relationships.
Query Parameters
| Name | Type | Description |
|---|---|---|
include_relationships | boolean | Include relationships in the report. Default: true. |
Session Object
The session object contains the following fields:
| Field | Type | Description |
|---|---|---|
id | string | UUID identifier for the session. |
session_key | string | Optional custom identifier provided when creating the session. |
started_at | string | ISO 8601 timestamp of when the session started. |
last_activity_at | string | ISO 8601 timestamp of the last memory access in this session. |
memory_ids | string[] | Array of memory IDs that were accessed during this session. |
is_closed | boolean | Whether the session has ended. Closed sessions are no longer updated. |
api_key_id | string | null | The API key used to create this session, if applicable. |
How Sessions Work
Automatic Session Management
Sessions are managed automatically by the Trix API:
- A new session starts when you make a search or recall request with a
sessionparameter - Each memory returned in the search results is added to the session
- Sessions close automatically after a period of inactivity (default: 30 minutes)
- Co-accessed memories strengthen their relationships over time
Using Sessions in Your App
Pass a consistent session identifier to track memory access patterns:
// Each conversation gets a unique session
const sessionId = `conversation_${conversationId}`;
// All searches in this conversation share the session
const memories = await trix.search("user preferences", {
session: sessionId
});Best Practice: Use meaningful session keys like user_123_chat_456 or agent_task_789 to easily identify sessions later.
Use Cases
Conversation Memory
Track which memories are accessed together in a conversation to improve future recall:
- Memories frequently accessed together get higher co-activation scores
- Future searches prioritize memories that commonly appear together
Agent Task Learning
Track memory patterns during agent tasks to learn successful strategies:
- Identify which knowledge combinations lead to successful task completion
- Replay sessions to understand agent decision-making
Analytics
Analyze session data to understand memory usage patterns:
- Which memories are most frequently accessed together
- Average session duration and memory count
- Identify underutilized or orphaned memories