<span id="更新消息接收连接"></span>

# Update an ingress connection

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

Update an ingress connection.

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

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

## Before you call this API

Prepare a personal access token with access to the target workspace and permission for the action. The path workspace must match X-Workspace-ID. Examples use jq. See [common information](objects.md) for variables, objects, and states.

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

## Request body

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

```bash
curl -X PATCH "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/ingress-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 ASSOCIATION_VERSION "$ASSOCIATION_VERSION" --argjson CONFIG_VERSION "$CONFIG_VERSION" '
{
  "expected_association_version": $ASSOCIATION_VERSION,
  "expected_config_version": $CONFIG_VERSION,
  "enabled": false
}
')"
```

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

Submit at least one of enabled, agent_model, or managed_stream. Slack updates accept only app_token/bot_token, Feishu only app_secret, and WeCom only secret. Do not resubmit App ID/Bot ID from the creation object. config_version increases on success. Reread before the next operation.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expected_association_version` | integer | Yes | association_version from the latest connection details; must be greater than 0. |
| `expected_config_version` | integer | Yes | config_version from the latest connection details; must be greater than 0. |
| `enabled` | boolean | No | Enable or disable; omission retains the value. |
| `agent_model` | string | No | Only agent targets support model changes. |
| `managed_stream` | object | No | Only managed mode supports updating the secrets allowed by the platform. |

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

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

## Successful response

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

```json
{
  "code": 0,
  "data": {
    "id": "ingress_example",
    "workspace_id": "workspace_example",
    "target": {
      "kind": "agent",
      "workspace_id": "workspace_example",
      "id": "agent_example"
    },
    "provider": "slack",
    "channel_type": "slack_app",
    "receive_mode": "managed_stream",
    "agent_model": "model_example",
    "association_version": 1,
    "connected_by_user_id": "user_example",
    "enabled": false,
    "account_identity": "slack:app:app_example",
    "config_version": 2,
    "desired_state": "disabled",
    "observed_state": "stopped",
    "created_at": "2026-11-11T00:00:00Z",
    "updated_at": "2026-11-11T00:00:00Z"
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | Result object; see common objects for fields. |

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

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

## Error responses

Handle the HTTP status, business result, and error fields as described in [errors and environments](objects.md#错误与环境). On source or version conflicts, read the current state. Do not automatically replace identities, resources, or request IDs and retry.
