# Delete GitHub tool connection

Delete GitHub tool connections and associated credentials saved in the current workspace. The interface returns a disconnected status even if there is no current connection.

```text
DELETE https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/tools/github/connect
```

## Before you call

Prepare a personal access token and target workspace ID that has access to the target workspace.

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 `X-Workspace-ID` Header.

The request body of this interface must be empty.

## Request example

```bash
curl -X DELETE "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/tools/github/connect" \
  -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 | The current workspace ID. |

## Successful response

Returns `200` on success. After disconnecting, subsequent GitHub tool calls can no longer use the deleted connection credentials.

```json
{
  "code": 0,
  "data": {
    "tool_id": "moi.github.tools",
    "status": "disconnected",
    "requires_reconnect": false
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.tool_id` | string | GitHub built-in tool identifier. |
| `data.status` | string | `disconnected` after disconnection. |
| `data.requires_reconnect` | boolean | `false` after disconnection. |

## Error response

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

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `2`（`INVALID_ARGUMENT`）
  - Invalid workspace ID.
  - Check path parameters.
* - `401`
  - `6`（`UNAUTHENTICATED`）
  - Lack of valid identity credentials.
  - Check API Key.
* - `403`
  - `5`（`PERMISSION_DENIED`）
  - The current identity does not have permission to manage tool connections.
  - Check workspace authorization.
* - `503`
  - `15`（`UNAVAILABLE`）
  - The GitHub tool connection service or authorization dependency is temporarily unavailable.
  - Try again later.
```

## Follow-up operations

[Query tool tag](list-tool-tags.md), confirm that the target no longer appears.
