# Search selectable dashboard tables

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Search internal MatrixOne tables selectable by dashboards within current permissions, with keyword pagination. Subscribed databases are excluded.

```text
POST https://api.moi.matrixorigin.cn/v5/catalog/data-dashboard/table-search
```

## Before you call this API

Set `BASE_URL` to the product API prefix `https://api.moi.matrixorigin.cn/v5`. For private deployments, use the corresponding product API URL.

Prepare a personal access token with target Workspace access and table query privileges, plus its Workspace ID. `BASE_URL` includes the same environment's product prefix. `MOI_KEY` is the product credential and `WORKSPACE_ID` the Workspace ID. Example IDs/data are placeholders.

## Request body

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl --fail-with-body -sS -X POST "$BASE_URL/catalog/data-dashboard/table-search" \
  -H "X-API-Key: $MOI_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"search": "orders", "page_size": 50}'
```

Retain search conditions for the next page and set NEXT_PAGE_TOKEN to the actual previous response value.

```bash
curl --fail-with-body -sS -X POST "$BASE_URL/catalog/data-dashboard/table-search" \
  -H "X-API-Key: $MOI_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"search":"orders","page_size":50,"page_token":"'"$NEXT_PAGE_TOKEN"'"}'
```

:::::
:::::{tab-item} Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `search` | string | No | Whitespace-separated keywords; omission applies no keyword restriction. |
| `page_size` | integer | No | Items per page. Values ≤0 become 50; values above 100 become 100. |
| `page_token` | string | No | Previously returned next_page_token; omit for the first page. |

Keywords separately match Catalog name, database name, table name, description, or column information; every keyword must match. page_token is a canonical nonnegative decimal offset. Retain search conditions and continue using returned tokens; stop when next_page_token is empty.

:::::
::::::
:::::::

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "items": [
      {
        "table_id": 31,
        "table_name": "orders",
        "database_id": 10,
        "database_name": "sales",
        "catalog_id": 1,
        "catalog_name": "Default",
        "description": "订单",
        "matched_fields": [
          "table_name"
        ],
        "matched_columns": [],
        "metadata_match": true
      }
    ],
    "total": 1,
    "next_page_token": ""
  }
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success. |
| `msg` | string | OK on success. |
| `data.items` | object[] (array of objects) | Selectable tables on the current page. |
| `data.total` | integer | Total matches for this search within current permissions. |
| `data.next_page_token` | string | Next-page offset; an empty string means no next page. |
| `data.items[].table_id` | integer | Table ID. |
| `data.items[].table_name` | string | Table name. |
| `data.items[].database_id` | integer | Database ID. |
| `data.items[].database_name` | string | Database name. |
| `data.items[].catalog_id` | integer | Catalog ID。 |
| `data.items[].catalog_name` | string | Catalog name. |
| `data.items[].description` | string | Table description. |
| `data.items[].matched_fields` | string[] (array of strings) | Matched field name; columns indicates a column-information match. |
| `data.items[].matched_columns` | string[] (array of strings) | Matched column name. |
| `data.items[].metadata_match` | boolean | Whether metadata keyword conditions match. |

:::::
::::::
:::::::

## Error responses

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "ErrParamInvalid",
  "msg": "示例错误信息"
}
```

:::::
:::::{tab-item} Fields

| HTTP | code | Condition |
| --- | --- | --- |
| 400 | ErrParamInvalid | Invalid pagination token format. |
| 503 | ErrServiceUnavailable | Authorization dependencies unavailable; do not treat as no matches. |

Use actual returned code, msg, and diagnostic fields for identity, permission, and dependency failures. Error text may vary by language.

:::::
::::::
:::::::
