VNC WebSocket
POST/workstations/:workstation_id/vncwss
Connect to a Workstation's desktop using a browser-based VNC client such as noVNC. This endpoint returns a Secure WebSocket URL that can be used to establish a remote desktop connection directly in the browser.
VNC WebSocket for Browser Clients (NoVNC)
// setup request to get a VNC WebSocket URL to connect to the Workstation
const id = 'HvcqZjmeoPtP';
const url = `https://api.agentstation.ai/v1/workstations/${id}/vncwss`;
// Get VNC connection details from AgentStation API
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': 'Bearer <your_token>'
}
});
const conn = await response.json();
// conn.url example: wss://connect.agentstation.ai/v1/vnc/cxBMzXSFUSXf
// Initialize noVNC
const rfb = new RFB(
document.getElementById('vnc-display'),
conn.url,
{
wsProtocols: ['binary'],
clipViewport: true,
scaleViewport: true,
resizeSession: true,
qualityLevel: 6,
compressionLevel: 2
}
);
// Handle connection events
rfb.addEventListener('connect', () => console.log('Connected to VNC'));
rfb.addEventListener('disconnect', () => console.log('Disconnected from VNC'));
Notes
- The WebSocket connection will be automatically closed after the Workstation is released
- The URL contains a secure random token that authenticates the connection
- Default VNC settings:
- Resolution: 1280x720
- Color depth: 24-bit
- Framerate: 30 fps
- Encoding: Tight with JPEG compression
Request
Responses
- 200
- 400
- 401
- 402
- 422
- 429
- 500
- 503
Remote connection successful
Invalid Request Format - check API documentation for proper syntax.
Unauthorized - missing or invalid API key.
Payment Required - you have run out of trial credits or your payment method has expired. Please add payment details to your account.
Unprocessable Entity - cannot find requested asset associated with your API key.
Too Many Requests - you have exceeded the rate limit for your account. Please wait before making additional requests.
Internal Server Error - please retry your request.
Service Unavailable - our servers have dropped the request due to high load - please retry.