PTY
POST/workstations/:workstation_id/sandbox/pty
Connect to a Workstation's PTY (Pseudo Terminal). This endpoint returns a WebSocket URL that can be used to establish a PTY connection with the Workstation.
Example Usage
const id = 'HvcqZjmeoPtP';
const url = `https://api.agentstation.ai/v1/workstations/${id}/sandbox/pty`;
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/pty/cxBMzXSFUSXf
// Initialize PTY connection
const ws = new WebSocket(conn.url);
// Handle connection events
ws.onopen = () => console.log('Connected to PTY');
ws.onclose = () => console.log('Disconnected from PTY');
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 PTY settings:
- Shell: /bin/bash
- Environment: None
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.