# @daytona/sdk

> Daytona TypeScript SDK for sandbox management and code execution

Latest version **0.225.0** (published 2026-10-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @daytona/sdk
pnpm add @daytona/sdk
yarn add @daytona/sdk
bun add @daytona/sdk
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.225.0 |
| Published | 2026-10-16 |
| First published | 2026-04-03 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Daytona Platforms Inc. |
| Maintainers | mivanda, mdzaja, gdraganic |
| Keywords | daytona, sandbox, typescript, sdk |

## Links

- npm: https://www.npmjs.com/package/@daytona/sdk
- Repository: https://github.com/daytona/clients
- Homepage: https://www.daytona.io/docs
- Issues: https://github.com/daytona/clients/issues
- npm.io page: https://npm.io/package/@daytona/sdk

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.225.0 (latest) — 2026-10-16
- 0.222.1-alpha.1 (alpha) — 2026-10-06
- 0.224.1 — 2026-10-14
- 0.224.0 — 2026-10-12
- 0.223.1 — 2026-10-09
- 0.223.0 — 2026-10-07
- 0.222.0 — 2026-10-05
- 0.220.0 — 2026-09-29
- 0.218.0 — 2026-09-25
- 0.217.0 — 2026-09-24
- 0.216.1 — 2026-09-23
- 0.216.0 — 2026-09-22
- 0.215.0 — 2026-09-22
- 0.214.0 — 2026-09-15
- 2.0.0-rc.1 — 2026-09-09
- … 73 more at https://npm.io/package/@daytona/sdk/versions

## README

# Daytona TypeScript SDK

The official TypeScript SDK for [Daytona](https://daytona.io), a secure and elastic infrastructure for running AI-generated code. Daytona provides full composable computers — [sandboxes](https://www.daytona.io/docs/en/sandboxes/) — that you can manage programmatically using the Daytona SDK.

The SDK provides an interface for sandbox management, file system operations, Git operations, language server protocol support, process and code execution, and computer use. For more information, see the [documentation](https://www.daytona.io/docs/en/typescript-sdk/).

## Installation

Install the package using **npm**:

```bash
npm install @daytona/sdk
```

or using **yarn**:

```bash
yarn add @daytona/sdk
```

## Get API key

Generate an API key from the [Daytona Dashboard ↗](https://app.daytona.io/dashboard/keys) to authenticate SDK requests and access Daytona services. For more information, see the [API keys](https://www.daytona.io/docs/en/api-keys/) documentation.

## Configuration

Configure the SDK using [environment variables](https://www.daytona.io/docs/en/configuration/#environment-variables) or by passing a [configuration object](https://www.daytona.io/docs/en/configuration/#configuration-in-code):

- `DAYTONA_API_KEY`: Your Daytona [API key](https://www.daytona.io/docs/en/api-keys/)
- `DAYTONA_API_URL`: The Daytona [API URL](https://www.daytona.io/docs/en/tools/api/)
- `DAYTONA_TARGET`: Default [region](https://www.daytona.io/docs/en/regions/) for sandboxes and snapshots (e.g. `us`, `eu`); a per-call `target` / `regionId` overrides it

```typescript
import { Daytona } from '@daytona/sdk'

// Initialize with environment variables
const daytona = new Daytona();

// Initialize with configuration object
const daytona = new Daytona({
  apiKey: 'YOUR_API_KEY',
  apiUrl: 'YOUR_API_URL',
  target: 'us',
});
```

## Create a sandbox

Create a sandbox to run your code securely in an isolated environment.

```typescript
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona({apiKey: "YOUR_API_KEY"});
const sandbox = await daytona.create({
  language: 'typescript'
});
const response = await sandbox.process.codeRun('console.log("Hello World!")');
console.log(response.result);
```

## Examples and guides

Daytona provides [examples](https://www.daytona.io/docs/en/getting-started/#examples) and [guides](https://www.daytona.io/docs/en/guides/) for common sandbox operations, best practices, and a wide range of topics, from basic usage to advanced topics, showcasing various types of integrations between Daytona and other tools.

### Create a sandbox or snapshot in a specific region

Pass `target` in the sandbox create params, or `regionId` in the snapshot create params, to choose the [region](https://www.daytona.io/docs/en/regions/) for that call. The region is resolved per call: the per-call value, then the client-level `target` (or `DAYTONA_TARGET`), then the organization's default region.

```typescript
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()
const sandbox = await daytona.create({ target: 'eu' })
const snapshot = await daytona.snapshot.create({ name: 'my-snapshot', image: 'python:3.12', regionId: 'eu' })
```

### Create a sandbox with custom resources

Create a sandbox with [custom resources](https://www.daytona.io/docs/en/sandboxes/#resources) (CPU, memory, disk).

```typescript
import { Daytona, Image } from '@daytona/sdk';

const daytona = new Daytona();
const sandbox = await daytona.create({
    image: Image.debianSlim('3.12'),
    resources: { cpu: 2, memory: 4, disk: 8 }
});
```

### Create an ephemeral sandbox

Create an [ephemeral sandbox](https://www.daytona.io/docs/en/sandboxes/#ephemeral-sandboxes) that is automatically deleted when stopped.

```typescript
import { Daytona } from '@daytona/sdk';

const daytona = new Daytona();
const sandbox = await daytona.create({
    ephemeral: true,
    autoStopInterval: 5
});
```

### Create a sandbox from a snapshot

Create a sandbox from a [snapshot](https://www.daytona.io/docs/en/snapshots/).

```typescript
import { Daytona } from '@daytona/sdk';

const daytona = new Daytona();
const sandbox = await daytona.create({
    snapshot: 'my-snapshot-name',
    language: 'typescript'
});
```

### Execute commands

Execute commands in the sandbox.

```typescript
// Execute a shell command
const response = await sandbox.process.executeCommand('echo "Hello, World!"')
console.log(response.result)

// Run TypeScript code
const response = await sandbox.process.codeRun(`
const x = 10
const y = 20
console.log(\`Sum: \${x + y}\`)
`)
console.log(response.result)
```

### File operations

Upload, download, and search files in the sandbox.

```typescript
// Upload a file
await sandbox.fs.uploadFile(Buffer.from('Hello, World!'), 'path/to/file.txt')

// Download a file
const content = await sandbox.fs.downloadFile('path/to/file.txt')

// Search for files
const matches = await sandbox.fs.findFiles(root_dir, 'search_pattern')
```

### Git operations

Clone, list branches, and add files to the sandbox.

```typescript
// Clone a repository
await sandbox.git.clone('https://github.com/example/repo', 'path/to/clone')

// List branches
const branches = await sandbox.git.branches('path/to/repo')

// Add files
await sandbox.git.add('path/to/repo', ['file1.txt', 'file2.txt'])
```

### Language server protocol

Create and start a language server to get code completions, document symbols, and more.

```typescript
// Create and start a language server
const lsp = await sandbox.createLspServer('typescript', 'path/to/project')
await lsp.start()

// Notify the lsp for the file
await lsp.didOpen('path/to/file.ts')

// Get document symbols
const symbols = await lsp.documentSymbols('path/to/file.ts')

// Get completions
const completions = await lsp.completions('path/to/file.ts', {
  line: 10,
  character: 15,
})
```

## List method return shapes

Each `list` method returns a different shape depending on the resource. The table below shows the exact return type and how to access the elements.

| Method | Return type | Shape | Access elements |
| --- | --- | --- | --- |
| `daytona.snapshot.list(page?, limit?)` | `Promise<PaginatedSnapshots>` | Paginated wrapper | `result.items.forEach(...)` |
| `daytona.secret.list(query?)` | `Promise<ListSecretsResponse>` | Cursor-paginated wrapper | `page.items.forEach(...)` |
| `daytona.volume.list()` | `Promise<Volume[]>` | Bare array | `volumes.forEach(...)` |
| `daytona.list(query?)` | `AsyncIterableIterator<Sandbox>` | Lazy iterator | `for await (const s of daytona.list())` |

`PaginatedSnapshots` and `ListSecretsResponse` are **wrapper objects**, not arrays. Calling `.map()` or `.forEach()` directly on them throws `TypeError: result.map is not a function`. Always go through `.items`:

```typescript
// snapshots — page-number pagination
const result = await daytona.snapshot.list(1, 20)
// result.items  → Snapshot[]
// result.total  → number (total across all pages)
// result.page   → number (current page, 1-indexed)
// result.totalPages → number
result.items.forEach(snapshot => console.log(snapshot.name))

// secrets — cursor pagination
let cursor: string | undefined
do {
  const page = await daytona.secret.list({ cursor, limit: 50 })
  // page.items      → Secret[]
  // page.total      → number
  // page.nextCursor → string | null (null = no more pages)
  page.items.forEach(secret => console.log(secret.name))
  cursor = page.nextCursor ?? undefined
} while (cursor)

// volumes — bare array, iterate directly
const volumes = await daytona.volume.list()
volumes.forEach(vol => console.log(vol.name))

// sandboxes — lazy async iterator, fetches pages on demand
for await (const sandbox of daytona.list({ labels: { env: 'dev' } })) {
  console.log(sandbox.id)
}
```

---
_Source: https://npm.io/package/@daytona/sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
