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

# Managed domain

> Reserve a BoxLite-managed hostname and bind it to your service. No DNS configuration required.

Publish your service at an address such as `my-service.boxliteapp.com`. BoxLite manages DNS and HTTPS. To use a hostname you own instead, follow [Bring your own domain](https://docs.boxlite.ai/cloud/custom-domains.md).

## Before you start

Install the latest CLI in your local terminal:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -fsSL https://sh.boxlite.ai | sh
```

Create an [API key](https://docs.boxlite.ai/cloud/api-keys.md) in the [console](https://app.boxlite.ai), then sign in:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite --context app auth login \
  --url https://api.boxlite.ai --method api-key
```

Paste your key at the prompt. `app` is the saved context used throughout this guide. Use the same organization in the console and CLI.

## BoxLite-managed domain

Use this route for a hostname such as `my-service.boxliteapp.com`. BoxLite handles DNS and HTTPS for you.

In the console, open **Domains → Managed domain → Request domain**. Enter a short name, such as `my-service`, and review the **Full domain** preview before submitting.

Choose an available name using lowercase letters, digits, and hyphens. The page shows your organization's name-length requirement and remaining allowance.

Copy the full hostname into your terminal, replacing the placeholder below. Include neither `https://` nor a port:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
DOMAIN='<YOUR_FULL_DOMAIN>'
```

For example, if you reserved `my-service`, the production hostname is `my-service.boxliteapp.com`. Use the hostname actually returned by your environment.

Already have a domain? Reuse it instead of requesting another:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite --context app domain ls
```

> [!NOTE]
>
> Reserving a name uses your organization's domain allowance. Unbinding it later keeps the name reserved and does not free that allowance.

## Publish your service

Use the hostname saved in `DOMAIN` below.

**1. Choose the service to expose**

> [tab] Existing service
>
> Set the box ID or name and the port your service listens on **inside the box**:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> BOX='<YOUR_BOX_ID_OR_NAME>'
> PORT=29090
> boxlite --context app start "$BOX"
> ```
>
> Replace `29090` with your service's port. The service must listen on `0.0.0.0`, rather than only `127.0.0.1`.

> [tab] Try a sample server
>
> Create a box with an HTTP server as its saved startup command:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> BOX=$(boxlite --context app create \
>   --name domain-demo \
>   --auto-stop 0 --auto-delete 0 \
>   python:alpine python -m http.server 29090 --bind 0.0.0.0)
> PORT=29090
> boxlite --context app start "$BOX"
> ```
>
> The sample serves a directory listing. `--auto-stop 0` keeps it running until you stop it; request-triggered startup is optional.

**2. Open the port and bind the domain**

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite --context app network inbound "$BOX" enabled
boxlite --context app network tunnel "$BOX" "$PORT"
boxlite --context app domain bind "$DOMAIN" \
  --type box --box "$BOX" --port "$PORT"
```

The tunnel command registers the port for public access and prints its generated URL. The bind command gives that port your chosen hostname and prints its HTTPS URL.

All three pieces are required: inbound access, a public tunnel for the port, and the domain binding. Binding alone does not make a service public.

This is a public endpoint. If your service needs sign-in or API authentication, enforce it in the application.

**3. Open your fixed URL**

Open `https://<YOUR_FULL_DOMAIN>` in your browser, or request it from your terminal:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --fail --show-error \
  -H 'X-BoxLite-Skip-Preview-Warning: true' \
  "https://$DOMAIN/"
```

The header skips the preview notice for scripted requests; it does not grant access or bypass your application's authentication.

You should receive your service's response. For the sample server, look for **Directory listing for /**. Share this HTTPS address with your clients; they do not need the box ID or internal port.

## Manage the service

To move the domain to another box, prepare the new service and its public tunnel, then run `domain bind` again with the same hostname and the new box and port. This changes routing; it does not copy application data.

To stop routing the domain while keeping its configuration:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite --context app domain unbind "$DOMAIN"
```

Unbinding retains the hostname and its allowance. The generated tunnel URL remains accessible. To close public access to that port too:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite --context app network tunnel --revoke "$BOX" "$PORT"
```

If you created the sample box and no longer need it:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite --context app rm --force "$BOX"
```

Deleting the box does not release or clear its domain binding. Unbind first or point the domain to another box.

For idle stopping and request-triggered startup, see [Box lifecycle](https://docs.boxlite.ai/cloud/box-lifecycle.md#wake-on-access). Save the service as the box's startup command so it runs after a restart.

## Troubleshooting

| Symptom | What to check |
| - | - |
| `domain_not_owned` | Confirm the full hostname and organization with `domain ls`, and complete domain setup before binding. |
| The URL returns `404` | Check the domain binding, inbound access, and the public tunnel for the bound port. |
| The app cannot be reached | Confirm it listens on `0.0.0.0` at the bound port. Test the generated tunnel URL first. |
| The domain allowance is full | Reuse a held hostname; unbinding does not release its allowance. See [Domain allowances](https://docs.boxlite.ai/cloud/plans.md#domains-storage-and-images). |


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