Create channel instance¶
Creates a channel instance for the specified Provider. Sensitive configuration is only submitted in the request, and no clear text is returned in a successful response.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/channels/{provider}/instances
Before you call¶
Prepare a personal access token with access to the target workspace, the target workspace ID, and the channel provider ID.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: The workspace ID of the instance to be created, passed in theX-Workspace-IDheader, and asworkspace_idin the path.$PROVIDER: Channel Provider ID, asproviderin the path.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/channels/$PROVIDER/instances" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"channel_type": "<CHANNEL_TYPE>",
"name": "告警通道",
"config": {
"endpoint": "<ENDPOINT>"
},
"secrets": {
"token": "<TOKEN>"
}
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Workspace ID. |
|
string |
Yes |
Channel Provider ID. |
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The channel type within the Provider. |
|
string |
Yes |
Instance name. |
|
string |
No |
Example description. |
|
object |
No |
Non-sensitive configuration. |
|
object |
Required by channel type |
Keys and other sensitive configuration. |
|
string |
No |
Visible range. |
|
object |
No |
Tag key-value pair. |
Successful response¶
Returns 201 on success. data contains instance ID, provider, status, credential reference, and non-sensitive configuration; secrets in the request is not echoed. Successful saving does not mean that the external service connection is available, please perform a connection test.
{
"code": 0,
"data": {
"id": "inst_01",
"workspace_id": "ws_01",
"provider": "wecom",
"channel_type": "wecom_mail",
"name": "告警通道",
"status": "active",
"credential_ref": "cred_01",
"config": {
"endpoint": "https://example.com/hook"
},
"created_at": "2026-08-18T01:00:00Z",
"updated_at": "2026-08-18T01:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Instance ID and workspace. |
|
string |
Instance ID and workspace. |
|
string |
Provider and instance channel type. |
|
string |
Provider and instance channel type. |
|
string |
Instance name, description, and current status. |
|
string |
Instance name, description, and current status. |
|
string |
Instance name, description, and current status. |
|
string |
A reference to a saved credential, not a clear text key. |
|
string |
The callback path, capabilities, and associated tools returned when available. |
|
string[] |
The callback path, capabilities, and associated tools returned when available. |
|
string[] |
The callback path, capabilities, and associated tools returned when available. |
|
object |
Non-sensitive configuration and tags. |
|
object |
Non-sensitive configuration and tags. |
|
string |
Creation and last update times, using RFC 3339 format. |
|
string |
Creation and last update times, using RFC 3339 format. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid provider, channel type, configuration, key, or visibility scope. |
Use the channel type supported by this Provider and complete the corresponding |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity does not have permission to create channel instances. |
Check workspace authorization. |
|
|
Instance definition conflicts under the same Provider. |
Check the existing instance or change the instance configuration. |
|
|
Channel instance services or authorization dependencies are temporarily unavailable. |
Try again later. |
Follow-up operations¶
Test the created channel instance to check the connection.