# Delete an agent team

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

Delete a team and revoke its associated incoming connections.


```http
DELETE https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agent-teams/{team_id}
```

## Before you call this API

Set `BASE_URL` to the product API prefix `https://api.moi.matrixorigin.cn/v5`. For private deployments, use the corresponding product API URL.

[Prepare product identity and object identifiers in the same environment](objects.md#prepare).

## Request

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

```bash
curl --request DELETE \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agent-teams/$TEAM_ID?expected_version=1" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"
```

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

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | Path | string | Yes | Current Workspace ID, consistent with the product identity and request headers in the same environment. |
| `team_id` | Path | string | Yes | Team ID from the team list or creation response. |
| `expected_version` | Queries | integer | Yes | Current team version; a positive integer. |

Use the current team version. Deletion cleans up team member references and associated incoming connections, and handles managed credentials and Ownership transactionally. Retain errors and read back after failure. Immediate external-platform disconnection or cancellation of running tasks is not guaranteed. Success still returns a team object with deleted status, not 204.

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

## Successful response

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

```json
{
  "code": 0,
  "data": {
    "id": "team-example",
    "workspace_id": "workspace-example",
    "owner_user_id": "user-example",
    "name": "资料整理团队",
    "status": "deleted",
    "version": 3,
    "membership_version": 2,
    "created_at": "2026-11-12T01:00:00Z",
    "updated_at": "2026-11-12T01:00:00Z",
    "description": "整理与核对资料"
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | [Corresponding response object](objects.md#responses). |

HTTP200. Returns the [corresponding object](objects.md#responses); confirm writes with the corresponding read operation.

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

## Error responses

[Errors and concurrency handling](lifecycle.md#errors) distinguishes parameter, version, member/conversation state, and admission failures.
