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

# CLI Commands

> Complete reference of all Nexudus CLI commands, global flags, and usage examples.

# CLI Commands

The Nexudus CLI follows a consistent `nexudus <entity> <action>` pattern. Every entity supports a standard set of operations where applicable.

## Command tree

```
nexudus
├── login                              # Authenticate and store credentials
├── logout                             # Clear stored credentials
├── whoami                             # Show current user info and defaults
├── doctor                             # Run environment diagnostics
├── config
│   ├── get <key>                      # Read a configuration value
│   └── set <key> <value>              # Set a configuration value
├── businesses
│   ├── list [--query] [--page]        # Search businesses
│   ├── get <id>                       # Get a single business
│   └── update <id> [--name] ...       # Update a business
├── products
│   ├── list [--query] [--business]    # Search products
│   ├── get <id>                       # Get a single product
│   ├── create [--name] [--price] ...  # Create a product
│   ├── update <id> [--name] ...       # Update a product
│   └── delete <id>                    # Delete a product
├── resources
│   ├── list / get / create / update / delete
├── bookings
│   ├── list / get / create / update / delete
├── coworkers
│   ├── list / get / create / update / delete / commands
└── ... (100+ entity types)

Global flags: --json | --md | --agent | --base-url <url>
```

<Note>
  New entity types are added regularly. Run `nexudus --help` to see all currently available commands, or run `nexudus doctor --agent` to get a
  machine-readable list.
</Note>

## Global flags

These flags can be added to any command:

| Flag               | Description                                                    |
| ------------------ | -------------------------------------------------------------- |
| `--json`           | Output raw JSON envelope (for scripting)                       |
| `--md`             | Output as Markdown tables                                      |
| `--agent`          | Output JSON envelope with enhanced summary (for AI assistants) |
| `--base-url <url>` | Override the API base URL                                      |
| `--yes` or `-y`    | Skip confirmation prompts (e.g., on delete)                    |

## Common operations

### Listing entities

```bash theme={null}
nexudus products list
nexudus products list --name "Day Pass"
nexudus products list --business 12345678
nexudus products list --page 2 --size 50
```

* `--name` filters results by name or keyword. Different entities support different parameter names.
* `--business` scopes results to a specific business (location).
* `--page` and `--size` control pagination. Default page size is 25; use `--size 100` for larger pages.

### Getting a single entity

```bash theme={null}
nexudus products get 12345678
```

<Info>
  List responses return a simplified projection without collection properties (e.g., `Tariffs`, `Teams`, `LinkedResources`). To see all fields including lists, always fetch the individual entity by ID with `get <id>`.
</Info>

### Creating an entity

```bash theme={null}
nexudus products create --name "Day Pass" --price 25.00 --business 12345678
```

Required fields depend on the entity type. Run `nexudus <entity> create --help` to see all available options and which are required.

### Updating an entity

```bash theme={null}
nexudus products update 12345678 --name "Premium Day Pass" --price 35.00
```

Only the fields you specify are changed. All other fields remain untouched.

### Deleting an entity

```bash theme={null}
nexudus products delete 12345678
```

The CLI prompts for confirmation before deleting. Use `--yes` to skip the prompt in scripts:

```bash theme={null}
nexudus products delete 12345678 --yes
```

### Entity commands

Some entities support additional operations called "commands" (e.g., archiving, activating):

```bash theme={null}
# Discover available commands for an entity type
nexudus products commands

# Run a command on one or more entities
nexudus products run-command archive 123,456,789
```

## Working with list properties

Some entities have list properties (e.g., tariffs on a resource, teams on a coworker). To set these, repeat the flag for each value:

```bash theme={null}
nexudus resources update 123 --tariffs 101 --tariffs 202 --tariffs 303
```

Three variants are available:

| Flag pattern       | Behaviour                                                                   |
| ------------------ | --------------------------------------------------------------------------- |
| `--{list}`         | **Replaces** the entire list with the supplied values. Use this by default. |
| `--added-{list}`   | **Adds** values to the existing list without removing current entries.      |
| `--removed-{list}` | **Removes** specific values from the existing list.                         |

<Warning>Do not use comma-separated values or bracket syntax for lists. Each value needs its own flag occurrence.</Warning>

## Image uploads

Some entities have image properties (logo, banner, picture). To set an image, provide a publicly accessible URL:

```bash theme={null}
nexudus businesses update 123 --logo-url "https://example.com/logo.png"
nexudus resources update 456 --new-picture-url "https://example.com/room.jpg"
```

The Nexudus back-end downloads the image from the URL, so it must be reachable from the internet — local file paths will not work.

## Discovering options

You can always check available options for any command by appending `--help`:

```bash theme={null}
nexudus businesses update --help
nexudus products create --help
nexudus resources list --help
```
