vim, full-screen CLI apps) behave correctly.
Sessions persist across WebSocket disconnections. If your connection drops, the process keeps running inside the capsule and you can reconnect using the session tag.
Endpoint
Upgrade: websocket headers.
Authentication
string
required
Your team’s API key.
Path parameters
string
required
The capsule ID.
WebSocket protocol
Client messages — starting a session
Send this as the first message to start a new PTY session:Client messages — reconnecting
To reconnect to an existing PTY session, send the tag you received in thestarted server message:
Client messages — during a session
Once the session is established (after receivingstarted from the server), you can send:
Input — keystrokes or pasted text, base64-encoded:
Server messages
All PTY data — both input you send and output you receive — is base64-encoded. Raw terminal bytes include ANSI escape sequences and control codes that are not valid UTF-8. Decode the
data field before passing it to your terminal renderer.PTY sessions survive WebSocket disconnections. The process keeps running in the capsule. Save the
tag from the started message and use {"type": "connect", "tag": "..."} to rejoin a session after a disconnect.