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

# ultra link

> Link this gateway to a workspace

Link this Ultra gateway to a workspace in Ultra Hub. After linking, the gateway syncs traces and audit events to Hub.

## Usage

```bash theme={null}
ultra link [flags]
```

## Flags

| Flag          | Short | Default  | Description             |
| ------------- | ----- | -------- | ----------------------- |
| `--workspace` | `-w`  |          | Workspace ID to link to |
| `--name`      | `-n`  | hostname | Name for this gateway   |

## Examples

```bash theme={null}
# Link interactively (choose workspace)
ultra link

# Link to a specific workspace
ultra link --workspace ws_xxxxxxxxxxxx

# Link with a custom gateway name
ultra link --name "My MacBook"
```

## Prerequisites

You must be logged in first:

```bash theme={null}
ultra login
```

## Interactive Flow

1. Fetches your available workspaces from Hub
2. Shows a selector to choose a workspace
3. Prompts for a gateway name (defaults to hostname)
4. Registers the gateway with Hub
5. Saves gateway ID and workspace ID to config

## After Linking

```bash theme={null}
ultra start   # Traces and events will sync to Hub automatically
```

## Already Linked

If the gateway is already linked, Ultra shows the current gateway ID and workspace. Use `ultra unlink` to disconnect before re-linking.
