A NodeJS SDK for consuming the Square Cloud API.
npm install @squarecloud/api
# or
yarn add @squarecloud/api
# or
pnpm add @squarecloud/apiVisit the official documentation for the full API reference.
import { SquareCloudAPI } from "@squarecloud/api";
const api = new SquareCloudAPI(process.env.SQUARE_API_KEY!);
// Fetch your account (user + applications + databases)
const user = await api.user.get();
console.log(`Hi ${user.name}! You have ${user.applications.size} apps.`);
// Grab one application by ID and control it
const app = await api.applications.fetch("abc123def456abc123def456");
await app.start();
await app.envs.set({ DATABASE_URL: "postgres://..." });
const logs = await app.getLogs();The client exposes the full v2 platform surface:
api.user— your account, plan, snapshotsapi.applications— list, create (upload), fetchApplication— status, logs, metrics, start/stop/restart, commit, realtime SSE.files— read, write, list, move, delete.envs— environment variables (list/set/replace/delete).snapshots— list, create, download, restore.deploys— list, GitHub App link, webhook, current config.network(websites only) — custom domain, DNS, analytics, errors, logs, performance, purge cache
api.databases— create, list, fetchDatabase— status, metrics, start/stop, update, delete.credentials— TLS certificate, rotate password/certificate.snapshots— list, create, download, restore
api.workspaces— list, create, fetchWorkspace— leave, delete.members— add, update role, remove.applications— share, unshare
api.service— platform health
Runnable snippets per area live in examples/:
applications.ts— lifecycle, files, envs, commitsnapshots.ts— list, create, download, restoredeploys.ts— list, GitHub App, webhooknetwork.ts— domain, DNS, analytics, errors, purgedatabases.ts— create, credentials, snapshotsworkspaces.ts— invite codes, members, sharing appsrealtime.ts— SSE event stream
Bug reports and PRs welcome at squarecloudofc/sdk-api-js.
