Skip to content

SSE Events

KinBot uses Server-Sent Events (SSE) to push real-time updates to the web UI. Connect to the SSE endpoint to receive live notifications about changes.

GET /api/sse

Requires authentication. Returns a text/event-stream response.

  1. Connected — Server sends a connected event with a connectionId
  2. Ping — Server sends ping events every 15 seconds to keep the connection alive
  3. Events — Real-time events are delivered as message events with JSON data
  4. Disconnect — Client closes the connection; server cleans up automatically

Each event is a JSON object with a type field and contextual fields:

{
"type": "event-type",
"kinId": "optional-kin-id",
"data": { ... }
}

Real-time message streaming and conversation events.

EventDescriptionScope
chat:messageNew message created (user or AI)Per-Kin
chat:tokenStreaming token chunk during AI responsePer-Kin
chat:tool-call-startTool call startedPer-Kin
chat:tool-callTool call completedPer-Kin
chat:tool-resultTool result receivedPer-Kin
chat:doneAI response finishedPer-Kin
chat:clearedConversation history clearedPer-Kin
EventDescriptionScope
reaction:addedReaction added to a messagePer-Kin
reaction:removedReaction removed from a messagePer-Kin
EventDescriptionScope
task:statusTask status changed (pending, in_progress, queued, etc.)Broadcast
task:doneTask completed or failedBroadcast
task:deletedTask deletedBroadcast
queue:updateConcurrency queue state changed (task promoted, new task queued)Broadcast
EventDescriptionScope
miniapp:createdA mini-app was createdBroadcast
miniapp:updatedA mini-app was updatedBroadcast
miniapp:deletedA mini-app was deletedBroadcast
miniapp:file-updatedA mini-app file was changedBroadcast
EventDescriptionScope
memory:createdMemory createdPer-Kin
memory:updatedMemory updatedPer-Kin
memory:deletedMemory deletedPer-Kin
EventDescriptionScope
compacting:startCompaction startedPer-Kin
compacting:doneCompaction completed (includes summary and memories extracted)Per-Kin
compacting:errorCompaction failed (prevents infinite spinner in the UI)Per-Kin
EventDescriptionScope
kin:errorKin processing errorPer-Kin
kin:createdNew Kin createdBroadcast
kin:updatedKin metadata changed (avatar, provider, etc.)Broadcast
kin:deletedKin deletedBroadcast
EventDescriptionScope
provider:createdProvider addedBroadcast
provider:updatedProvider configuration changedBroadcast
provider:deletedProvider removedBroadcast
EventDescriptionScope
mcp-server:createdMCP server addedBroadcast
mcp-server:updatedMCP server config changed or approvedBroadcast
mcp-server:deletedMCP server removedBroadcast
EventDescriptionScope
contact:createdContact createdBroadcast
contact:updatedContact updatedBroadcast
contact:deletedContact deletedBroadcast
EventDescriptionScope
cron:triggeredCron job triggeredBroadcast
cron:createdCron job createdBroadcast
cron:updatedCron job updatedBroadcast
cron:deletedCron job deletedBroadcast
EventDescriptionScope
webhook:createdWebhook createdBroadcast
webhook:updatedWebhook updatedBroadcast
webhook:deletedWebhook deletedBroadcast
webhook:triggeredWebhook received a payloadPer-Kin
EventDescriptionScope
channel:createdChannel createdBroadcast
channel:updatedChannel updatedBroadcast
channel:deletedChannel deletedBroadcast
channel:message-receivedMessage received from external platformPer-Kin
channel:message-sentMessage sent to external platformPer-Kin
channel:user-pendingNew user pending approvalBroadcast
channel:user-approvedUser approvedBroadcast
EventDescriptionScope
prompt:pendingNew prompt awaiting human responsePer-Kin
prompt:answeredHuman responded to a promptPer-Kin
EventDescriptionScope
notification:newNew notificationPer-User
notification:readNotification marked as readPer-User
notification:read-allAll notifications marked as readPer-User
EventDescriptionScope
quick-session:closedQuick session closedPer-Kin
EventDescriptionScope
knowledge:source-createdKnowledge source addedPer-Kin
knowledge:source-updatedKnowledge source updatedPer-Kin
knowledge:source-deletedKnowledge source deletedPer-Kin
EventDescriptionScope
plugin:installedPlugin installedBroadcast
plugin:uninstalledPlugin uninstalledBroadcast
plugin:enabledPlugin enabledBroadcast
plugin:disabledPlugin disabledBroadcast
plugin:configUpdatedPlugin config changedBroadcast
plugin:autoDisabledPlugin auto-disabled due to errorsBroadcast
EventDescriptionScope
settings:hub-changedHub configuration changedBroadcast
settings:compacting-threshold-changedCompacting threshold changedBroadcast
EventDescriptionScope
version:update-availableNew KinBot version availableBroadcast
EventDescriptionScope
log:entryPlatform log entryBroadcast

Events are delivered based on scope:

  • Broadcast — Sent to all connected clients (provider changes, MCP updates, settings)
  • Per-Kin — Sent to clients viewing a specific Kin (chat, memories, compacting, reactions)
  • Per-User — Sent to a specific user’s connections (notifications)
const evtSource = new EventSource('/api/sse', {
withCredentials: true
})
evtSource.onmessage = (event) => {
const data = JSON.parse(event.data)
switch (data.type) {
case 'chat:token':
// Append streaming token to UI
appendToken(data.data.token)
break
case 'chat:done':
// Finalize message display
finalizeMessage()
break
case 'miniapp:updated':
// Refresh mini-app data
refreshMiniApp(data.data.app)
break
}
}
evtSource.onerror = () => {
// EventSource auto-reconnects
console.log('SSE connection lost, reconnecting...')
}