Delete agent version¶
Remove a disabled and non-default version. This version cannot be restored after deletion.
DELETE https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/agents/{agent_id}/versions/{version}
Preparation before calling¶
First query the agent version and confirm the version number to be deleted. Prepare a personal access token with access to the target workspace, target workspace ID, agent ID, and version number.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed through theX-Workspace-IDHeader and asworkspace_idin the path.$AGENT_ID: Target agent ID, asagent_idin the path.$VERSION: The version number to delete, asversionin the path.
Only deactivated and non-default versions can be deleted.
Request example¶
curl -X DELETE "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/versions/$VERSION" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID. |
|
string |
Yes |
Agent ID. |
|
string |
Yes |
The version number to delete. |
Successful response¶
Returns 200 on success. When data.deleted was true, the version was deleted.
{
"code": 0,
"data": {
"deleted": true
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
boolean |
When |
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The path parameter is invalid, or the version is still the default version and has not been deactivated. |
Set other runnable versions as default before deactivating the target version. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current caller does not have permission to update the agent. |
Check the agent authorization in the workspace. |
|
|
The agent or version does not exist. |
Query the version list first. |
|
|
Version service, operation record service or authorization dependency are temporarily unavailable. |
Try again later. |
Follow-up operations¶
Query the agent version, confirm that the target no longer appears.