Skip to main content
Use the TypeScript SDK to create and operate Namespace Devboxes from Node.js applications. Install the SDK, authenticate with Namespace, create a client, and run a command in your first Devbox.

Install the SDK

Install the SDK and its peer dependencies with your preferred package manager.
This reference imports the Devbox API from @namespacelabs/sdk/devbox. The package root, @namespacelabs/sdk, also re-exports the same API.

Create your first Devbox

Create a Devbox from the Node.js image, run a command, and delete the Devbox when finished. Always close the client to release its cached connections.

Authenticate with Namespace

For CI/CD and other automated workloads, use workload identity federation to obtain short-lived Namespace credentials without storing a shared token. For local development, install the Devbox CLI and authenticate:
The SDK discovers credentials established by federation, the local user token created by devbox login, or a Namespace workload token. See Authenticate with Namespace for the complete resolution order and explicit token sources.

createDevboxClient()

Create a client that provides access to Devboxes, blueprints, and images. The client loads credentials when it first makes an authenticated request.

Example

API reference

Arguments and options

DevboxClientOptions
Options used to configure the client.

Return value

createDevboxClient() returns a DevboxClient.
DevboxResource
required
Creates, finds, lists, and manages Devboxes.
BlueprintResource
required
Creates and manages reusable Devbox configurations.
ImageResource
required
Registers and manages images used by Devboxes and blueprints.
void
required
Closes cached connections held by the client. It does not delete Devboxes or other resources.

Explore the SDK

Create and manage Devboxes

Create Devboxes and control their lifecycle.

Run commands

Execute structured commands and shell scripts.

Use interactive terminals

Open and control pseudo-terminal sessions.

Work with files

Transfer and manipulate files and directories.

Interact with the display

Capture screenshots and send pointer input.

Use blueprints

Create reusable Devbox configurations.

Manage images

Register, inspect, and optimize images.

Handle errors and timeouts

Cancel operations and handle SDK failures.
Last modified on August 26, 2026