<span id="校验回调接收连接"></span>

# Verify a callback ingress connection

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

Verify a callback ingress connection.

```text
POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/ingress-connections/{connection_id}/test
```

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

## Before you call this API

Prepare a personal access token with access to the target workspace and the required action privileges. The path workspace must match X-Workspace-ID. Examples use jq. See [Common information](objects.md) for variables, objects, and states.

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

## Request body

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

```bash
curl -X POST "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/ingress-connections/$CONNECTION_ID/test" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  --data-binary "$(jq -n --argjson ASSOCIATION_VERSION "$ASSOCIATION_VERSION" --argjson CONFIG_VERSION "$CONFIG_VERSION" --arg CALLBACK_URL "$CALLBACK_URL" '
{
  "expected_association_version": $ASSOCIATION_VERSION,
  "expected_config_version": $CONFIG_VERSION,
  "callback_url": $CALLBACK_URL
}
')"
```

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

For callback only; not managed_stream or mail_polling. Telegram registers a Webhook with the provider; other platforms test channel configuration. Success enables the connection and increments its configuration version. Failure may also return HTTP 200 with an ok:false test result. Inspect the result before querying connection state.

| Fields | Type | Required | Description |
| --- | --- | --- | --- |
| `expected_association_version` | integer | Yes | association_version from the latest connection details; must be greater than 0. |
| `expected_config_version` | integer | Yes | config_version from the latest connection details; must be greater than 0. |
| `callback_url` | string | Conditional | For Telegram, the deployment's full HTTPS URL with a path exactly matching callback_path in details, without query or fragment. |

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

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

## Successful response

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

```json
{
  "code": 0,
  "data": {
    "ok": false,
    "status": "failed",
    "last_test_error": "示例测试拒绝"
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | Result object; see common object descriptions for fields. |

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

<span id="错误响应"></span>

## Error response

Handle HTTP status, business results, and error fields as described in [Errors and environments](objects.md#错误与环境). Read current state on source or version conflicts; do not automatically retry with a different identity, resource, or request ID.
