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
| Request | Does |
|---|---|
GET /api/v1/me | Your account, workspace and plan limits |
GET /api/v1/machines | List machines in the workspace |
POST /api/v1/machines | Create one: { name?, maxVcpus?, maxMemoryMb?, diskGb? } |
GET /api/v1/machines/:name | One machine, by name or id |
POST /api/v1/machines/:name/start, /stop | Start or stop |
DELETE /api/v1/machines/:name | Delete, including its disk |
GET /api/v1/machines/:name/connect | SSH address and host keys (owner only) |
GET, POST /api/v1/ssh-keys; DELETE /api/v1/ssh-keys/:id | Your SSH keys |
GET /api/v1/usage | This 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);