Update channel instance

Partially updates an already created channel instance. Fields not provided remain unchanged.

PATCH https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/channels/{provider}/instances/{instance_id}

Before you call

First query the channel instance details and confirm the instance to be updated. 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 the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through the X-Workspace-ID Header and also as workspace_id in the path.

  • $PROVIDER: Channel Provider ID, as provider in the path.

  • $INSTANCE_ID: Channel instance ID to update, as instance_id in the path.

channel_type must be provided consistent with the saved channel type.

Request example

curl -X PATCH "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/channels/$PROVIDER/instances/$INSTANCE_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "生产告警通道"
  }'

Path parameters

Parameters

Type

Is it required

Description

workspace_id

string

Yes

Workspace ID.

provider

string

Yes

Channel Provider ID.

instance_id

string

Yes

Channel instance ID.

Request body

Updatable channel_type, name, description, config, secrets, visibility and labels.

Parameters

Type

Is it required

Description

channel_type

string

No

Channel type in Provider; must be consistent with the saved type when provided.

name

string

No

Instance name.

description

string

No

Example description.

config

object

No

Non-sensitive configuration.

secrets

object

No

Keys and other sensitive configuration.

visibility

string

No

Visible range.

labels

object

No

Tag key-value pair.

Successful response

Returns 200 and the updated instance on success. The new key will not be echoed in the response; after updating the configuration or keys, re-perform the 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",
    "updated_at": "2026-08-18T01:00:00Z"
  }
}

The response fields are as follows.

Field

Type

Description

code

integer

0 on success.

data.id

string

Instance ID and workspace.

data.workspace_id

string

Instance ID and workspace.

data.provider

string

Provider, channel type and current status.

data.channel_type

string

Provider, channel type and current status.

data.status

string

Provider, channel type and current status.

data.name

string

Updated name, description, and non-sensitive configuration.

data.description

string

Updated name, description, and non-sensitive configuration.

data.config

object

Updated name, description, and non-sensitive configuration.

data.credential_ref

string

Credential reference, not clear text key.

data.updated_at

string

Last updated time, using RFC 3339 format.

Error response

{
  "code": 2,
  "message": "<错误信息>"
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

2INVALID_ARGUMENT

Invalid instance ID, provider, channel type, configuration, or key.

Check the path and make sure channel_type matches the saved type.

401

6UNAUTHENTICATED

Lack of valid identity credentials.

Check API Key.

403

5PERMISSION_DENIED

The current identity does not have permission to update the instance.

Check workspace authorization.

404

3NOT_FOUND

The instance does not exist or does not belong to the Provider in the path.

Check the Provider and Instance ID.

503

15UNAVAILABLE

Channel instance services or authorization dependencies are temporarily unavailable.

Try again later.

Follow-up operations

Test the created channel instance after updating the key or connection configuration.

Last updated on