Import Agent Version
Import Agent Version
Supports uploading a .bot file to replace the current Agent configuration and save it as a new version.
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/import
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/import' \
-H 'Authorization: Bearer ${token}' \
-F 'file=@/path/to/agent.bot' \
-F 'versionDesc=Update prompt and tools'
curl -X POST 'https://api.${endpoint}/v1/agent/version/import' \
-H 'Authorization: Bearer ${token}' \
-F 'file=@/path/to/agent.bot' \
-F 'versionDesc=Update prompt and tools'
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 | multipart/form-data | File upload form. |
Request Parameters (Form Data)
| Parameter | Type | Description | required |
|---|---|---|---|
| file | File | .bot file. |
true |
| versionDesc | String | Version description. | false |
Response
Response Body
{
"code": 0,
"message": "OK",
"data": {
"botId": "bot-xxxx",
"botType": "Agent",
"version": "v2",
"warning": null
}
}
{
"code": 0,
"message": "OK",
"data": {
"botId": "bot-xxxx",
"botType": "Agent",
"version": "v2",
"warning": null
}
}
This code block in the floating window
Success Response
| Field | Type | Description |
|---|---|---|
| botId | String | Target Agent ID. |
| bot_type | String | Agent type: Agent, FlowAgent, LoopAgent, Audio. |
| version | String | The saved version number, which also becomes the current version. |
| warning | String | Import warning message; null if none. |
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 |
