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

# Create a session

The `create` command in MarinaBox CLI is used to create a new session in a secure and isolated sandbox environment. This command supports multiple environment types and additional configuration options.

## Video Tutorial

<iframe width="100%" height="400" src="https://www.youtube.com/embed/cfD-ftjip8s" title="MarinaBox Session Creation Tutorial" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

***

## Command Syntax

```bash theme={null}
mb local create --env-type=<browser|desktop> [--tag=<TAG>] [--kiosk] [--initial-url=<URL>]
```

### Options:

* `--env-type`: Specifies the type of environment for the session. Supported values:
  * `browser`: Creates a sandboxed browser environment.
  * `desktop`: Creates a sandboxed desktop environment.
* `--tag`: (Optional) Assigns a custom tag to the session for easier identification.
* `--kiosk`: (Optional) Launches Chrome in kiosk mode (browser environment only). Removes tab controls and runs in fullscreen.
* `--initial-url`: (Optional) Specifies the initial URL to open when the browser starts (browser environment only).

## Examples

### 1. Create a Browser Session

```bash theme={null}
mb local create --env-type=browser
```

This creates a browser session with default resolution and no tag.

### 2. Create a Desktop Session with Custom Resolution

```bash theme={null}
mb local create --env-type=desktop
```

### 3. Create a Tagged Session

```bash theme={null}
mb local create --env-type=desktop --tag=TestSession
```

This creates a desktop session with a custom tag `TestSession`.

### 4. Create a Kiosk Mode Browser Session

```bash theme={null}
mb local create --env-type=browser --kiosk
```

This creates a browser session in kiosk mode, ideal for presentations or public displays.

### 5. Create a Browser Session with Initial URL

```bash theme={null}
mb local create --env-type=browser --initial-url="https://example.com"
```

This creates a browser session that automatically opens example.com on startup.

***

## Command Behavior

1. **Environment Validation**: Ensures the specified `env-type` is valid (`browser` or `desktop`).
2. **Port Allocation**: Dynamically assigns ports for the sandbox environment to avoid conflicts.
3. **Container Spin-Up**: Creates the sandbox environment using the specified options and returns session details upon success.

***

## Expected Output

Upon successful execution, the command returns details of the created session in JSON format:

```json theme={null}
{
  "session_id": "abc123xyz",
  "env_type": "browser",
  "status": "running",
  "resolution": "1200x800x24",
  "tag": "TestSession"
}
```

Use the session ID for subsequent commands to manage or view the session.

***

### Get Support & Join Our Community

* Discord: [https://discord.gg/nAyFBSSU87](https://discord.gg/nAyFBSSU87)
* Email: [askmarinabox@gmail.com](mailto:askmarinabox@gmail.com)
