NodeOps
UK

API Reference

The complete public surface of @nodeops-createos/sandbox, organized by what you hold and what you call. Everything documented here is exported from the package root; anything not re-exported is internal and may change without notice.

At a glance

  • Package: @nodeops-createos/sandbox (npm)
  • Import: import { createClient } from "@nodeops-createos/sandbox"
  • Base URL: https://api.sb.createos.sh — override with CREATEOS_SANDBOX_BASE_URL
  • Auth: API key via the apiKey option or CREATEOS_SANDBOX_API_KEY

The two-object model

The SDK has two stateful objects and three catalog sub-APIs:

  • CreateosSandboxClient — the entry point. Construct it once with a base URL and API key. It resolves the catalog (shapes, rootfs, hosts), identity (whoami), creates and looks up sandboxes, and exposes the templates / networks / disks sub-APIs.
  • Sandbox — the handle returned by the client. It owns one sandbox id; every per-sandbox operation (run commands, move files, pause / fork / destroy, ingress, attach disks and networks) is a method on it. File operations are available via sandbox.files.

A Sandbox holds a reference to the transport, never the client. You can create a handle to an existing sandbox with client.getSandbox(id) and keep using it after the original client goes out of scope.

TypeScript
1import { CreateosSandboxClient } from "@nodeops-createos/sandbox";
2
3const client = new CreateosSandboxClient(); // reads CREATEOS_SANDBOX_BASE_URL + CREATEOS_SANDBOX_API_KEY
4const sandbox = await client.createSandbox({ shape: "s-4vcpu-4gb", rootfs: "devbox:1" });
5try {
6 const out = await sandbox.runCommand("uname", ["-a"]);
7 console.log(out.result.stdout);
8} finally {
9 await sandbox.destroy();
10}

Pages

PageCovers
ClientCreateosSandboxClient, createClient, construction & options, the sandbox factory, catalog & identity
SandboxThe Sandbox handle — commands, lifecycle, ingress, egress, networks, disks
Sandbox Filessandbox.files — file upload, download, and directory operations
Sub-APIsTemplatesApi, NetworksApi, DisksApi — the cross-sandbox catalog sub-APIs
ErrorsThe CreateosSandboxError hierarchy and HTTP status → class mapping
HelperspollUntil, sleep, detectRuntime, redaction helpers, VERSION, and the CreateosSandboxHttp escape hatch
TypesAll wire types and option interfaces (the JSON request/response shapes)

Conventions

  • ESM-only, zero runtime dependencies. The SDK is a hand-written fetch client. It runs on Node 20+, Bun, Deno, Cloudflare Workers, Vercel Edge, and the browser.
  • Optional fields use ?, not | null. When the server omits a field (omitempty), the key is absent rather than null.
  • List endpoints are paginated. Client list methods fetch every page for you; the iterate* variants are async generators. The server clamps the page size to 500.
  • Sandboxes bill while running. Every example tears down in try { … } finally { await sandbox.destroy(); }. Do the same in your code, or set idle auto-pause via setAutoPause.

See also

100,000+ Builders. One Workspace.

Get product updates, builder stories, and early access to features that help you ship faster.

CreateOS is a unified intelligent workspace where ideas move seamlessly from concept to live deployment, eliminating context-switching across tools, infrastructure, and workflows with the opportunity to monetize ideas immediately on the CreateOS Marketplace.