Rollback Agent Version
Rollback Agent Version
Supports rolling back a specified historical Agent version and saving it as a new version, with the option to publish immediately.
This endpoint authenticates with the target Agent's own API Key, and can only be called by an Agent that has version management permission enabled.
Request Method
POST
Request URL
https://api.${endpoint}/v1/agent/version/rollback
Request Authentication
For details, see the authentication description in the API Overview. Please use the target Agent's API Key as the token.
Request
Request Example
curl -X POST 'https://api.${endpoint}/v1/agent/version/rollback' \
-H 'Authorization: Bearer ${token}' \
-H 'Content-Type: application/json' \
-d '{
"version": "v1",
"new_version": "v3",
"release": true,
"version_desc": "Rollback to stable prompt"
}'
curl -X POST 'https://api.${endpoint}/v1/agent/version/rollback' \
-H 'Authorization: Bearer ${token}' \
-H 'Content-Type: application/json' \
-d '{
"version": "v1",
"new_version": "v3",
"release": true,
"version_desc": "Rollback to stable prompt"
}'
This code block in the floating window
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer ${token} | Use the target Agent's API Key for call authentication. |
| Content-Type | application/json | Request body format. |
Request Parameters (Body Parameters)
| Parameter | Type | Description | required |
|---|---|---|---|
| version | String | The source version number to roll back. | true |
| new_version | String | The new version number saved after rollback; auto-generated when empty. | false |
| release | Boolean | Whether to publish immediately after the rollback is saved. | false |
| version_desc | String | New version description. | false |
Response
Response Body
{
"code": 0,
"message": "OK",
"data": {
"source_version": "v1",
"new_version": "v3",
"created": true,
"released": true,
"warnings": []
}
}
{
"code": 0,
"message": "OK",
"data": {
"source_version": "v1",
"new_version": "v3",
"created": true,
"released": true,
"warnings": []
}
}
This code block in the floating window
Success Response
| Field | Type | Description |
|---|---|---|
| source_version | String | The source version number of the rollback. |
| new_version | String | The new version number that was saved. |
| created | Boolean | Whether a new version was created. |
| released | Boolean | Whether it has been published. |
| warnings | String[] | Rollback notes. |
Failure Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| message | string | Error message. |
Status Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Parameter error |
| 401 | Unauthorized |
| 403 | Insufficient permissions, or the API Key does not have version management permission enabled |
| 429 | Too many requests |
| 500 | Server error |
