---
url: /v7.0/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`

### View Export Permissions

Use `hbi app show <APP_ID> --output json` to view app details. The `effectivePermissions` object in the result contains the current user's export permissions. Chart details use the same fields.

**Permission field example**:

```json
{
  "effectivePermissions": {
    "exportData": false,
    "exportStatic": true
  }
}
```

| Field | Description |
| --- | --- |
| `exportData` | Whether data export is allowed, subject to both the system's data export policy and the app's export permissions |
| `exportStatic` | Whether static files such as PNG, PDF, and PPT can be exported |

Exports must also satisfy the product license, device, and restrictions of the specific export entry point. The server checks permissions for each export. Ordinary folder app lists, including results from `hbi app list`, do not return `effectivePermissions`. Read app details to check export permissions.

Automation scripts should use `effectivePermissions` to check export permissions. If the object or a required field is missing, do not perform the corresponding export. `options.publishConfig.downloadPermitted` is only the saved export-switch value; it cannot determine whether the current user may export. Update existing scripts to use the permission fields and refresh cached app and chart responses. Use matching HBI, SDK, frontend, and backend versions.

`effectivePermissions` is read-only. HBI does not include it in publish, republish, template, or app-update requests.

### Publish an App

When first publishing an app with `hbi app publish`, the export switch is set as follows:

| Existing configuration | Export switch |
| --- | --- |
| `options.publishConfig.downloadPermitted` is set | Retain the saved enabled or disabled state |
| `publishConfig` exists, but `downloadPermitted` is not set | Disabled |
| `publishConfig` is absent and the app is a self-service query app | Enabled by default |
| `publishConfig` is absent and the app is another type | Disabled by default |

Republishing with `hbi app republish` retains the saved export switch. For publishing settings, see [App Publishing](app-publish.md#export-data).

### Sense 7.0: AUTO data-app modeling

When creating a data app (`--app-type data-app`), set `--modeling-type manual|auto`. Omitting the option retains `MANUAL`; the option is invalid for other app types and cannot be changed through `app update` after creation.

```bash
hbi app create "Sales data preparation" \
  --app-type data-app \
  --area data-mart \
  --modeling-type auto
```

The top-level `modelingType` returned by `app show` and `app list` is the effective mode. Treat a missing or `null` value from an older response as `MANUAL`. An AUTO data app can be a `data-use` source, but not a `data-extend` source. This capability is available only in Sense 7.0.

Charts and metrics in an automatic modeling (`AUTO`) data package can reference any dataset in the package. In a manual modeling (`MANUAL`) data package, they can reference only the main table and related tables in an existing data model. The server still validates and infers AUTO cross-dataset relationships through common dimensions.

### Sense 7.0: shared-dimension mappings

**Dataset roles and HQL role syntax have meaning only in data packages with automatic modeling (`modelingType=AUTO`).** They do not apply to manual modeling (`MANUAL`) or other contexts; do not rely on `roleName` to distinguish relationships.

Simple single-field shared-dimension mappings still use `--field <dataset_id>:<field_name>`. For composite fields, key roles, or dataset roles, pass an object containing a `mappings` array to `app dimension create` / `update` through `--file` or `--value`:

```json
{
  "mappings": [
    {
      "datasetId": 1,
      "fields": ["tenant", "id"],
      "keyRole": "UNIQUE",
      "roleName": null
    },
    {
      "datasetId": 2,
      "fields": ["tenant_code", "customer_id"],
      "keyRole": "REFERENCE",
      "roleName": "customer"
    }
  ]
}
```

`fields` preserves order, and every mapping must have the same field count. `roleName` is optional; when present, it must be 1–64 UTF-16 code units of Unicode letters, numbers, or underscores. Mapping order is the server fallback when no role is explicit. A description-only update retains local mappings and excludes inherited mappings; an inherited-only dimension has no local mapping to write and the update is rejected. Do not use `--field` to replace an existing composite, key-role, or role mapping.

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`.

For a Sense 7.0 AUTO data app, the server derives a chart's datasets from its actual expression references. Do not maintain or override a `datasetIds` list in chart configuration.

Charts in an automatic modeling data package can reference any dataset in the package. Charts in a manual modeling data package can reference only the main table and related tables in an existing data model. AUTO cross-dataset calculations still require valid relationships through common dimensions.

**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.
