Secrets

Credentials the account stores once and binds to computers. Values go in and never come out.

Base URL https://app.mandala.computer/api/v1. Every request carries an API key, and failures take the shape under Errors.

GET/computers/{id}/credential-gateway

List credential gateway bindingsmember+

Lists destination policies and secret references, never secret values. Members and owners may read this computer’s bindings.

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%/}"'/computers/vm-a1b2c3d4e5f6/credential-gateway' \
  -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"
    result = client.credential_gateway.list(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 = "vm-a1b2c3d4e5f6";
const result = await client.credentialGateway.list(id);
console.log(JSON.stringify(result, null, 2));

200 Current bindings, without secret values.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "bindings": [
    {
      "id": "cgw-0123456789abcdef01234567",
      "computer_id": "vm-a1b2c3d4e5f6",
      "secret_id": "csec-0123456789abcdef",
      "origin": "https://api.github.com",
      "path_prefix": "/repos/example/project",
      "methods": [
        "GET"
      ],
      "created_at": "2026-10-27T00:00:00.000Z",
      "base_url": "http://10.100.0.1:17842/cgw-0123456789abcdef01234567",
      "auth_header": "authorization",
      "placeholder": "mandala-placeholder"
    }
  ]
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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"
}

Path parameters

idrequiredstring

The computer id.

Response

The current bindings.

Response fields

bindingsalwaysCredentialGatewayBinding[]

POST/computers/{id}/credential-gateway

Bind a credential to an upstream APIowner+

Owners may create up to eight immutable bindings per computer, using a secret in its workspace or account scope. Requires an active paid or trial account, enabled secret delivery and a ready host gateway. The gateway inserts the latest secret, as a Bearer credential or in x-api-key (auth_header), after verified TLS to the exact public HTTPS origin on port 443. Only the specified methods and path prefix (on a segment boundary) are allowed. Delete and recreate to change the policy. No secret is delivered to the guest.

The secret’s value must be printable ASCII with no spaces or line breaks, and a trailing newline counts. Any other value is refused with 400 when the binding is created. Replacing a bound secret with such a value is not refused, and every call through the binding then answers 503 until it is replaced again. Replacing the value with PUT /secrets/{id} fixes that; the binding does not need remaking.

Inside the computer use the returned base_url followed by the provider path, with the placeholder as the API key: Authorization: Bearer mandala-placeholder or x-api-key: mandala-placeholder. An LLM SDK works by setting its base URL to base_url and its API key to mandala-placeholder (for Anthropic: ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY). The headers anthropic-version, anthropic-beta, openai-beta, openai-organization and openai-project are passed on, with Content-Type and Accept; other guest headers are not. Answers stream as the provider sends them, server-sent events included. The status and Content-Type come back; no other provider response header does, Retry-After and request ids included, so a client must back off on a 429 by itself. This explicit gateway uses control-plane egress, independently of a computer’s egress proxy. Only non-browser HTTP clients are supported; no redirects, WebSocket upgrades or automatic retries. Limits: 7 MiB request, 64 MiB answer, 10 minutes per call, and 2 minutes without a byte once the provider’s response headers have arrived; before the headers only the 10 minutes applies, so a long call should stream ("stream": true for an LLM), which brings the headers early. Four concurrent calls per computer and four per account; 16 across everything on the computer’s host and 64 across the platform, of which one provider origin may hold at most 32, and the last 8 for an origin, last 4 on a host and last 16 on the platform are kept for accounts with no call in flight. Inside the computer a concurrency 429 reads the same whether it was this account’s limit or a full shared pool: back off and retry. 120 calls a minute per account, of which 60 at most through any one host. A failed call after dispatch may have performed the provider action: check before retrying.

A call from the guest that fails here answers a fixed JSON {error}, with no Retry-After. 403: the placeholder is missing, wrong or sent in both headers; the method or path is outside this binding; the request carries Origin, Sec-Fetch-Site, Sec-Fetch-Dest or Content-Encoding; the path has encoded separators or dots, spaces or non-ASCII characters; or the computer is not running or no longer in the binding’s scope. 404: the path does not start with a binding id. 400: a GET or HEAD with a body. 413: a request over 7 MiB. 429: past a concurrency limit or the rate limit. 503: nothing was sent to the provider, which includes a secret that is gone or has an unusable value. 502: the call was sent and no complete answer came back. A provider’s own status comes back as itself.

