---
title: "Server-Sent Events endpoint for real-time container events"
method: GET
path: "/v1/events"
tags: ["events"]
---

# Server-Sent Events endpoint for real-time container events

`GET /v1/events`

Streams real-time events in Server-Sent Events format. Events include port changes, git status, processes, and container status updates.

## Event Types

### Port Events
- **port:opened**: Fired when a new port is detected
- `port` (int): Port number
- `service` (string): Service type (http, tcp)
- `protocol` (string): Protocol used
- `title` (string): Service title/name if detected
- **port:closed**: Fired when a port is no longer available
- `port` (int): Port number that was closed

### Git Events
- **git:dirty**: Fired when git workspace has uncommitted changes
- `workspace` (string): Workspace path
- `files` ([]string): List of modified files
- **git:clean**: Fired when git workspace becomes clean
- `workspace` (string): Workspace path

### Process Events
- **process:started**: Fired when a new process starts
- `pid` (int): Process ID
- `command` (string): Command that was executed
- `workspace` (string): Workspace where process started
- **process:stopped**: Fired when a process terminates
- `pid` (int): Process ID that stopped
- `exitCode` (int): Exit code of the process

### Container Events
- **container:status**: Fired when container status changes
- `status` (string): Container status (running, stopped, error)
- `message` (string): Optional status message

### System Events
- **heartbeat**: Sent every 5 seconds to keep connection alive
- `timestamp` (int64): Current timestamp in milliseconds
- `uptime` (int64): Server uptime in milliseconds

## Message Format
Each SSE message is a JSON object with:
- `event`: Event object containing `type` and `payload`
- `timestamp`: Event timestamp in milliseconds
- `id`: Unique event identifier

## Connection Behavior
- Auto-reconnects on disconnection
- Sends current state on initial connection
- Heartbeat every 5 seconds
- Rate limited to prevent spam

## Response `200`

SSE stream of events

---

[API](https://skmtc.net/wandb/apis/catnip-container-api.md) · [All operations](https://skmtc.net/wandb/apis/catnip-container-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/wandb/catnip-container-api/revisions/a075b0fa501a/schema)
