# View table information

View the field definitions and row numbers of the table without returning the data rows in the table.

```text
POST https://moi.matrixorigin.cn/newmoi/meta/table/info
```

## Preparation before calling

Prepare your personal access token, workspace ID, database name, and table name. You can first [query the table in the database](list-database-tables.md) to confirm the object name.

The examples below use `$AI_STUDIO_API_KEY`, `$WORKSPACE_ID`, `$DATABASE`, and `$TABLE`.

## Request body

Replace caller-specific values in the example with actual values.

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>db_name</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>The name of the database where the table is located.</dd></div>
<div class="mo-api-field"><dt><code>table_name</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>The name of the table to be queried.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```{raw} html
<p class="mo-api-example-label">Request example</p>
```
```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/meta/table/info" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d "{\"db_name\":\"$DATABASE\",\"table_name\":\"$TABLE\"}"
```
:::
::::
## Successful response


```json
{
  "code": 200,
  "data": {
    "columns": [{"name": "id", "data_type": "INT", "nullable": "NO", "default_value": "", "key_type": "PRI", "comment": ""}],
    "total": 1,
    "rows": 42
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `200` on success. |
| `data.columns` | array | List of column definitions for the table. |
| `data.columns[].name` | string | Column name. |
| `data.columns[].data_type` | string | Data type. |
| `data.columns[].nullable` | string | Whether to allow null values; `YES` means allowed, `NO` means not allowed. |
| `data.columns[].default_value` | string | Default value; empty string if not set. |
| `data.columns[].key_type` | string | Key type. |
| `data.columns[].comment` | string | Column remarks. |
| `data.total` | integer | Number of columns. |
| `data.rows` | integer | The number of rows in the table, the data row itself is not returned. |

In this document, `[]` after a type denotes an array. In a field path, `[]` denotes each item in an array; for example, `data.columns[].name` is the `name` field of each item in the `data.columns` array.


When you need to view only fields, use [View table column list](list-table-columns.md); when you need to view table creation statements, use [View table creation statements](get-table-ddl.md).

## Error response

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">integer or string</span></dt><dd>Error code or status.</dd></div>
<div class="mo-api-field"><dt><code>message</code><span class="mo-api-field__type">string</span></dt><dd>Error message.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```{raw} html
<p class="mo-api-example-label">Error response example</p>
```
```json
{
  "code": 404,
  "message": "对象不存在"
}
```
:::
::::
## Follow-up operations

[View table column list](list-table-columns.md) when returning to the list.
