<span id="批量删除智能体产物"></span>

# Batch delete agent artifacts

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

Mark specified artifact versions deleted and detach the Catalog file mounts resolved for this operation.


```http
POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agent-artifacts/batch-delete
```

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

## Before you call this API

`BASE_URL` uses the product API prefix `https://api.moi.matrixorigin.cn/v5`. For a dedicated deployment, use its corresponding product API address.

[Prepare identity, volume privileges, and version references](objects.md#prepare).

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

## Request

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

```bash
curl --request POST \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agent-artifacts/batch-delete" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data '{"items":[{"artifact_id":"artifact-example","version":1},{"artifact_id":"artifact-unavailable","version":1}]}'
```

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

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | Path | string | Yes | Workspace ID in the current environment. |
| `items` | Body | array (array of references) | No | Up to 100 items. Omitted/null/empty array selects no artifacts. |
| `items[].artifact_id` | Body | string | Yes | Artifact ID for this item. |
| `items[].version` | Body | integer | Yes | Positive integer version for this item. |

Confirm target references and impact before execution. HTTP 200 still requires checking succeeded/failed per item. Deletion detaches the current mount and decrements file references; it does not guarantee immediate physical removal, removal of other mounts, or successful repeated deletion. Read results before repeating after an overall error or timeout.

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

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

## Successful response

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

```json
{
  "code": 0,
  "data": {
    "succeeded": [
      {
        "artifact_id": "artifact-example",
        "version": 1
      }
    ],
    "failed": [
      {
        "artifact_id": "artifact-unavailable",
        "version": 1,
        "reason": "not_found"
      }
    ]
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success; batch operations still require checking each item. |
| `data` | object | [Corresponding response object](objects.md#responses). |

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

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

## Error response

[Errors and result confirmation](boundaries.md#errors) distinguishes overall failures, item failures, and invisible sources.
