Query database table leaf nodes

Paged query specifies the tables directly contained in the database.

POST https://moi.matrixorigin.cn/newmoi/catalog/database/table-leaves

Preparation before calling

First query the database list to obtain the database ID. Prepare the personal access token, target workspace ID, and database ID 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.

  • $DATABASE_ID: The database ID to be queried.

Request example

curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/database/table-leaves" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "database_id": '"$DATABASE_ID"',
    "page_size": 20
  }'

Request body

Parameter

Type

Required

Description

database_id

integer

Yes

Database ID, must be a positive integer.

page_size

integer

No

Single page return quantity.

page_token

string

No

The paging mark returned by the previous page response.

search

string

No

Table name filter value.

Successful response

Returns 200 on success. When next_page_token in the response has a value, use it to continue querying the next page; when there is no next page, this field may be omitted.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "items": [
      {
        "table_id": 101,
        "table_name": "orders",
        "database_id": 10,
        "created_at": "2026-08-01T09:00:00Z",
        "updated_at": "2026-08-01T09:00:00Z"
      }
    ],
    "total": 1
  }
}

The response fields are as follows.

Field

Type

Description

data.items

array

Current page table list.

data.items[].table_id

integer

Table ID.

data.items[].table_name

string

Table name.

data.items[].database_id

integer

ID of the database to which it belongs.

data.items[].created_at

string

Creation time.

data.items[].updated_at

string

Update time.

data.total

integer

The total number of matching tables.

data.next_page_token

string

Optional. Next page pagination token; may be omitted if there is no next page.

In field paths, [] means each item in an array. For example, data.items[].table_id is the table_id field of each item in data.items.

Error response

{
  "code": "ErrParamInvalid",
  "msg": "Invalid request parameter",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

ErrParamInvalid

The database ID, request body, or pagination tag is invalid.

Check request fields; only use pagination tags returned from the last response.

403

ErrForbidden

The current identity does not have permission to read the database or table.

Use credentials with read permissions.

500

ErrServer

The server failed to read the table list.

Try again later.

Last updated on