API and SDK

Everything the dashboard and CLI do goes through a small HTTP API. Authenticate with a token from Dashboard → API tokens:

$curl -H "Authorization: Bearer ls_…" https://app.loadshift.ai/api/v1/machines

Responses are JSON. Errors look like { "error": { "code": "limit_reached", "message": "…" } } with a matching HTTP status.

Endpoints

RequestDoes
GET /api/v1/meYour account, workspace and plan limits
GET /api/v1/machinesList machines in the workspace
POST /api/v1/machinesCreate one: { name?, maxVcpus?, maxMemoryMb?, diskGb? }
GET /api/v1/machines/:nameOne machine, by name or id
POST /api/v1/machines/:name/start, /stopStart or stop
DELETE /api/v1/machines/:nameDelete, including its disk
GET /api/v1/machines/:name/connectSSH address and host keys (owner only)
GET, POST /api/v1/ssh-keys; DELETE /api/v1/ssh-keys/:idYour SSH keys
GET /api/v1/usageThis month's CPU hours and memory GB-hours, total and per machine

TypeScript SDK

@loadshift/sdk wraps the API with types and has no dependencies.

import { LoadShift } from "@loadshift/sdk";
const loadshift = new LoadShift({ baseUrl: "https://app.loadshift.ai", token: process.env.LOADSHIFT_TOKEN });
const m = await loadshift.machines.create({ name: "ci-42" });
await loadshift.machines.waitUntilRunning(m.name);
const { sshHost, sshPort } = await loadshift.machines.connect(m.name);
// … run your job over SSH …
await loadshift.machines.delete(m.name);