<span id="读取连接器表字段"></span>

# Read connector table columns

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

database/table are required; schema is optional. Returns six columns fields, distinct from structured/v1 schema_snapshot and mapping-draft objects.


```http
POST https://api.moi.matrixorigin.cn/v5/connectors/db/schema
```

<span id="调用前准备"></span>

## Before you call this API

`BASE_URL` uses the product API prefix `https://api.moi.matrixorigin.cn/v5`. For a dedicated deployment, use its corresponding product API address.

[Prepare the connector and same-environment identity](objects.md#prepare). Example IDs, databases, and results are illustrative fixed values. Current source does not declare these six paths deprecated; public scope and actual deployment still require verification.

<span id="请求"></span>

## Request

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

```bash
curl --request POST \
  "$BASE_URL/connectors/db/schema" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data '{"connector_id": "source-connector", "database": "source_db", "schema": "analytics", "table": "orders"}'
```

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

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `connector_id` | string | Yes | Saved connector ID usable by the current identity. |
| `database` | string | Yes | Selected database name. |
| `schema` | string | No | Provide when database schemas need distinction. |
| `table` | string | Yes | Selected table name. |

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

<span id="成功响应"></span>

## Successful response

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

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "columns": [
      {
        "name": "record_id",
        "data_type": "BIGINT",
        "mapped_type": "bigint",
        "is_primary_key": true,
        "is_nullable": false,
        "is_auto_incr": true
      }
    ]
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success; HTTP 200 alone is insufficient. |
| `msg` | string | Response explanation. |
| `data` | object | [Legacy response object](objects.md#responses). |

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

<span id="错误与协议选择"></span>

## Errors and protocol selection

[Compare metadata protocols](protocol-comparison.md) before choosing a path. Parameter locations and response shapes are not interchangeable. See [Errors and empty results](objects.md#errors).
