Delete channel instance

Delete a channel instance and its associated credentials. After deletion, the instance can no longer be used to send messages or receive callbacks.

DELETE 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 deleted. 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: The channel instance ID to delete, as instance_id in the path.

Request example

curl -X DELETE "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"

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.

Successful response

Returns 200 and the deleted instance snapshot on success. This operation deletes the associated credentials and cannot be restored through the instance.

{
  "code": 0,
  "data": {
    "id": "inst_01",
    "workspace_id": "ws_01",
    "provider": "wecom",
    "channel_type": "wecom_mail",
    "name": "告警通道",
    "status": "active",
    "credential_ref": "cred_01"
  }
}

The response fields are as follows.

Field

Type

Description

code

integer

0 on success.

data.id

string

The ID and workspace of the deleted instance.

data.workspace_id

string

The ID and workspace of the deleted instance.

data.provider

string

Provider, channel type and status before deletion.

data.channel_type

string

Provider, channel type and status before deletion.

data.status

string

Provider, channel type and status before deletion.

data.name

string

A reference to the instance name and deleted credentials.

data.credential_ref

string

A reference to the instance name and deleted credentials.

Error response

{
  "code": 3,
  "message": "channel instance not found"
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

2INVALID_ARGUMENT

Invalid provider or instance ID.

Check path parameters.

401

6UNAUTHENTICATED

Lack of valid identity credentials.

Check API Key.

403

5PERMISSION_DENIED

The current identity does not have the permission to delete 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

To continue using this Provider, please Create channel instance.

Last updated on