---
orphan: true
---

# Batch query table information

Batch query table definitions and metadata by table ID.

```text
POST https://moi.matrixorigin.cn/newmoi/catalog/table/multi_info
```

## Preparation before calling

First [query the object](list-database-objects.md) in the database to obtain the table ID. Prepare a list of personal access tokens, target workspace IDs, and table IDs that have access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: Target workspace ID, passed through `X-Workspace-ID` Header.
- `$TABLE_ID`: The table ID to be queried.

## Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/table/multi_info" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": ['"$TABLE_ID"']
  }'
```

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | integer[] | Yes | List of table IDs to query. |

`[]` after a type means an array. For example, `integer[]` is an array of integers.

## Successful response

On success, `200` and information about each table are returned.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "tables": [
      {
        "name": "orders",
        "columns": [],
        "create_sql": "CREATE TABLE orders (...)"
      }
    ]
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.tables` | array | Queryed table information. |
| `data.tables[].name` | string | Table name. |
| `data.tables[].lines` | integer | Number of table rows. |
| `data.tables[].size` | integer | Table size. |
| `data.tables[].columns` | array | Column definition. |
| `data.tables[].create_sql` | string | Create table SQL. |
| `data.tables[].stats` | array | Column statistics. |

## Error response

```json
{
  "code": "ErrServer",
  "msg": "服务器内部错误",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - Invalid table ID list.
  - Check `ids`.
* - `403`
  - `ErrForbidden`
  - The current identity does not have permission to read some or all of the tables.
  - Use credentials with read permissions.
* - `500`
  - `ErrServer`
  - The server failed to read table information.
  - Try again later.
```