Those are failures before the provider’s status reaches the guest. Once it has, a provider that disconnects or a limit reached partway through cuts the connection instead: the guest has that status and a body that stops short, with no JSON error, and the call may already have taken effect.

Deleting a binding or secret blocks requests not yet dispatched; an admitted request can finish. Clone does not inherit bindings. Restore uses current bindings; migration waits for unambiguous recorded placement. Workspace/owner changes and delete-begin remove bindings. Stop/suspend refuse new requests. Provider responses are trusted: use a provider that does not echo credentials and a narrowly scoped provider key. This protects credential custody, not misuse of allowed API operations by guest code.

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%/}"'/computers/vm-a1b2c3d4e5f6/credential-gateway' \
  -H "Authorization: Bearer $MANDALA_API_KEY" \
  -H "Content-Type: application/json" \
  --data-raw '{"secret_id":"csec-0123456789abcdef","origin":"https://api.github.com","path_prefix":"/repos/example/project","methods":["GET"]}'

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("{\"secret_id\":\"csec-0123456789abcdef\",\"origin\":\"https://api.github.com\",\"path_prefix\":\"/repos/example/project\",\"methods\":[\"GET\"]}")
    result = client.credential_gateway.create(id, secret_id=body["secret_id"], origin=body["origin"], path_prefix=body["path_prefix"], methods=body["methods"])
    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 = {"secret_id":"csec-0123456789abcdef","origin":"https://api.github.com","path_prefix":"/repos/example/project","methods":["GET"]};
const result = await client.credentialGateway.create(id, {secretId: body.secret_id, origin: body.origin, pathPrefix: body.path_prefix, methods: body.methods as ("GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE")[]});
console.log(JSON.stringify(result, null, 2));

201 The new binding.

HTTP 201
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "id": "cgw-0123456789abcdef01234567",
  "computer_id": "vm-a1b2c3d4e5f6",
  "secret_id": "csec-0123456789abcdef",
  "origin": "https://api.github.com",
  "path_prefix": "/repos/example/project",
  "methods": [
    "GET"
  ],
  "created_at": "2026-10-27T00:00:00.000Z",
  "base_url": "http://10.100.0.1:17842/cgw-0123456789abcdef01234567",
  "auth_header": "authorization",
  "placeholder": "mandala-placeholder"
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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"
}

Path parameters

idrequiredstring

The computer id.

Request body

secret_idrequiredstring

Existing customer secret ID. Its value must be printable ASCII with no spaces or line breaks; see above.

originrequiredstring

Exact HTTPS origin, without path, query, userinfo or nondefault port. At most 256 characters, naming a public host by a DNS name with a dot: not an IP address or a single-label name.

path_prefixrequiredstring

Canonical absolute path prefix, matched at segment boundaries. At most 4096 characters, with no query.

methodsrequired"GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE"[]

1 to 6 items.

auth_header"authorization" | "x-api-key"

Where the credential goes: authorization (default) as a Bearer token, or x-api-key as the value itself. x-api-key answers 409 with reason: "unsupported" on a host that cannot take it yet.

Response

The binding and guest connection settings.

Response fields

idalwaysstring
computer_idalwaysstring
secret_idalwaysstring
originalwaysstring
path_prefixalwaysstring
methodsalwaysstring[]
auth_headeralways"authorization" | "x-api-key"

Where the gateway puts the credential: authorization as a Bearer token, or x-api-key as the value itself (Anthropic’s API). Bindings made before the field read authorization.

created_atalwaysstring
base_urlalwaysstring

Guest-only HTTP base URL. Append the provider’s absolute path.

placeholderalwaysstring

Send it from the guest as the API key: Authorization: Bearer mandala-placeholder or x-api-key: mandala-placeholder, whichever the client uses. This is not a credential.

Failures

400

The body is not JSON or not an object, or a field is missing, unknown or malformed; the error names the field and why. Also when secret_id names no usable secret in this computer’s workspace or account. Nothing is made.

403

