computers.exec
POST
/v1/computers/{computerId}/sessions
const url = 'https://example.com/v1/computers/example/sessions';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"command":"example","cwd":"example","env":{"additionalProperty":"example"},"tty":true,"rows":1,"cols":1,"yieldTimeMs":1,"maxOutputBytes":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/computers/example/sessions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "command": "example", "cwd": "example", "env": { "additionalProperty": "example" }, "tty": true, "rows": 1, "cols": 1, "yieldTimeMs": 1, "maxOutputBytes": 1 }'Starts a shell command and waits up to yieldTimeMs for it. When it still runs, the answer has a session ID for more input and output. A paused Computer resumes first.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”computerId
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
command
required
string
cwd
string
env
object
key
additional properties
string
tty
boolean
rows
integer
cols
integer
yieldTimeMs
integer
maxOutputBytes
integer
Example generated
{ "command": "example", "cwd": "example", "env": { "additionalProperty": "example" }, "tty": true, "rows": 1, "cols": 1, "yieldTimeMs": 1, "maxOutputBytes": 1}Responses
Section titled “Responses”Success
Media typeapplication/json
object
Example generated
{ "session": "example", "running": true, "exitCode": 1, "signal": "example", "output": "example", "truncated": true}ComputerInvalid | OrganizationRequired
AuthenticationRequired
Media typeapplication/json
object
_tag
required
string
Example
{ "_tag": "AuthenticationRequired"}@nmnmcc/ability/Authorizer/Forbidden | MembershipRequired | ForbiddenOrigin
ComputerNotFound | ComputerPathNotFound | ComputerSessionNotFound | ComputerProviderNotFound | PairingInvalid
@nmnmcc/ability/Authorizer/Pending | ComputerProviderInUse | ComputerConflict | ComputerUnsupported | ComputerNotReady
Media typeapplication/json
Any of:
object
_tag
required
string
ticket
required
string
reason
string
object
_tag
required
string
id
required
string
object
_tag
required
string
version
required
integer
executionId
string
object
_tag
required
string
feature
required
string
object
_tag
required
string
state
required
string
Example
{ "_tag": "Pending"}RateLimited
Media typeapplication/json
object
_tag
required
string
retryAfterSeconds
required
integer
Example
{ "_tag": "RateLimited"}ComputerProviderFailed | ComputerExecutionFailed
ComputersUnavailable | AuthenticationUnavailable | RequestFailed