Skip to content

List Events

GET/v1/sessions/{session_id}/events

List the persisted event history of a session, in chronological order (oldest first).

Path Parameters

ParameterTypeRequiredDescription
session_idstringThe session ID (sess_...)

Request Examples

python
from anthropic import Anthropic

client = Anthropic(
    api_key="sk-sb-YOUR_KEY",
    base_url="https://api.sandbase.ai"
)

page = client.beta.sessions.events.list(session_id="sess_01abc...")
for event in page.data:
    print(f"{event.type}: {event.id}")
bash
curl "https://api.sandbase.ai/v1/sessions/sess_01abc.../events" \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Response

Each event shares a common envelope. Fields not relevant to a given event type are null or zero.

json
{
  "data": [
    {
      "id": "sevt_01abc...",
      "type": "user.message",
      "content": [{ "type": "text", "text": "Where is my order #1234?" }],
      "stop_reason": null,
      "model_used": null,
      "tokens_in": 0,
      "tokens_out": 0,
      "duration_ms": null,
      "processed_at": "2026-05-29T10:00:00Z",
      "created_at": "2026-05-29T10:00:00Z"
    },
    {
      "id": "sevt_02def...",
      "type": "agent.message",
      "content": [{ "type": "text", "text": "Let me look up order #1234 for you." }],
      "stop_reason": null,
      "model_used": "claude-sonnet-4",
      "tokens_in": 1200,
      "tokens_out": 80,
      "duration_ms": 1840,
      "processed_at": "2026-05-29T10:00:02Z",
      "created_at": "2026-05-29T10:00:02Z"
    }
  ]
}

Event Envelope

FieldTypeDescription
idstringEvent ID (sevt_...)
typestringEvent type (see below)
contentarray | object | nullType-specific payload (e.g. message content blocks)
stop_reasonobject | nullPresent on session.status_idle
model_usedstring | nullModel that produced the event, when applicable
tokens_inintegerInput tokens for this event (0 when N/A)
tokens_outintegerOutput tokens for this event (0 when N/A)
duration_msinteger | nullProcessing time, when applicable
processed_atstring | nullRFC 3339 timestamp when processed
created_atstringRFC 3339 timestamp

Event Types

Supported today

User events

TypeDescription
user.messageA user message
user.interruptInterrupt that pauses the agent

Agent events

TypeDescription
agent.messageAgent's text response
agent.tool_useAgent invokes a built-in tool
agent.tool_resultResult of a built-in tool execution
agent.mcp_tool_useAgent invokes an MCP tool
agent.custom_tool_useAgent calls a custom tool

Session status events

TypeDescription
session.status_runningSession is actively running
session.status_idleAgent paused, awaiting input (carries stop_reason)
session.errorAn error occurred during execution

Stop Reasons (session.status_idle)

stop_reason.typeMeaning
end_turnAgent completed its turn naturally, ready for the next message
requires_actionAgent is blocked on user input
user_interruptThe turn was interrupted by the user

Roadmap

The following event types and fields exist in the Claude API and are reserved for compatibility, but are not yet emitted by SandBase:

  • user.tool_confirmation, user.custom_tool_result (tool permission + custom tool flows)
  • agent.thinking, agent.tool_result enrichments, agent.mcp_tool_result
  • session.status_rescheduled, session.status_terminated, session.updated, session.deleted
  • Multiagent / outcome events: session.thread_*, agent.thread_*, user.define_outcome, span.*
  • Cursor pagination (limit, order, page, next_page) and the types / created_at_* filters

Clients should ignore unrecognized event types and tolerate missing fields.

Errors

StatusTypeDescription
401authentication_errorInvalid or missing API key
404not_foundSession not found