Test the created channel instance¶
Verify the current credentials and connection configuration of the saved channel instance.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/channels/{provider}/instances/{instance_id}/test
Before you call¶
First query the channel instance details and confirm the instance to be tested. Prepare a personal access token with access to the target workspace, target workspace ID, channel provider ID, and instance ID.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed through theX-Workspace-IDHeader and also asworkspace_idin the path.$PROVIDER: Channel Provider ID, asproviderin the path.$INSTANCE_ID: Channel instance ID to test, asinstance_idin the path.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/channels/$PROVIDER/instances/$INSTANCE_ID/test" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Workspace ID. |
|
string |
Yes |
Channel Provider ID. |
|
string |
Yes |
Channel instance ID. |
Successful response¶
Returns 200 on success. The test uses the current saved credentials and configuration and updates the instance’s most recent test information.
{
"code": 0,
"data": {
"instance": {
"id": "inst_01",
"workspace_id": "ws_01",
"provider": "wecom",
"channel_type": "wecom_mail",
"name": "告警通道",
"status": "active"
},
"ok": true,
"status": "passed",
"last_test_status": "passed",
"last_tested_at": "2026-08-18T01:00:00Z"
}
}
When the external connection test fails but the test request is processed normally, the interface still returns 200:
{
"code": 0,
"data": {
"instance": {
"id": "inst_01",
"provider": "wecom"
},
"ok": false,
"status": "failed",
"last_test_status": "failed",
"last_test_error": "<错误信息>",
"error_code": "<ERROR_CODE>",
"error_stage": "<STAGE>",
"provider_error_code": "<PROVIDER_CODE>",
"provider_error_message": "<PROVIDER_MESSAGE>",
"error_category": "<CATEGORY>",
"suggestion": "<SUGGESTION>",
"last_tested_at": "2026-08-18T01:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
object |
An insensitive projection of the instance under test. |
|
boolean |
Whether the connection test passed. |
|
string |
This and the latest test status. |
|
string |
This and the latest test status. |
|
string |
The performer and request ID returned when available. |
|
string |
The performer and request ID returned when available. |
|
string |
Error message when the test fails. |
|
string |
The error code, stage, and category of the service classification. |
|
string |
The error code, stage, and category of the service classification. |
|
string |
The error code, stage, and category of the service classification. |
|
string |
Error message returned by Provider; returned when available. |
|
string |
Error message returned by Provider; returned when available. |
|
string |
Actionable fix suggestion; returned when available. |
|
string |
Test time, using RFC 3339 format. |
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Provider, instance ID, saved configuration, or credentials are not available. |
Check the path; update configuration or resave credentials if necessary. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity does not have permissions for the test instance, or the credential access is denied. |
Check workspace and provider side permissions. |
|
|
The instance does not exist or does not belong to the Provider in the path. |
Check the Provider and Instance ID. |
|
|
Channel instance services or test dependencies are temporarily unavailable. |
Try again later. |
Follow-up operations¶
When the connection fails Update channel instance, then retest.