> ## Documentation Index
> Fetch the complete documentation index at: https://docs.protodesk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Realtime events

> Listen to workspace updates with a server-sent event stream.

The `GET /realtime/events` endpoint exposes a workspace event stream using server-sent events (SSE). Your key needs `realtime:read`.

## Open a stream

```bash theme={null}
curl --no-buffer --fail-with-body 'https://api.protodesk.io/v1/realtime/events' \
  -H "Authorization: Bearer $PROTODESK_API_KEY" \
  -H 'Accept: text/event-stream'
```

Events use SSE `id`, `event`, and `data` fields. Parse complete events before processing them. A new connection without a cursor listens for live events.

## Reconnect and resume

Save the last successfully processed event ID. On reconnection, send it as `Last-Event-ID`, or use the endpoint's `cursor` query parameter.

```bash theme={null}
curl --no-buffer --fail-with-body 'https://api.protodesk.io/v1/realtime/events' \
  -H "Authorization: Bearer $PROTODESK_API_KEY" \
  -H 'Accept: text/event-stream' \
  -H "Last-Event-ID: $LAST_EVENT_ID"
```

Expect heartbeats and periodic disconnections. Reconnect with backoff, deduplicate event IDs, and handle stream errors. Consult the [endpoint reference](/api-reference/realtime/streamEvents) for cursor behavior and response details.

## Connect through your server

Do not put a workspace API key into browser JavaScript or a URL. Keep this stream on your server and forward only the events an authenticated application user is authorized to see.

For background integrations that do not need a persistent connection, use [webhooks](/guides/webhooks).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.