> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started

> Create a client and get started with Namespace Devboxes using the TypeScript SDK.

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

## Create your first Devbox

Create a Devbox from the Node.js image, run a command, and delete the Devbox when finished.

```typescript {4,7-10,15-16,19} theme={null}
import { createDevboxClient } from "@namespacelabs/sdk/devbox";

// Create a Devbox Client
const client = createDevboxClient();

// Create a Devbox
const devbox = await client.devboxes.create({
  name: "devbox-created-with-sdk4",
  imageName: "builtin:agents",
});

console.log(`Created Devbox: ${devbox.name} --- ${devbox.id}`);

// Run a command
const result = await devbox.exec(["node", "--version"]);
console.log(result.stdout.trim());

// Close the connection at the end
client.close();
```

> [!TIP]
>
> Always close the client to release its cached connections.

See [Devbox Client](https://namespace.so/docs/reference/typescript-sdk/devbox/devbox-client.md) for configuration options and the complete client interface.

## Authenticate with Namespace

For CI/CD and other automated workloads, use [workload identity federation](https://namespace.so/docs/reference/typescript-sdk/devbox/authentication.md#workload-identity-federation) to obtain short-lived Namespace credentials without storing a shared token.

For local development, [install the Devbox CLI](https://namespace.so/docs/reference/devbox-cli/installation.md) and authenticate:

```bash theme={null}
devbox login
```

The SDK discovers credentials established by federation, the local user token created by `devbox login`, or a Namespace workload token. See [Authenticate with Namespace](https://namespace.so/docs/reference/typescript-sdk/devbox/authentication.md) for the complete resolution order and explicit token sources.

## Explore the SDK

> [card] [Create and manage Devboxes](https://namespace.so/docs/reference/typescript-sdk/devbox/manage.md)
>
> Create Devboxes and control their lifecycle.

> [card] [Run commands](https://namespace.so/docs/reference/typescript-sdk/devbox/commands.md)
>
> Execute structured commands and shell scripts.

> [card] [Run services](https://namespace.so/docs/reference/typescript-sdk/devbox/services.md)
>
> Supervise long-running commands such as development servers.

> [card] [Expose ports](https://namespace.so/docs/reference/typescript-sdk/devbox/exposed-ports.md)
>
> Publish HTTP ports on shareable devbox.so URLs.

> [card] [Use interactive terminals](https://namespace.so/docs/reference/typescript-sdk/devbox/terminals.md)
>
> Open and control pseudo-terminal sessions.

> [card] [Work with files](https://namespace.so/docs/reference/typescript-sdk/devbox/files.md)
>
> Transfer and manipulate files and directories.

> [card] [Interact with the display](https://namespace.so/docs/reference/typescript-sdk/devbox/display.md)
>
> Capture screenshots and send pointer input.

> [card] [Use blueprints](https://namespace.so/docs/reference/typescript-sdk/devbox/blueprints.md)
>
> Create reusable Devbox configurations.

> [card] [Manage images](https://namespace.so/docs/reference/typescript-sdk/devbox/images.md)
>
> Register, inspect, and optimize images.

> [card] [Handle errors and timeouts](https://namespace.so/docs/reference/typescript-sdk/devbox/errors.md)
>
> Cancel operations and handle SDK failures.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.