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

# Desktop Viewer

> Start a desktop machine and open a managed viewer URL.

<Warning>
  This example requires a desktop-capable template.
</Warning>

## Setup

```bash theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
uv pip install "${NULLSPACE_SDK_INSTALL_SPEC:-nullspace-sdk==1.0.0}"
export NULLSPACE_API_KEY=ns_live_...
export NULLSPACE_API_URL=https://api.your-nullspace-domain
```

## Python

```python theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
from nullspace import Machine

with Machine.create(template="desktop", timeout=300) as machine:
    width, height = machine.desktop.screen_size()
    print(f"desktop: {width}x{height}")

    machine.desktop.open("https://example.com")
    stream = machine.desktop.stream.start(view_only=False)
    print(f"viewer: {stream.viewer_url}")

    png = machine.desktop.screenshot()
    print(f"screenshot bytes: {len(png)}")

    machine.desktop.stream.stop()
```

## Production note

Viewer URLs are signed. Treat them as bearer credentials and rotate viewer
sessions when sharing access.

Guide: [Managed desktop viewer](../desktop/viewer).
