Skip to content

Client setup

Initialize the StackMachine client in JavaScript or Python.

Create a client once and reuse it for apps, deployments, domains, and SSH resources. Use a workspace API token in STACKMACHINE_API_TOKEN and pass it explicitly; the SDK does not read environment variables automatically. See Tokens for token scope and management.

client.jsclient.py
import StackMachine from "stackmachine";

const token = process.env.STACKMACHINE_API_TOKEN;
if (!token) throw new Error("STACKMACHINE_API_TOKEN is required");

const client = new StackMachine(token);
import os
from stackmachine import StackMachine

token = os.environ["STACKMACHINE_API_TOKEN"]
client = StackMachine(token)

Source: stackmachine/sdks examples.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close