Skip to content

Sessions

List Sessions

GET /api/sessions

bash
curl http://localhost:3000/api/sessions?limit=20 \
  -H "X-API-Key: your-key"

Query Parameters

ParameterTypeDefaultDescription
limitinteger20Maximum number of sessions to return

Response

json
[
  {
    "id": "abc123",
    "channel": "main",
    "channel_session_key": "550e8400-...",
    "title": "File listing and project overview",
    "message_count": 4,
    "created_at": "2026-03-14T10:00:00Z",
    "last_message_at": "2026-03-14T10:05:00Z",
    "is_closed": false,
    "is_read": true,
    "summary": null,
    "user_id": "user123"
  }
]

Get Session

GET /api/sessions/:id

bash
curl http://localhost:3000/api/sessions/abc123 \
  -H "X-API-Key: your-key"

Response

Returns a single session object (same shape as the list items above), or 404 if not found.

Get Session Messages

GET /api/sessions/:id/messages

bash
curl http://localhost:3000/api/sessions/abc123/messages \
  -H "X-API-Key: your-key"

Response

json
[
  {
    "id": 1,
    "session_id": "abc123",
    "role": "user",
    "content": "What files are in this directory?",
    "timestamp": "2026-03-14T10:00:00Z"
  },
  {
    "id": 2,
    "session_id": "abc123",
    "role": "assistant",
    "content": "The directory contains:\n- Cargo.toml\n- README.md",
    "timestamp": "2026-03-14T10:00:05Z"
  }
]

Mark Session Read/Unread

POST /api/sessions/:id/read

Mark a session as read or unread. Sessions created by cron jobs are automatically marked unread by the server.

bash
# Mark as read (default)
curl -X POST http://localhost:3000/api/sessions/abc123/read \
  -H "X-API-Key: your-key" \
  -H "Content-Type: application/json" \
  -d '{"is_read": true}'

# Mark as unread
curl -X POST http://localhost:3000/api/sessions/abc123/read \
  -H "X-API-Key: your-key" \
  -H "Content-Type: application/json" \
  -d '{"is_read": false}'

Request Body

FieldTypeDefaultDescription
is_readbooleantrueWhether the session is read

Response

json
{ "ok": true }

Message Roles

RoleDescription
userUser message
assistantAgent response
tool_useTool call (JSON-encoded name + input)
tool_resultTool result (JSON-encoded output)

Released under the MIT License.