Stream real-time logs and metrics (SSE)
Open a Server-Sent Events stream with GET /v2/apps//realtime for live logs, metrics, status and deploy progress. A connection lasts up to 10 minutes.
Stream real-time logs and metrics (SSE)
The API Playground is disabled for this endpoint due to the nature of SSE connections, which are not universally supported by browsers.
string
required
The API key for your account. You can find this in your account settings.
apps:read scope.
Use this endpoint whenever you need a live view of an application instead of polling: watching a deploy progress, tailing logs as they are written, or driving a dashboard’s CPU/RAM graph without hammering Get Application Status or Get Application Logs on a timer. It replaces both for the duration of the connection.
Internally, opening a connection here dials a single upstream stream on the application’s cluster and relays it back over SSE, with one transparent internal reconnect if that upstream drops. Because each open connection holds a socket for up to 10 minutes, opens are rate limited separately from the concurrent-connection caps described below: 1 open every 5 seconds per (user, application), and 20 opens every 10 seconds per user across all applications, with a short cooldown after that.
Parameters
string
required
The ID of the application whose logs you want to monitor. This ID can be found in the URL of your application’s management panel.
Response
string
Indicates whether the call was successful:
success if it was, error if not.code field along with the error status, detailing the cause.
If the request is successful, the response will be a text/event-stream stream containing the application’s realtime feed.
Each connection lasts up to 10 minutes. Each account may hold 5 concurrent realtime connections (REALTIME_MAX_CONNECTIONS) and each application 30 across all users (REALTIME_MAX_CONNECTIONS_APP); exceeding either returns 429.
Server-Sent Events (SSE) Structure
The response is a continuous stream intext/event-stream format. Each message is composed of an event field and a data field. Shapes vary by event, so parse payloads defensively.
Event Types
system: Protocol-level signals. Thedataline is a single uppercase code:REALTIME_CONNECTING | <sseId>on connect, then any ofREALTIME_TIMEOUT,REALTIME_DISCONNECTED,REALTIME_RECONNECT, orREALTIME_ERROR.logs: A single log line whose first character is a stream-id byte:\x01(stdout) or\x02(stderr). Readdata.charCodeAt(0)(1 = stdout, 2 = stderr), thendata.slice(1)for the text. A line without that prefix byte is stdout.status: Live container metrics as a JSON string, about one frame per second. The first frame of each (re)connection is complete:{ cpu, cpuLimit, ram: [usedMB, limitMB], status, netIO: { i, o, new: { i, o } }, bIO: { i, o }, uptime }(cpuLimitis the number of CPU cores allocated;uptimeis the start time as epoch ms;netIO.newis bytes per second). Every later frame is lean, carrying only{ cpu, ram, netIO, bIO }: merge each onto the last complete frame, keeping the previouscpuLimit,status, anduptime. While this stream is open, prefer it over pollingGET /v2/apps/{app_id}/status, which can be up to about a minute stale for an app with an open realtime stream.error: Carries an error code such asCONTAINER_NOT_FOUND.
\x01 / \x02 stand for the raw stdout / stderr prefix bytes.
Common errors
Related
- CLI:
squarecloud app realtime - SDKs:
api.apps.realtime()(JavaScript),client.apps.realtime()(Python),c.Apps.Realtime()(Go)