Also Credential gateway is unavailable for this account.: the account is not active, has no plan, trial or pay as you go, or this deployment has secret delivery off.

409

reason: "contention": the computer is changing scope or placement; send it again shortly. reason: "unsupported": its host cannot take an x-api-key binding yet. With no word: it already has eight bindings; delete one first.

Also, on a macOS computer: reason: "unsupported_on_macos", with the sentence “The credential gateway is not supported on macOS computers.” Waiting does not change it. It is answered before anything is sent to the computer, and nothing is reserved or stored for it.

413

This route reads at most 8 KiB (8192 bytes) of request body, less than the general cap.

503

Secrets or the host gateway are unavailable.

DELETE/computers/{id}/credential-gateway/{binding}

Revoke a credential gateway bindingowner+

Owners may revoke a binding without contacting the host. Requests not yet dispatched can no longer use it; a request already sent to the provider may finish within its deadline. A missing binding returns 404.

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%/}"'/computers/vm-a1b2c3d4e5f6/credential-gateway/cgw-0123456789abcdef01234567' \
  -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"
    binding = "cgw-0123456789abcdef01234567"
    result = client.credential_gateway.delete(id, binding)
    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 binding = "cgw-0123456789abcdef01234567";
const result = await client.credentialGateway.delete(id, binding);
console.log(JSON.stringify(result, null, 2));

200 Binding revoked.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "ok": true
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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: DELETE, OPTIONS

{
  "error": "method not allowed",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

Path parameters

idrequiredstring

The computer id.

bindingrequiredstring

A credential gateway binding id from GET /computers/{id}/credential-gateway (cgw- followed by 24 lowercase hex characters).

Response

The binding was removed.

Response fields

okalwaystrue

GET/computers/{id}/guest-token

Read whether the computer may fetch guest tokensviewer+

Guest identity tokens let a program on the computer call this API without an API key on its disk. From inside the computer, GET http://10.100.0.1:17842/identity/token with the header Mandala-Metadata: true answers {token, token_type, expires_at, expires_in, computer_id, api_base}: a bearer token (mgt_ and 48 hex characters) that works for one hour and reaches only this computer. Send it as Authorization: Bearer. It may call this computer’s own routes, GET /computers (narrowed to this one) and GET /whoami, at no more than the member role, and not the ones a key limited to computers may not make: delete, PATCH, clone, move, workspace, secrets, credential gateway bindings, the hosted agent, or this setting. Like any key that expires it may not create public URLs, SSH keys or webhooks, and it may not open or renew a browser connection or change the computer’s SSH setting either, since none of those would end with the token. Fetch a new one before expires_at; the host may answer the same token for a few minutes, and a client whose token answers 401 adds Mandala-Metadata-Refresh: true to get a new one.

The computer’s host decides which computer asked, from its own record of the guest’s network identity; nothing the guest sends names it. A token ends when it expires, when the computer is deleted, lost or moved to another workspace, when anyone on the account is removed, suspended or has their role changed (none is issued for ten minutes after), when a leaked credential is revoked with leaked=rotate (no token is issued again until that rotation has run), when support access to the account opens or a control share of the computer is made (none is issued while either lasts, or for ten minutes after), and when this setting is turned off. A copy taken off the computer still works from anywhere until then, so treat it as the credential it is.

The token is held by the account’s longest-standing owner, and the audit trail names it by its gtk- id. Anyone on the account may read this setting. On by default.

The address answers 403 to a request without Mandala-Metadata: true, with a browser’s Origin or Sec-Fetch-* headers, addressed to another host name, or from a computer the host cannot identify; and 403 with reason: "disabled" when this setting is off. 429 past 12 fetches a minute; 503 while the host or control plane cannot issue one.

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%/}"'/computers/vm-a1b2c3d4e5f6/guest-token' \
  -H "Authorization: Bearer $MANDALA_API_KEY"

Python — direct HTTP (the SDK wrapper reads the computer first)

# Direct HTTP: mandala-computer==0.27.0 wraps the guest-token setting only on a Computer, which it reads from the computer's host first; this works with that host down.
# Python 3.10+; standard library only.
import json, os
from urllib.request import Request, urlopen
from urllib.parse import quote

