Docs
SSH ›

Get ssh

GET/v1/sandboxes/{id}/ssh

Whether SSH is turned on for the sandbox, and where it is logged in to now. It changes nothing, and is answered whatever state the sandbox is in.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. const ssh = await sandbox.ssh.get();
Answer200 OK · SshState
  1. {
  2. "enabled": boolean,
  3. "enabledAt": string | null,
  4. "address": string | null,
  5. "host": string | null,
  6. "port": integer | null,
  7. "user": string | null,
  8. "hostKey": string | null,
  9. }

Whether SSH is on, and the address, user and host key to connect with while it can be.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Returns

200 Whether SSH is on, and the address, user and host key to connect with while it can be.

SshState7 fields
enabled
boolean
Whether SSH is turned on for the sandbox.
More It stays so through a stop and a start, and a move to another server: the port is opened again by itself.
enabledAt
stringnull
Since when it is on.
More Null when it is off.
address
stringnull
Where to connect now, as host:port.
More Null while SSH is off, while the sandbox is not running, and in the moments after a start or a move before its port is open again. It is another address after a move, so read it again when a connection is lost.
host
stringnull
The host of address: the public address of the server the sandbox is on.
port
integernull
The port of address, which leads to this sandbox's SSH server and to nothing else.
user
stringnull
Who a key logs in as.
More Null with address.
hostKey
stringnull
The machine's public host key, as a type and the key in base64.
More It comes over this API and not over SSH, so a client can pin it and never be asked to trust one. Null with address.

Errors and other answers

404 Not found.
409ssh_unavailable a port leads to the sandbox, and its machine does not say what its host key is.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.