---
url: /v6.2/en-us/cli-reference-app.md
---
# App & Dashboard Commands

This page covers application spaces, dashboards, and page elements. It aligns most closely with the `hbi-app` and `hbi-dashboard` skills. The high-frequency command families include minimal runnable examples and representative output so you can start from a concrete command immediately.

## `app`

**Purpose**: manage apps themselves, plus app-level configuration and access.

**Common subcommands**:

* lifecycle: `list` `show` `create` `update` `move` `transfer` `delete` `duplicate` `export` `import`
* replacement: `dataapp-replace` `connection-replace`
* access and publishing: `grant` `revoke` `permissions` `publish` `republish` `unpublish` `share`
* app capabilities: `param` `dimension` `rule` `subscribe` `portal` `locale` `refresh-schedule`
* AI-related: `vectorize-datasets`

**Minimal runnable example**:

```bash
hbi app list --area personal-area --root --limit 3 --output json
```

**Representative output**:

```json
[
  {
    "id": 4812,
    "title": "Sales Analysis App",
    "createdAt": "2025-03-15 10:00:00",
    "createdBy": 151,
    "updatedAt": "2026-05-20 14:30:00",
    "updatedBy": 151,
    "action": "read",
    "area": "PERSONAL_AREA",
    "type": "ANALYTIC_APP",
    "isPublish": false
  }
]
```

**Common next steps**:

* Show app details: `hbi app show 4812 --output json`
* List dashboards in the app: `hbi dashboard list --app 4812 --output json`
* List datasets in the app: `hbi dataset list --app 4812 --output json`
* Grant app access: `hbi app grant 4812 -u 123 -p edit --dry-run`

If you need to go deeper into one app capability, focus on these command trees:

* parameters and shared dimensions: `app param` `app dimension`
* rules and subscriptions: `app rule` `app subscribe`
* portal, localization, and refresh scheduling: `app portal` `app locale` `app refresh-schedule`

## `folder`

**Purpose**: manage folder trees.

**Common subcommands**:

* `list` `show`
* `create` `update` `delete`
* `move`
* `root`

Use this family to organize resources in personal areas, team spaces, data marts, and similar folder hierarchies.

**Minimal runnable example**:

```bash
hbi folder root --area personal-area --output json
```

**Representative output**:

```json
{
  "id": 0,
  "title": "personal_area_root_folder",
  "area": "PERSONAL_AREA",
  "children": [
    {
      "id": 3674,
      "title": "Analytics Projects",
      "area": "PERSONAL_AREA",
      "children": []
    }
  ]
}
```

**Common next steps**:

* Show one folder: `hbi folder show 3674 --output json`
* Create a child folder: `hbi folder create --parent 3674 "Q1 Reports" --output json`
* Move a folder: `hbi folder move 3674 --target-parent 0 --dry-run`

## `dashboard`

**Purpose**: manage dashboards, reports, and themes.

**Common subcommands**:

* `list` `show`
* `create` `copy` `delete` `update`
* `export-data` `export-file`
* `plan`
* `theme`

**Minimal runnable example**:

```bash
hbi dashboard create --app 4812 "Sales Cockpit" --output json
```

**Representative output**:

```json
{
  "id": 7650,
  "title": "Sales Cockpit",
  "appId": 4812,
  "dashboardType": "dashboard",
  "createdAt": "2026-06-02 15:30:00",
  "createdBy": 151
}
```

**Common next steps**:

* Show dashboard details: `hbi dashboard show 7650 --app 4812 --output json`
* Create a chart inside the dashboard: `hbi element chart create --dashboard 7650 --app 4812 --dataset 3 --custom-title "Sales Trend" --show-chart-title bar`
* Export dashboard data: `hbi dashboard export-data 7650 --app 4812 --output json`

The two most common deeper trees are:

* YAML-driven create or update: `dashboard plan`
* theme resource management: `dashboard theme`

`plan` is for YAML-driven dashboard creation/update, and `theme` is for built-in or app-visible custom themes.

## `element`

**Purpose**: manage charts and page elements inside dashboards.

`element` itself is a second-level entrypoint. The common families are:

