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

# Service commands

> Manage public URLs for sandbox ports with the microsandbox CLI.

Cloud-only (Available only on microsandbox cloud. On the local backend, each command fails; select cloud with MSB\_BACKEND=cloud and MSB\_API\_KEY, or msb context use \<name>.)

Add `--format json` to `create`, `update`, `enable`, `disable`, `inspect`, or `ls` for JSON output. Each Service prints as an object with `slug`, `url`, `status`, `target` (`sandbox` and `port`, or `null`), `created_at`, and `updated_at`.

Commands that change a Service send the change once and never retry it. If a command says the change may have been applied, run `msb service inspect` before trying again.

## msb service create

```bash theme={null}
msb service create my-app --target my-sandbox:8080
```

The target sandbox must be running.

If the slug already names one of your Services, the command directs you to `msb service update` to change its target. An unavailable slug that is not visible to you still asks you to choose another slug.

| Flag | Description |
| - | - |
| `--target` | Running target as `SANDBOX:PORT` |
| `--format` | Output format (`json`) |

## msb service update

```bash theme={null}
msb service update my-app --target new-sandbox:8080
```

Setting a target also enables or reattaches the Service.

| Flag | Description |
| - | - |
| `--target` | Set a running target as `SANDBOX:PORT` |
| `--format` | Output format (`json`) |

## msb service enable

```bash theme={null}
msb service enable my-app
```

Enables the Service. Set a target instead when the Service is detached.

| Flag | Description |
| - | - |
| `--format` | Output format (`json`) |

## msb service disable

```bash theme={null}
msb service disable my-app
```

Disables the Service while retaining its target. If the Service is detached, the command stops and directs you to set a target with `msb service update`.

| Flag | Description |
| - | - |
| `--format` | Output format (`json`) |

## msb service inspect

```bash theme={null}
msb service inspect my-app
```

Shows the Service's slug, URL, status, target, and created and updated times. A detached Service shows `detached` as its status, `-` as its target, and `null` as its JSON target.

| Flag | Description |
| - | - |
| `--format` | Output format (`json`) |

## msb service ls

```bash theme={null}
msb service ls
msb service ls --sandbox new-sandbox
```

Also available as `msb service list`. Lists every Service in slug order, including disabled and detached Services, as a table of slug, status, target, and URL. JSON output is an array.

| Flag | Description |
| - | - |
| `--sandbox` | Only show Services for this sandbox |
| `--format` | Output format (`json`) |

## msb service remove

```bash theme={null}
msb service remove my-app
```

Also available as `msb service rm`. Removes the Service and releases its slug.


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