import requests
url = "https://api.13-215-85-171.sslip.io/v1/machines/{id}/ws"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.13-215-85-171.sslip.io/v1/machines/{id}/ws \
--header 'Authorization: Bearer <token>'{
"error": "<string>",
"code": "invalid_request",
"error_detail": {
"code": "unauthorized",
"message": "<string>",
"phase": "auth",
"retryable": true,
"suggested_action": "<string>",
"step_index": 123,
"attempt": 123,
"max_attempts": 123,
"cache_subject": "<string>",
"build_id": "<string>",
"request_id": "<string>",
"details": {}
},
"request_id": "<string>",
"build_id": "<string>"
}Upgrade to WebSocket for streaming exec/PTY
Upgrades the HTTP connection to a WebSocket. The machine must exist.
This endpoint is for authenticated exec/PTY lifecycle traffic. Public
exposed-port and SSH websocket access is returned as websocket_url
from POST /v1/machines/{id}/host when edge ingress is enabled. See
docs/product/reference/websocket-protocol.md for the message format.
The PTY control stream accepts RuntimeWsClientMessage frames and emits
RuntimeWsServerMessage frames. PTY reconnect accepts exactly one of
session_id or legacy pid; PTY input accepts exactly one of
byte-safe data_base64 or legacy text data. PTY session_id and
legacy pid reconnect are scoped to the current running machine
execution and are not durable across hibernate/resume.
The server sends WebSocket Ping frames every 15 seconds and closes
after two missed Pong responses.
import requests
url = "https://api.13-215-85-171.sslip.io/v1/machines/{id}/ws"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.13-215-85-171.sslip.io/v1/machines/{id}/ws \
--header 'Authorization: Bearer <token>'{
"error": "<string>",
"code": "invalid_request",
"error_detail": {
"code": "unauthorized",
"message": "<string>",
"phase": "auth",
"retryable": true,
"suggested_action": "<string>",
"step_index": 123,
"attempt": 123,
"max_attempts": 123,
"cache_subject": "<string>",
"build_id": "<string>",
"request_id": "<string>",
"details": {}
},
"request_id": "<string>",
"build_id": "<string>"
}