* `chart`
* `button`
* `filter`
* `container`
* `iframe`
* `image`
* `shape`
* `text`

**Minimal runnable example**:

```bash
# Create a bar chart
hbi element chart create --dashboard 7650 --app 4812 --dataset 3 --custom-title "Sales Trend" --show-chart-title bar --output json

# Create a table with content recognition (link/email/image)
hbi element chart create --dashboard 7650 --app 4812 --dataset 3 table --identify-link true --identify-email true --identify-image true --output json
```

**Representative output**:

```json
{
  "id": 12450,
  "chartType": "line",
  "dashboardId": 7650,
  "appId": 4812,
  "datasetId": 3,
  "createdAt": "2026-06-02 15:45:00"
}
```

**Common next steps**:

* Show chart details: `hbi element chart show 12450 --dashboard 7650 --app 4812 --output json`
* Query chart data: `hbi element chart query 12450 --dashboard 7650 --app 4812 --output json`
* Patch chart config: `hbi element chart patch 12450 --dashboard 7650 --app 4812 --config chart-config.json`

#### `--dimension` time function reference

The `--dimension` parameter on `chart create` accepts any [HQL expression](https://api.hengshi.com/function_reference.html), not just plain field names. For time bucketing, prefer calendar HQL functions over string-slicing patterns like `substring` / `date_format`.

**Time function comparison table:**

| Natural period | Cross-period function | Description |
| --- | --- | --- |
| `day({field})` | `dom({field})` | Day / day-of-month (use `dom` for cross-month comparison) |
| `month({field})` | `moy({field})` | Month / month-of-year (use `moy` for cross-year month comparison) |
| `quarter({field})` | `qoy({field})` | Quarter / quarter-of-year (use `qoy` for cross-year quarter comparison) |
| `week({field})` | `woy({field})` | Week / week-of-year (use `woy` for cross-year week comparison) |
| `year({field})` | `doy({field})` | Year / day-of-year |
| `trunc_month({field})` | — | Truncate to month, ignore day |

Cross-period functions (`moy` / `dom` / `dow` / `doy` / `woy` / `qoy`) return absolute sequential indices that do not reset at year/month boundaries, naturally enabling cross-year month, cross-month day, and cross-year quarter comparisons.

**Examples:**

```bash
# Cross-year month: compare month-of-year across year boundaries
hbi element chart create --dashboard 11 --app 22 line \
  --dataset 33 \
  --dimension "moy({created_at})" \
  --dimension "year({created_at})" \
  --measure "SUM({amount})"

# Cross-month day: compare day-of-month across month boundaries
hbi element chart create --dashboard 11 --app 22 line \
  --dataset 33 \
  --dimension "dom({created_at})" \
  --measure "SUM({amount})"
```

Full HQL function reference: <https://api.hengshi.com/function_reference.html>

You can also use `hbi dataset expression-rewrite --app <ID> --dataset <ID> --expression "..."` to validate and rewrite expressions.

If you are actually creating or updating elements, the most common trees are:

* charts: `element chart`
* filters: `element filter`
* containers: `element container`
* text blocks: `element text`

When creating an app-parameter filter, `--app` always identifies the app that owns the target dashboard. If the parameter belongs to another data app, pass both `--data-app <SOURCE_APP_ID>` and `--app-param <PARAM_ID>`. The equivalent YAML/JSON spec fields are `dataAppId` and `appParamId`; omit `--data-app` / `dataAppId` only when the parameter belongs to the target app.

For example, `element chart` commonly includes:

* `create` `update`
* `list` `show`
* `query`
* `export-data` `export-file`
* `patch`
* `delete`

## Where to drill down next

| Scenario | Start with |
| --- | --- |
| app lifecycle, import/export, move, or transfer | `app` |
| app parameters, shared dimensions, rules, subscriptions, and portal settings | `app param` `app dimension` `app rule` `app subscribe` `app portal` |
| folder tree management | `folder` |
| dashboard or report resources | `dashboard` |
| dashboard plans and themes | `dashboard plan` `dashboard theme` |
| charts and page elements | `element` / `element chart` / `element filter` / `element container` / `element text` |

When you need exact flags and examples, use that command tree's `--help` in the terminal.
