<span id="删除插件账号连接"></span>

# Delete a plugin account connection

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

Delete a plugin account connection using its current version.

```text
DELETE https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/plugin-connections/{connection_id}
```

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

## Before you call this API

Prepare the target workspace ID and a personal access token with access to the resource and the required action privileges. Use actual resource identifiers for `workspace_id` and `connection_id` in the path and also set `X-Workspace-ID`. Examples use `jq` to construct JSON; install it first. See [Common objects and inputs](objects.md#input-identifiers) for environment-variable sources.

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

## Request body

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

```bash
curl -X DELETE "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/plugin-connections/$CONNECTION_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  --data-binary "$(jq -n --argjson CONNECTION_VERSION "$CONNECTION_VERSION" '
{
  "expected_version": $CONNECTION_VERSION
}
')"
```

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

First remove bindings to this connection from the current user's plugin installations. Disconnect managed sessions and finish cleanup first. Include the JSON version precondition rather than sending an empty DELETE. Check the list after success to confirm removal. Repeated deletion is not guaranteed successful.

| Fields | Type | Required | Description |
| --- | --- | --- | --- |
| `expected_version` | integer | Yes | Current connection or installation version; must be greater than 0. |

JSON objects reject unknown fields, duplicate keys, and multiple consecutive objects. Total request body size must not exceed 1 MiB.

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

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

## Successful response

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

```json
{
  "code": 0,
  "data": {
    "status": "deleted"
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | Data returned by this operation. |
| `data.status` | string | Current state; interpret using this page's conditions and common objects. |

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

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

## Error response

Handle numeric business-error `code`, `message`, and `details.reason` separately from authorization-layer string codes. See [Errors and states](objects.md#error-responses). On a state or version conflict, read the current resource first; do not automatically change identifiers or retry writes.
