Skip to main content
The Declaw TypeScript SDK is available on npm and targets Node.js 18+ and modern browsers with native fetch support.

Installation

Environment variables

ConnectionConfig

ConnectionConfig holds the API key, domain, port, and base URL. It is constructed automatically when you pass apiKey and domain to Sandbox.create(). Instantiate it directly when you need to share connection settings.

ConnectionConfigOptions

string
API key sent as X-API-Key. Defaults to process.env.DECLAW_API_KEY.
string
default:"process.env.DECLAW_DOMAIN or 'localhost'"
Hostname of the Declaw API. Supports host:port format — the port is parsed from the string.
number
default:"443"
Explicit port override. Ignored when domain already contains a port.
string
Full URL override (e.g. http://localhost:8080). When set, domain, port, and scheme detection are bypassed.
number
Default per-request HTTP timeout in milliseconds.

Properties


SandboxOpts

SandboxOpts is the options object passed to Sandbox.create().
string
default:"'base'"
Template ID or alias to boot.
number
default:"300"
Sandbox lifetime in seconds.
Record<string, string>
Arbitrary key-value pairs attached to the sandbox.
Record<string, string>
Environment variables injected at boot time.
boolean
default:"true"
Whether to enable the edge proxy security proxy.
boolean
default:"true"
When false, blocks all outbound traffic (deny_out: ["0.0.0.0/0"]).
SandboxNetworkOpts
Fine-grained network configuration. Overrides allowInternetAccess.
SecurityPolicy
Full security policy. See Security Policy.
SandboxLifecycle
Sandbox lifecycle settings (onTimeout, autoResume).
string
API key override for this call.
string
Domain override for this call.
string
Full URL override for this call.
number
Per-request HTTP timeout in milliseconds.

Quick example

Using await using (TypeScript 5.2+)

await using calls sbx.close() which releases the HTTP client but does not kill the sandbox. Call await sbx.kill() explicitly to destroy the sandbox.

What’s exported