Base URL https://app.mandala.computer/api/v1. Every request carries an API key, and failures take the shape under Errors.
GET/ssh-keys
List your SSH keysviewer+
The SSH public keys registered to you — not to the account. A key identifies one person, so this is the same list whichever account your key or session is acting on. A key added from the dashboard reaches the computers of every account where you are an owner or member. A key added through an API key or a connected app reaches only the account that credential acts on, and is removed when the credential is revoked. Each key’s reach says which of those it is, from the account this request acts on, without naming any other. Viewers cannot connect.
HOW TO CONNECT. Switch SSH on for a computer (PUT /computers/{id}/ssh), then ssh -J mandala@ssh.mandala.computer:2222 user@<computer id or name>. The jump host checks the key you offer against this list and your role on the computer’s account; the computer’s own sshd then checks it again. A name that matches computers on more than one of your accounts is refused — use the id. A name works only with a key whose possession is proven or legacy; with an unproven key, use the id, or add the key again with a signature (POST /ssh-keys).
The jump host lets one connection offer up to six keys, as OpenSSH does: every key your client offers that is not registered counts. If ssh reports Too many authentication failures, it offered other keys (from an agent, or default key files) before this one: in ~/.ssh/config, under a Host entry for ssh.mandala.computer and another for the computer, add IdentityFile <your key> and IdentitiesOnly yes. IdentityFile names the private key file, or, for a key held only in an agent, its .pub file. IdentityFile lines add up, so move any under a broader entry such as Host * into one that leaves these hosts out, keeping the rest of that entry (an IdentityAgent line especially) where it is.
The jump host allows 20 connections at once per user, counted across all of your keys (each ssh -J, scp or editor remote holds one for as long as it is open); past that, ssh reports open failed: resource shortage: too many SSH connections for this key's user (limit 20 across all their keys); close one and try again. From one IP address it allows 10 connections still logging in at the same moment, counting one refused for that limit until it has been told; connections that have logged in do not count, so a team behind one office address is not limited by it. A connection over that is closed straight away (ssh reports Connection closed by remote host): wait a moment and retry.
Connecting to a suspended computer resumes it — a start like any other, which your plan can refuse, and on pay as you go running time is charged. A stopped computer refuses the connection; start it first.
Set MANDALA_API_KEY to your bearer key. MANDALA_BASE_URL, when set, is the full API base including /api/v1. Replace the illustrative resource IDs with yours. These pinned 0.27.0 SDK and direct HTTP examples do not read saved device-login credentials.
curl
base_url="${MANDALA_BASE_URL:-}"
if [ -z "$base_url" ]; then base_url='https://app.mandala.computer/api/v1'; fi
curl --fail-with-body "${base_url%/}"'/ssh-keys' \
-H "Authorization: Bearer $MANDALA_API_KEY"
Python — Mandala SDK 0.27.0
# Python 3.10+: pip install mandala-computer==0.27.0
import os
from mandala_computer import Client
with Client(api_key=os.environ["MANDALA_API_KEY"], base_url=os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1") as client:
result = client.ssh_keys.list()
print(result)
TypeScript — Mandala SDK 0.27.0
// Node.js 22+: npm install mandala-computer@0.27.0
import { Client } from "mandala-computer";
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const client = new Client({apiKey, baseUrl: process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1"});
const result = await client.sshKeys.list();
console.log(JSON.stringify(result, null, 2));
405 Unsupported method on this public path; HEAD returns these headers without a body.
HTTP 405
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
Allow: GET, HEAD, POST, OPTIONS
{
"error": "method not allowed",
"request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}
Response
Your keys, oldest first.
Response fields
idalways
string
sshk- and sixteen hex characters.
namealways
string
Your label for it. Defaults to the comment that followed the key when you added it.
public_keyalways
string
The key as <type> <base64>, re-encoded from what you sent: no options and no comment. This is the line the platform writes into the computer.
fingerprintalways
string
SHA256: and 43 characters, exactly as ssh-keygen -l -f <file> prints it.
key_typealways
string
One of ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com or ssh-rsa.
created_atalways
string
RFC 3339 timestamp.
last_used_atalways
string or null
When this key last opened a connection to a computer. null until it has.
reachalways
"everywhere" | "this_account" | "another_account"
Where this key can connect, from the account this request acts on. everywhere: it was added from the dashboard and works on every account where you are an owner or member. this_account: it was added through an API key or connected app on this account and works here only. another_account: it was added through an API key or connected app on a different account and does not work here; which account is not said. A key is registered once, so adding it again is a 409: to use one key on every account, remove it and add it from the dashboard; otherwise use a separate key here.
possessionalways
"proven" | "unproven" | "legacy"
Whether whoever registered this key proved they hold its private half. proven: it was added with a signature over a challenge (POST /ssh-keys/challenge). unproven: it was added from the public line alone; it connects to a computer named by its id, and a computer named by its name is refused, because anybody can copy a public key and register it first. legacy: it was added before proof was asked for, and connects by id or name as it always did. Adding an unproven or legacy key again with a signature replaces it and makes it proven.
Failures
403
Also, with no reason, an API key limited to computers: use a key without that limit.
POST/ssh-keys
Add an SSH keymember+
Registers a public key to you. Accepted: Ed25519, ECDSA (P-256, P-384, P-521), the FIDO security-key forms sk-ssh-ed25519@openssh.com and sk-ecdsa-sha2-nistp256@openssh.com, and RSA of at least 3072 bits. Refused with a 400: DSA, shorter RSA, certificates, a line with authorized_keys options in front of the key, and anything that is not one key on one line.
A key can belong to one person only; registering one that is already registered is a 409. Each person may hold eight; the ninth is a 409.
PROOF THAT THE KEY IS YOURS (optional). A public key is public, so anybody can register a copy of yours. Send challenge and signature to prove you hold the private half: get a challenge from POST /ssh-keys/challenge, sign it with printf '%s' '<challenge>' | ssh-keygen -Y sign -n ssh-key-registration@mandala.computer -f <private key file>, and send what it prints as signature. A key added this way is proven and connects to computers by id or by name; one added without is unproven and connects by id only. With a valid signature, a key already registered without one, to you or to anybody, is not a 409: that registration is removed, from the computers it was written into too, and the key is registered to you. A key already registered with a signature is still a 409. A signature that does not verify, a challenge not issued to you, or one already used or expired, is a 400; the challenge is used up only when the key is registered.
ONLY IF NOTHING CHANGED (optional). A signed add replaces your own unproven registration of the key too, wherever it was made, including through another of your accounts. Send replaces to say which registration you expect: the id of your key you mean to replace, or null for none, from GET /ssh-keys. If your registration of the key is something else by the time the add runs, the add is refused with a 409 whose code is registration_changed, and nothing changes (the challenge stays usable): list your keys again and decide. Only your own registration is compared; an unproven copy registered by somebody else is replaced as above either way. Left out, the add does not check.
The key is bound to the account this API key (or connected app) acts on, and to the credential itself: it is written into every computer with SSH on, on that account only, within moments, and it is removed when the credential is revoked. A key added from the dashboard instead reaches every account where you are an owner or member. The answer does not wait for the computers.
An API key confined to a workspace cannot add or remove SSH keys (403): an SSH key reaches further than that workspace.
Set MANDALA_API_KEY to your bearer key. MANDALA_BASE_URL, when set, is the full API base including /api/v1. Replace the illustrative resource IDs with yours. These pinned 0.27.0 SDK and direct HTTP examples do not read saved device-login credentials.
curl
base_url="${MANDALA_BASE_URL:-}"
if [ -z "$base_url" ]; then base_url='https://app.mandala.computer/api/v1'; fi
curl --fail-with-body -X POST "${base_url%/}"'/ssh-keys' \
-H "Authorization: Bearer $MANDALA_API_KEY" \
-H "Content-Type: application/json" \
--data-raw '{"public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMxlN5MDRT9cXdHi871o7Ty3dKfNLt8mNmjSWtwv6DTw you@laptop","name":"laptop"}'
Python — Mandala SDK 0.27.0
# Python 3.10+: pip install mandala-computer==0.27.0
import json, os
from mandala_computer import Client
with Client(api_key=os.environ["MANDALA_API_KEY"], base_url=os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1") as client:
body = json.loads("{\"public_key\":\"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMxlN5MDRT9cXdHi871o7Ty3dKfNLt8mNmjSWtwv6DTw you@laptop\",\"name\":\"laptop\"}")
result = client.ssh_keys.add(body["public_key"], name=body["name"])
print(result)
TypeScript — Mandala SDK 0.27.0
// Node.js 22+: npm install mandala-computer@0.27.0
import { Client } from "mandala-computer";
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const client = new Client({apiKey, baseUrl: process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1"});
const body = {"public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMxlN5MDRT9cXdHi871o7Ty3dKfNLt8mNmjSWtwv6DTw you@laptop","name":"laptop"};
const result = await client.sshKeys.add({publicKey: body.public_key, name: body.name});
console.log(JSON.stringify(result, null, 2));
405 Unsupported method on this public path; HEAD returns these headers without a body.
HTTP 405
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
Allow: GET, HEAD, POST, OPTIONS
{
"error": "method not allowed",
"request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}
Request body
public_keyrequired
string
One line from a .pub file: <type> <base64> [comment], at most 8192 characters. The comment is dropped. The file read whole is fine: one trailing line ending (\n or \r\n) is ignored and not counted, but a second line is a 400. The key itself, <type> <base64> without the comment, may be at most 8127 characters (room is kept for the comment the platform adds when it installs the key), and a security key’s (sk-) application string at most 256; either over is a 400. At most 8194 characters.
name
string
A label, up to 60 characters after trimming. Left out or null, it is the comment on the line, with any control characters removed and cut to 60 characters, or key if there is none; an empty or blank name is key too.
challenge
string
A challenge from POST /ssh-keys/challenge, exactly as it was issued. Send it with signature, or leave both out.
signature
string
The armored signature ssh-keygen -Y sign printed for challenge, from -----BEGIN SSH SIGNATURE----- to -----END SSH SIGNATURE-----, made with this key in the namespace ssh-key-registration@mandala.computer. The challenge signed with or without one trailing \n is accepted. RSA signatures must be rsa-sha2-256 or rsa-sha2-512 (the default). At most 8192 characters.
replaces
string or null
Makes the add conditional: the id of your registration of this key that the add may replace, or null when you have none. Anything else at the time of the add is a 409registration_changed. Left out, the add is unconditional. Mainly for an add with signature, which replaces an unproven registration.
Response
The key as registered.
Response fields
idalways
string
sshk- and sixteen hex characters.
namealways
string
Your label for it. Defaults to the comment that followed the key when you added it.
public_keyalways
string
The key as <type> <base64>, re-encoded from what you sent: no options and no comment. This is the line the platform writes into the computer.
fingerprintalways
string
SHA256: and 43 characters, exactly as ssh-keygen -l -f <file> prints it.
key_typealways
string
One of ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com or ssh-rsa.
created_atalways
string
RFC 3339 timestamp.
last_used_atalways
string or null
When this key last opened a connection to a computer. null until it has.
reachalways
"everywhere" | "this_account" | "another_account"
Where this key can connect, from the account this request acts on. everywhere: it was added from the dashboard and works on every account where you are an owner or member. this_account: it was added through an API key or connected app on this account and works here only. another_account: it was added through an API key or connected app on a different account and does not work here; which account is not said. A key is registered once, so adding it again is a 409: to use one key on every account, remove it and add it from the dashboard; otherwise use a separate key here.
possessionalways
"proven" | "unproven" | "legacy"
Whether whoever registered this key proved they hold its private half. proven: it was added with a signature over a challenge (POST /ssh-keys/challenge). unproven: it was added from the public line alone; it connects to a computer named by its id, and a computer named by its name is refused, because anybody can copy a public key and register it first. legacy: it was added before proof was asked for, and connects by id or name as it always did. Adding an unproven or legacy key again with a signature replaces it and makes it proven.
Failures
403
Also, with no reason, before anything else: an API key that expires, or one limited to computers. Add the key from the dashboard, or with a key without that limit. Next, a holder who has not verified their email address (Verify your email before adding an SSH key.); verify it in the dashboard.
409
Either refusal here carries no reason, and neither clears by waiting: the key is already registered (to you or to someone else), or you already hold eight keys. Remove a key first, or register a different one; sending the same request again is refused the same way. With replaces, also coderegistration_changed: your registration of the key is not the one replaces named. List your keys before sending it again.
413
This route reads at most 16 KiB (16384 bytes) of request body, less than the general cap.
POST/ssh-keys/challenge
Get a challenge to prove an SSH key is yoursmember+
Issues a challenge to sign with the private half of a key you are about to add, so that POST /ssh-keys can register it as proven (see there). Sign it with sign_command, replacing the key file with yours, and send the challenge and the signature it prints. A challenge is yours alone, works once, and expires after 10 minutes; asking for more than eight at once drops the oldest. Refused where adding a key is: an API key confined to a workspace, one that expires, or a holder who has not verified their email (403). It reads no field: send no body, or {}. A body that is not a JSON object is refused with 400, and one over 16 KiB with 413.
Set MANDALA_API_KEY to your bearer key. MANDALA_BASE_URL, when set, is the full API base including /api/v1. Replace the illustrative resource IDs with yours. These pinned 0.27.0 SDK and direct HTTP examples do not read saved device-login credentials.
curl
base_url="${MANDALA_BASE_URL:-}"
if [ -z "$base_url" ]; then base_url='https://app.mandala.computer/api/v1'; fi
curl --fail-with-body -X POST "${base_url%/}"'/ssh-keys/challenge' \
-H "Authorization: Bearer $MANDALA_API_KEY"
Python — Mandala SDK 0.27.0
# Python 3.10+: pip install mandala-computer==0.27.0
import os
from mandala_computer import Client
with Client(api_key=os.environ["MANDALA_API_KEY"], base_url=os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1") as client:
result = client.ssh_keys.challenge()
print(result)
TypeScript — Mandala SDK 0.27.0
// Node.js 22+: npm install mandala-computer@0.27.0
import { Client } from "mandala-computer";
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const client = new Client({apiKey, baseUrl: process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1"});
const result = await client.sshKeys.challenge();
console.log(JSON.stringify(result, null, 2));
405 Unsupported method on this public path; HEAD returns these headers without a body.
HTTP 405
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
Allow: POST, OPTIONS
{
"error": "method not allowed",
"request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}
Response
The challenge.
Response fields
challengealways
string
sshkc- and 64 hex characters. Sign exactly this text.
namespacealways
string
The signature namespace, ssh-key-registration@mandala.computer (ssh-keygen -Y sign -n).
expires_atalways
string
RFC 3339 timestamp. Register the key before then.
sign_commandalways
string
A shell command that signs the challenge and prints the signature. It names ~/.ssh/id_ed25519; replace that with your private key file.
Failures
400
A body that is not a JSON object.
403
Also, with no reason: an API key that expires, or one limited to computers or confined to a workspace; or a holder who has not verified their email address.
413
This route reads at most 16 KiB (16384 bytes) of request body, less than the general cap.
DELETE/ssh-keys/{id}
Remove an SSH keymember+
Removes one of your keys. New connections with it are refused at once. Within moments it is removed from the computers it was written into, and any SSH session opened with it is closed as each computer receives the new key list. Sessions opened with your other keys are not affected. Not available to a workspace-scoped API key (403).
An API key or connected app removes only a key bound to the account it acts on, one whose reach is this_account. Any other key, whether its reach is everywhere (added from the dashboard, or through the API before keys were bound to an account) or another_account, is a 404, as for a key that does not exist. Remove it from the dashboard; a key whose reach is another_account can also be removed with an API key on the account it was added through.
Set MANDALA_API_KEY to your bearer key. MANDALA_BASE_URL, when set, is the full API base including /api/v1. Replace the illustrative resource IDs with yours. These pinned 0.27.0 SDK and direct HTTP examples do not read saved device-login credentials.
curl
base_url="${MANDALA_BASE_URL:-}"
if [ -z "$base_url" ]; then base_url='https://app.mandala.computer/api/v1'; fi
curl --fail-with-body -X DELETE "${base_url%/}"'/ssh-keys/sshk-a1b2c3d4e5f60718' \
-H "Authorization: Bearer $MANDALA_API_KEY"
Python — Mandala SDK 0.27.0
# Python 3.10+: pip install mandala-computer==0.27.0
import os
from mandala_computer import Client
with Client(api_key=os.environ["MANDALA_API_KEY"], base_url=os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1") as client:
id = "sshk-a1b2c3d4e5f60718"
result = client.ssh_keys.remove(id)
print(result)
TypeScript — Mandala SDK 0.27.0
// Node.js 22+: npm install mandala-computer@0.27.0
import { Client } from "mandala-computer";
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const client = new Client({apiKey, baseUrl: process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1"});
const id = "sshk-a1b2c3d4e5f60718";
const result = await client.sshKeys.remove(id);
console.log(JSON.stringify(result, null, 2));
Always true. A failure is a status code, not ok: false.
Failures
403
Also, with no reason, an API key limited to computers: use a key without that limit.
GET/computers/{id}/ssh
Read a computer’s SSH settingviewer+
Whether SSH is on for this computer, whether it can work here at all, and whether the computer’s hypervisor has the current setting yet. Any role may read it. A macOS computer does not support SSH: available is false and error says so, and a setting stored before that was refused is shown as it is and never sent.
Set MANDALA_API_KEY to your bearer key. MANDALA_BASE_URL, when set, is the full API base including /api/v1. Replace the illustrative resource IDs with yours. These pinned 0.27.0 SDK and direct HTTP examples do not read saved device-login credentials. SDK setup first GETs the computer. Python start/stop/suspend/restart also refresh it with another GET; TypeScript refreshes only if the action returns an acknowledgement.
curl
base_url="${MANDALA_BASE_URL:-}"
if [ -z "$base_url" ]; then base_url='https://app.mandala.computer/api/v1'; fi
curl --fail-with-body "${base_url%/}"'/computers/vm-a1b2c3d4e5f6/ssh' \
-H "Authorization: Bearer $MANDALA_API_KEY"
Python — Mandala SDK 0.27.0
# Python 3.10+: pip install mandala-computer==0.27.0
import os
from mandala_computer import Client
with Client(api_key=os.environ["MANDALA_API_KEY"], base_url=os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1") as client:
id = "vm-a1b2c3d4e5f6"
c = client.computers.get(id)
result = c.ssh_access()
print(result)
TypeScript — Mandala SDK 0.27.0
// Node.js 22+: npm install mandala-computer@0.27.0
import { Client } from "mandala-computer";
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const client = new Client({apiKey, baseUrl: process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1"});
const id = "vm-a1b2c3d4e5f6";
const c = await client.computers.get(id);
const result = await c.sshAccess();
console.log(JSON.stringify(result, null, 2));
Whether SSH is switched on for this computer. Off until somebody switches it on.
availablealways
boolean or null
Whether this computer can run SSH at all. false for a computer made from a template image that predates SSH — create a new computer from the current template to use it — and for a macOS computer, which does not support SSH (error then says so). null when the computer has not been asked yet; it is asked when it next starts.
pendingalways
boolean
Whether the computer’s hypervisor has yet to receive the current setting and key list. It is sent again automatically; a connection attempt sends it first.
key_countalways
integer
How many keys may log in: every key of every owner and member of the account, except keys added through an API key or connected app on a different account, and except the keys of a person whose invitation is not yet accepted, who is suspended, or whose seat is suspended. None at all while the account itself is suspended. 0 while SSH is off.
keys_pushedalways
integer
How many of those the computer is given. The same as key_count unless the account holds more keys than one computer accepts (200); then the keys of the members who joined most recently, and each person’s newest keys, are the ones left out, and connecting with one of them is refused.
erroralways
string or null
Set when the computer’s hypervisor refused the current setting. It is not sent again until a key or this setting changes; pending is false meanwhile. On a macOS computer, which does not support SSH, it says so whatever enabled is. null otherwise.
PUT/computers/{id}/ssh
Switch SSH on or offmember+
Turns SSH on or off for this computer. On, the computer runs an SSH server reachable only through the platform’s jump host, and accepts the keys of every owner and member of the account — not those of a person whose invitation is unaccepted, who is suspended or whose seat is suspended, and none while the account is suspended (see key_count); off, the server stops, the key file is removed and open SSH sessions are closed. No restart either way.
A computer made from a template image that predates SSH cannot run it: the setting is stored and the answer says available: false. Create a new computer from the current template instead.
If the computer’s hypervisor cannot be reached the setting is still stored, the answer says pending: true, and it is delivered when the hypervisor is back — at the latest when somebody next connects or reads this setting.
Connecting to a suspended computer resumes it — a start like any other, which your plan can refuse, and on pay as you go running time is charged. A stopped computer refuses the connection; start it first.
Set MANDALA_API_KEY to your bearer key. MANDALA_BASE_URL, when set, is the full API base including /api/v1. Replace the illustrative resource IDs with yours. These pinned 0.27.0 SDK and direct HTTP examples do not read saved device-login credentials. SDK setup first GETs the computer. Python start/stop/suspend/restart also refresh it with another GET; TypeScript refreshes only if the action returns an acknowledgement.
curl
base_url="${MANDALA_BASE_URL:-}"
if [ -z "$base_url" ]; then base_url='https://app.mandala.computer/api/v1'; fi
curl --fail-with-body -X PUT "${base_url%/}"'/computers/vm-a1b2c3d4e5f6/ssh' \
-H "Authorization: Bearer $MANDALA_API_KEY" \
-H "Content-Type: application/json" \
--data-raw '{"enabled":true}'
Python — Mandala SDK 0.27.0
# Python 3.10+: pip install mandala-computer==0.27.0
import json, os
from mandala_computer import Client
with Client(api_key=os.environ["MANDALA_API_KEY"], base_url=os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1") as client:
id = "vm-a1b2c3d4e5f6"
body = json.loads("{\"enabled\":true}")
c = client.computers.get(id)
result = c.set_ssh_access(body["enabled"])
print(result)
TypeScript — Mandala SDK 0.27.0
// Node.js 22+: npm install mandala-computer@0.27.0
import { Client } from "mandala-computer";
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const client = new Client({apiKey, baseUrl: process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1"});
const id = "vm-a1b2c3d4e5f6";
const body = {"enabled":true};
const c = await client.computers.get(id);
const result = await c.setSshAccess(body.enabled);
console.log(JSON.stringify(result, null, 2));
Whether SSH is switched on for this computer. Off until somebody switches it on.
availablealways
boolean or null
Whether this computer can run SSH at all. false for a computer made from a template image that predates SSH — create a new computer from the current template to use it — and for a macOS computer, which does not support SSH (error then says so). null when the computer has not been asked yet; it is asked when it next starts.
pendingalways
boolean
Whether the computer’s hypervisor has yet to receive the current setting and key list. It is sent again automatically; a connection attempt sends it first.
key_countalways
integer
How many keys may log in: every key of every owner and member of the account, except keys added through an API key or connected app on a different account, and except the keys of a person whose invitation is not yet accepted, who is suspended, or whose seat is suspended. None at all while the account itself is suspended. 0 while SSH is off.
keys_pushedalways
integer
How many of those the computer is given. The same as key_count unless the account holds more keys than one computer accepts (200); then the keys of the members who joined most recently, and each person’s newest keys, are the ones left out, and connecting with one of them is refused.
erroralways
string or null
Set when the computer’s hypervisor refused the current setting. It is not sent again until a key or this setting changes; pending is false meanwhile. On a macOS computer, which does not support SSH, it says so whatever enabled is. null otherwise.
Failures
409
The computer runs macOS, which does not support SSH: reason is unsupported_on_macos. Nothing is stored.
413
This route reads at most 16 KiB (16384 bytes) of request body, less than the general cap.