---
title: "Daytona"
hideTitleOnPage: true
---

## Daytona

Daytona class for Daytona SDK.

### Constructors

#### new Daytona()

```ruby
def initialize(config)

```

**Parameters**:

- `config` _Daytona:Config_ - Configuration options. Defaults to Daytona::Config.new

**Returns**:

- `Daytona` - a new instance of Daytona

### Methods

#### config()

```ruby
def config()

```

**Returns**:

- `Daytona:Config`

#### api_client()

```ruby
def api_client()

```

**Returns**:

- `DaytonaApiClient`

#### sandbox_api()

```ruby
def sandbox_api()

```

**Returns**:

- `DaytonaApiClient:SandboxApi`

#### volume()

```ruby
def volume()

```

**Returns**:

- `Daytona:VolumeService`

#### object_storage_api()

```ruby
def object_storage_api()

```

**Returns**:

- `DaytonaApiClient:ObjectStorageApi`

#### snapshots_api()

```ruby
def snapshots_api()

```

**Returns**:

- `DaytonaApiClient:SnapshotsApi`

#### snapshot()

```ruby
def snapshot()

```

**Returns**:

- `Daytona:SnapshotService`

#### close()

```ruby
def close()

```

Shuts down OTel providers, flushing any pending telemetry data.

**Returns**:

- `void`

#### create()

```ruby
def create(params, on_snapshot_create_logs:)

```

Creates a sandbox with the specified parameters

**Parameters**:

- `params` _Daytona:CreateSandboxFromSnapshotParams, Daytona:CreateSandboxFromImageParams, Nil_ - Sandbox creation parameters

**Returns**:

- `Daytona:Sandbox` - The created sandbox

**Raises**:

- `Daytona:Sdk:Error` - If auto_stop_interval or auto_archive_interval is negative

#### delete()

```ruby
def delete(sandbox)

```

Deletes a Sandbox.

**Parameters**:

- `sandbox` _Daytona:Sandbox_ -

**Returns**:

- `void`

#### get()

```ruby
def get(id)

```

Gets a Sandbox by its ID.

**Parameters**:

- `id` _String_ -

**Returns**:

- `Daytona:Sandbox`

#### list()

```ruby
def list(query)

```

Iterates over Sandboxes matching the given query.

**Parameters**:

- `query` _Daytona:ListSandboxesQuery, nil_ - Optional filters, sorting, and per-page size.

**Returns**:

- `Enumerator\<Daytona:Sandbox\>`

**Raises**:

- `Daytona:Sdk:Error` -

**Examples:**

```ruby
daytona.list(Daytona::ListSandboxesQuery.new(labels: { 'env' => 'dev' })).each do |sandbox|
  puts sandbox.id
end

```

#### start()

```ruby
def start(sandbox, timeout)

```

Starts a Sandbox and waits for it to be ready.

**Parameters**:

- `sandbox` _Daytona:Sandbox_ -
- `timeout` _Numeric_ - Maximum wait time in seconds (defaults to 60 s).

**Returns**:

- `void`

#### stop()

```ruby
def stop(sandbox, timeout)

```

Stops a Sandbox and waits for it to be stopped.

**Parameters**:

- `sandbox` _Daytona:Sandbox_ -
- `timeout` _Numeric_ - Maximum wait time in seconds (defaults to 60 s).

**Returns**:

- `void`