base_url = (os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1").rstrip("/")
url = base_url + "/" + "computers" + "/" + quote("vm-a1b2c3d4e5f6", safe="") + "/" + "guest-token"
headers = {"Authorization": "Bearer " + os.environ["MANDALA_API_KEY"]}
request = Request(url, headers=headers, method="GET")
with urlopen(request) as response:
    print(json.load(response))

TypeScript — direct HTTP (the SDK wrapper reads the computer first)

// Direct HTTP: mandala-computer@0.27.0 wraps the guest-token setting only on a Computer, which it reads from the computer's host first; this works with that host down.
// Node.js 22+; no package required.

const baseUrl = (process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1").replace(/\/+$/, "");
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const encodeSegment = (value: string) => encodeURIComponent(value).replace(/[!'()*]/g, c => "%" + c.charCodeAt(0).toString(16).toUpperCase());
const url = new URL(baseUrl + "/" + "computers" + "/" + encodeSegment("vm-a1b2c3d4e5f6") + "/" + "guest-token");
const headers: Record<string, string> = {Authorization: "Bearer " + apiKey};
const response = await fetch(url, {method: "GET", headers});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
console.log(await response.json());

200 Guest tokens are on, and the computer holds one.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "enabled": true,
  "active_tokens": 1,
  "token_url": "http://10.100.0.1:17842/identity/token"
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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, PUT, OPTIONS

{
  "error": "method not allowed",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

Path parameters

idrequiredstring

The computer id.

Response

The setting.

Response fields

enabledalwaysboolean

Whether programs on the computer may fetch a guest token.

active_tokensalwaysinteger

How many unexpired guest tokens the computer holds.

token_urlalwaysstring

Where a program on the computer fetches one, with Mandala-Metadata: true.

PUT/computers/{id}/guest-token

Turn guest tokens on or off for a computerowner+

Owners only, and not from a guest token. {"enabled": false} stops programs on the computer fetching guest tokens and revokes every one it holds at once: they answer 401 from the next request. {"enabled": true} lets it fetch them again. See GET /computers/{id}/guest-token.

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 PUT "${base_url%/}"'/computers/vm-a1b2c3d4e5f6/guest-token' \
  -H "Authorization: Bearer $MANDALA_API_KEY" \
  -H "Content-Type: application/json" \
  --data-raw '{"enabled":false}'

Python — direct HTTP (the SDK wrapper reads the computer first)

# Direct HTTP: mandala-computer==0.27.0 wraps the guest-token setting only on a Computer, which it reads from the computer's host first; this works with that host down.
# Python 3.10+; standard library only.
import json, os
from urllib.request import Request, urlopen
from urllib.parse import quote

base_url = (os.environ.get("MANDALA_BASE_URL") or "https://app.mandala.computer/api/v1").rstrip("/")
url = base_url + "/" + "computers" + "/" + quote("vm-a1b2c3d4e5f6", safe="") + "/" + "guest-token"
headers = {"Authorization": "Bearer " + os.environ["MANDALA_API_KEY"], "Content-Type": "application/json"}
body = json.loads("{\"enabled\":false}")
request = Request(url, headers=headers, method="PUT", data=json.dumps(body).encode("utf-8"))
with urlopen(request) as response:
    print(json.load(response))

TypeScript — direct HTTP (the SDK wrapper reads the computer first)

// Direct HTTP: mandala-computer@0.27.0 wraps the guest-token setting only on a Computer, which it reads from the computer's host first; this works with that host down.
// Node.js 22+; no package required.

const baseUrl = (process.env.MANDALA_BASE_URL || "https://app.mandala.computer/api/v1").replace(/\/+$/, "");
const apiKey = process.env.MANDALA_API_KEY;
if (!apiKey) throw new Error("Set MANDALA_API_KEY");
const encodeSegment = (value: string) => encodeURIComponent(value).replace(/[!'()*]/g, c => "%" + c.charCodeAt(0).toString(16).toUpperCase());
const url = new URL(baseUrl + "/" + "computers" + "/" + encodeSegment("vm-a1b2c3d4e5f6") + "/" + "guest-token");
const headers: Record<string, string> = {Authorization: "Bearer " + apiKey, "Content-Type": "application/json"};
const body = {"enabled":false};
const response = await fetch(url, {method: "PUT", headers, body: JSON.stringify(body)});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
console.log(await response.json());

200 Turned off; the one token it held was revoked.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "enabled": false,
  "active_tokens": 0,
  "token_url": "http://10.100.0.1:17842/identity/token",
  "revoked": 1
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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, PUT, OPTIONS

{
  "error": "method not allowed",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

Path parameters

idrequiredstring

The computer id.

Request body

enabledrequiredboolean

Whether programs on the computer may fetch a guest token.

Response

The setting after the change, and how many tokens were revoked.

Response fields

enabledalwaysboolean

Whether programs on the computer may fetch a guest token.

active_tokensalwaysinteger

How many unexpired guest tokens the computer holds.

token_urlalwaysstring

Where a program on the computer fetches one, with Mandala-Metadata: true.

revokedalwaysinteger

How many tokens turning it off revoked; 0 otherwise.

Failures

400

The body is not a JSON object, has a field other than enabled, or enabled is not a boolean.

413

This route reads at most 1 KiB (1024 bytes) of request body, less than the general cap.

GET/secrets

List secretsmember+

The secrets in one scope: the account-wide ones by default, or one workspace’s with workspace_id. Names, ids and revisions only — no route ever returns a value.

Owners and members may read; viewers cannot, not even the names. An API key confined to a workspace lists that workspace’s secrets, and naming any other scope is a 403. From an account-wide key, a workspace_id that names no workspace of this account (an empty one included) is a 400, No such workspace on this account.

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%/}"'/secrets' \
  -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.secrets.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.secrets.list();
console.log(JSON.stringify(result, null, 2));

200 Illustrative successful response.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "secrets": [
    {
      "id": "csec-0123456789abcdef",
      "name": "OPENAI_API_KEY",
      "workspace_id": null,
      "revision_id": "csr-0123456789abcdef01234567",
      "created_at": "2026-09-16T12:00:00.000Z",
      "updated_at": "2026-09-16T12:00:00.000Z",
      "last_used_at": null
    }
  ],
  "delivery": true,
  "limits": {
    "name_max_chars": 60,
    "value_max_bytes": 4096,
    "active_per_account": 100,
    "created_per_account": 1000
  }
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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"
}

Query parameters

workspace_idstring

The workspace to list. Leave it out for the account-wide secrets.

Response

The secrets in that scope, and the limits.

Response fields

secretsalwaysSecret[]
deliveryalwaysboolean

Whether a secret can be bound to a computer and delivered into it on this platform. While false, secrets can be stored but a binding is refused.

limitsalwaysobject
limits.name_max_charsalwaysinteger

The longest name, in characters.

limits.value_max_bytesalwaysinteger

The largest value, in bytes of UTF-8.

limits.active_per_accountalwaysinteger

How many secrets the account may hold at once, across every workspace. Deleting one frees a place; a workspace holding active secrets cannot be deleted. Secrets orphaned by older workspace deletions remain unreachable and still count; this safeguard does not repair them.

limits.created_per_accountalwaysinteger

How many secrets the account may hold counting deleted ones, which keep counting for 30 days after their deletion (longer while a computer is still bound to one). Deleting does not free a place at once.

Failures

503

Also Secrets are not enabled on this control plane. when this deployment has secrets switched off. That one does not clear by retrying.

POST/secrets

Create a secretowner+

Stores a value under a name, encrypted, for binding to computers with PUT /computers/{id}/secrets. The answer is the secret without its value; the value cannot be read back by any route.

Owners only. A name is unique within its scope: a taken one is a 409 with reason: "name_taken", and sending the same request again gets the same answer.

TWO LIMITS, both answered 400: the account holds at most 100 secrets at once, and deleting one frees a place. A workspace holding active secrets cannot be deleted (see DELETE /workspaces/{id}). Secrets orphaned by older workspace deletions remain unreachable and still count; this safeguard does not repair them. The account may hold at most 1000 counting deleted ones: a deleted secret keeps counting for 30 days after its deletion (longer while a computer is still bound to it), so deleting does not free a place at once. GET /secrets reports both in limits.

Without workspace_id the secret is account-wide, and a computer in any workspace may be bound to it. An API key confined to a workspace creates in that workspace, and naming any other scope is a 403. From an account-wide key, a workspace_id that names no workspace of this account is a 400, No such workspace on this account.

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%/}"'/secrets' \
  -H "Authorization: Bearer $MANDALA_API_KEY" \
  -H "Content-Type: application/json" \
  --data-raw '{"name":"OPENAI_API_KEY","value":"sk-…"}'

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("{\"name\":\"OPENAI_API_KEY\",\"value\":\"sk-…\"}")
    result = client.secrets.create(body["name"], body["value"])
    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 = {"name":"OPENAI_API_KEY","value":"sk-…"};
const result = await client.secrets.create({name: body.name, value: body.value});
console.log(JSON.stringify(result, null, 2));

201 Illustrative successful response.

HTTP 201
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "id": "csec-0123456789abcdef",
  "name": "OPENAI_API_KEY",
  "workspace_id": null,
  "revision_id": "csr-0123456789abcdef01234567",
  "created_at": "2026-09-16T12:00:00.000Z",
  "updated_at": "2026-09-16T12:00:00.000Z",
  "last_used_at": null
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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

namerequiredstring

Up to 60 characters, no control characters. Leading and trailing spaces are trimmed, and the trimmed name is stored. Unique within the scope, ignoring ASCII case: a name that differs from a taken one only in ASCII case (Token and token) collides, a 409 with reason: "name_taken". At least 1 characters.

valuerequiredstring

The value, as text: 1 to 4096 bytes of UTF-8.

workspace_idstring or null

The workspace it belongs to. Leave it out, or send null, for account-wide.

Response

The secret, without its value.

Response fields

idalwaysstring

csec- and sixteen hex characters. What a binding names as secret_id.

namealwaysstring

Its name, as sent with leading and trailing spaces trimmed. Up to 60 characters. Unique within its scope, ignoring ASCII case: names that differ only in ASCII case collide (409, reason: "name_taken").

workspace_idalwaysstring or null

The workspace it belongs to, or null for one available account-wide.

revision_idalwaysstring

csr- and twenty-four hex characters. Moves every time the value is replaced; a replace or delete sends back the one it read.

created_atalwaysstring

RFC 3339 timestamp.

updated_atalwaysstring

RFC 3339 timestamp of the last replace, or of the create.

last_used_atalwaysstring or null

When it was last delivered to a computer. null until it has been. Use through the credential gateway does not count.

Failures

413

This route reads at most 32 KiB (32768 bytes) of request body, less than the general cap.

503

Also Secrets are not enabled on this control plane. when this deployment has secrets switched off. That one does not clear by retrying.

GET/secrets/{id}

Read a secretmember+

One secret’s name, scope and current revision_id — which a replace or delete needs — without its value. A secret in a workspace is found only with that workspace_id; for any other it is a 404, a workspace_id that names no workspace of this account included. An API key confined to a workspace that names any other scope is refused with 403 instead; an account-wide key gets the 404.

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%/}"'/secrets/csec-0123456789abcdef' \
  -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 = "csec-0123456789abcdef"
    result = client.secrets.get(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 = "csec-0123456789abcdef";
const result = await client.secrets.get(id);
console.log(JSON.stringify(result, null, 2));

200 Illustrative successful response.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "id": "csec-0123456789abcdef",
  "name": "OPENAI_API_KEY",
  "workspace_id": null,
  "revision_id": "csr-0123456789abcdef01234567",
  "created_at": "2026-09-16T12:00:00.000Z",
  "updated_at": "2026-09-16T12:00:00.000Z",
  "last_used_at": null
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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, PUT, DELETE, OPTIONS

{
  "error": "method not allowed",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

Path parameters

idrequiredstring

The secret id.

Query parameters

workspace_idstring

The workspace the secret belongs to. Leave it out for an account-wide one.

Response

The secret, without its value.

Response fields

idalwaysstring

csec- and sixteen hex characters. What a binding names as secret_id.

namealwaysstring

Its name, as sent with leading and trailing spaces trimmed. Up to 60 characters. Unique within its scope, ignoring ASCII case: names that differ only in ASCII case collide (409, reason: "name_taken").

workspace_idalwaysstring or null

The workspace it belongs to, or null for one available account-wide.

revision_idalwaysstring

csr- and twenty-four hex characters. Moves every time the value is replaced; a replace or delete sends back the one it read.

created_atalwaysstring

RFC 3339 timestamp.

updated_atalwaysstring

RFC 3339 timestamp of the last replace, or of the create.

last_used_atalwaysstring or null

When it was last delivered to a computer. null until it has been. Use through the credential gateway does not count.

Failures

503

Also Secrets are not enabled on this control plane. when this deployment has secrets switched off. That one does not clear by retrying.

PUT/secrets/{id}

Replace a secret’s valueowner+

Replaces the value and moves revision_id. Send the revision_id you read: if it has moved since, the answer is 409 with reason: "stale_revision" and nothing changed. Sending the same request again gets the same answer: read the secret again and retry with its current revision_id.

A computer bound to it as an environment variable gets the new value in its desktop session at its next start or restart; on an image that supports it, a running one is also sent the new value for new shells and for every exec, plain or with session: "desktop", so the next one sees it, while programs already running keep the value they started with. One bound to it as a FILE is also sent the new value while it runs. Both are sent asynchronously and on a best-effort basis: the answer does not wait for that, and does not say whether it landed. Unless the update was confirmed — not if its host was unreachable, or refused it, or took it and never answered — a running computer may still hold the old value until its next start or restart, which always delivers the latest. A host whose egress proxy signs in with this secret is sent the new value the same way, for its next connection; tunnels already open stay open.

A secret a computer’s egress_proxy.credentials_secret_id names must keep a user:password value (a colon, no control characters, one trailing newline ignored): any other is refused with 400 and nothing changed. Owners only.

A secret in a workspace is found only with that workspace_id; for any other it is a 404, a workspace_id that names no workspace of this account included. An API key confined to a workspace that names any other scope, null included, is refused with 403 instead; an account-wide key gets the 404.

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 PUT "${base_url%/}"'/secrets/csec-0123456789abcdef' \
  -H "Authorization: Bearer $MANDALA_API_KEY" \
  -H "Content-Type: application/json" \
  --data-raw '{"value":"sk-…","revision_id":"csr-0123456789abcdef01234567"}'

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 = "csec-0123456789abcdef"
    body = json.loads("{\"value\":\"sk-…\",\"revision_id\":\"csr-0123456789abcdef01234567\"}")
    result = client.secrets.replace(id, body["value"], revision_id=body["revision_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 = "csec-0123456789abcdef";
const body = {"value":"sk-…","revision_id":"csr-0123456789abcdef01234567"};
const result = await client.secrets.replace(id, {value: body.value, revisionId: body.revision_id});
console.log(JSON.stringify(result, null, 2));

200 Illustrative successful response.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "id": "csec-0123456789abcdef",
  "name": "OPENAI_API_KEY",
  "workspace_id": null,
  "revision_id": "csr-89abcdef0123456789abcdef",
  "created_at": "2026-09-16T12:00:00.000Z",
  "updated_at": "2026-09-23T09:30:00.000Z",
  "last_used_at": "2026-09-20T08:00:00.000Z"
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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, PUT, DELETE, OPTIONS

{
  "error": "method not allowed",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

Path parameters

idrequiredstring

The secret id.

Request body

valuerequiredstring

The new value: 1 to 4096 bytes of UTF-8.

revision_idrequiredstring

The revision_id a read of this secret answered.

workspace_idstring or null

The workspace the secret belongs to. Leave it out for an account-wide one.

Response

The secret at its new revision, without its value.

Response fields

idalwaysstring

csec- and sixteen hex characters. What a binding names as secret_id.

namealwaysstring

Its name, as sent with leading and trailing spaces trimmed. Up to 60 characters. Unique within its scope, ignoring ASCII case: names that differ only in ASCII case collide (409, reason: "name_taken").

workspace_idalwaysstring or null

The workspace it belongs to, or null for one available account-wide.

revision_idalwaysstring

csr- and twenty-four hex characters. Moves every time the value is replaced; a replace or delete sends back the one it read.

created_atalwaysstring

RFC 3339 timestamp.

updated_atalwaysstring

RFC 3339 timestamp of the last replace, or of the create.

last_used_atalwaysstring or null

When it was last delivered to a computer. null until it has been. Use through the credential gateway does not count.

Failures

413

This route reads at most 32 KiB (32768 bytes) of request body, less than the general cap.

503

Also Secrets are not enabled on this control plane. when this deployment has secrets switched off. That one does not clear by retrying.

DELETE/secrets/{id}

Delete a secretowner+

Deletes it. revision_id is required, and a stale one is a 409 with reason: "stale_revision" and nothing deleted; sending the same request again gets the same answer. Owners only.

Deleting does not recall a value already delivered, and it is not refused while computers are bound to the secret. A running computer bound to it keeps the value it holds. One window remains: if a replace of this secret was still being sent to a computer bound to it as a file when the delete committed, that value may still arrive — a send not yet dispatched is abandoned, one already on its way is not.

Nothing more is delivered after the delete, so a computer still bound to it cannot be given its secrets again. Its next start, and a disk snapshot restored onto it, are refused with 409 and reason: "unsupported" until the binding is removed; a restart, or a reboot inside the guest, stops it rather than bring it up without them. Remove the binding with PUT /computers/{id}/secrets — before deleting, or on the stopped computer afterwards — to start it again.

SAVED MEMORY THAT HOLDS IT IS LOST. A suspended computer’s saved session and every memory snapshot keep the secrets the computer was bound to when they were saved, and a resume or a memory restore is refused once any of them is deleted. Rebinding the computer to another secret first does not change that: a suspended computer saved holding the deleted secret can only be stopped, which discards its saved session, and started fresh. To rotate without losing one, resume it before the delete and restart it once it is bound to the new secret.

AN EGRESS PROXY THAT SIGNS IN WITH IT IS SHUT OFF. Every computer whose egress_proxy.credentials_secret_id names this secret has its proxy credentials revoked on this control plane before the answer is sent, so nothing is sent to its host for it again. Its host is then told to drop the value it holds, without the answer waiting for that: until the host has, new connections can still sign in with it. Once it has, every connection that computer opens is refused rather than sent directly (egress_proxy_pending), until its egress_proxy is saved naming a secret that exists. A host that could not be told is told again by the platform’s next reconcile.

A secret in a workspace is found only with that workspace_id; for any other it is a 404, a workspace_id that names no workspace of this account included. An API key confined to a workspace that names any other scope is refused with 403 instead; an account-wide key gets the 404.

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%/}"'/secrets/csec-0123456789abcdef?revision_id=csr-0123456789abcdef01234567' \
  -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 = "csec-0123456789abcdef"
    query = {"revision_id":"csr-0123456789abcdef01234567"}
    result = client.secrets.delete(id, revision_id=query["revision_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 = "csec-0123456789abcdef";
const query = {"revision_id":"csr-0123456789abcdef01234567"};
const result = await client.secrets.delete(id, {revisionId: query.revision_id});
console.log(JSON.stringify(result, null, 2));

200 Illustrative successful response.

HTTP 200
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17

{
  "ok": true
}

401 Platform bearer credential missing.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer

{
  "error": "Authentication required",
  "reason": "missing",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential invalid.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "invalid API key",
  "reason": "invalid",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

401 Platform bearer credential revoked.

HTTP 401
Content-Type: application/json
X-Request-ID: 3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17
WWW-Authenticate: Bearer error="invalid_token"

{
  "error": "API key revoked",
  "reason": "revoked",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

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, PUT, DELETE, OPTIONS

{
  "error": "method not allowed",
  "request_id": "3f2c9a1e-7b4d-4e8a-9c61-0d5f2b8e4a17"
}

Path parameters

idrequiredstring

The secret id.

Query parameters

revision_idrequiredstring

The revision_id a read of this secret answered. Missing or malformed is a 400.

workspace_idstring

The workspace the secret belongs to. Leave it out for an account-wide one.

Response

Gone.

Response fields

okboolean

Always true. A failure is a status code, not ok: false.

Failures

503

Also Secrets are not enabled on this control plane. when this deployment has secrets switched off. That one does not clear by retrying.