Import and Create Agent
Import and Create Agent
Supports uploading a .bot file and importing it as an Agent under an organization.
You can use this endpoint to upload a .bot file and import it as an Agent under an organization. After a successful import, an API Key is created automatically, but version management is disabled by default for that key.
Request Method
POST
Request URL
https://api.${endpoint}/v1/org/agent/import
Request Authentication
Uses account-level DevKey / DevSecret Basic authentication, and requires the calling account to have organization Agent creation permission.
Request
Request Example
curl -X POST 'https://api.${endpoint}/v1/org/agent/import' \
-H 'Authorization: Basic ${BASIC_TOKEN}' \
-F 'file=@/path/to/agent.bot' \
-F 'org_id=p-xxxx' \
-F 'custom_name=Imported Agent' \
-F 'enable_api=true' \
-F 'group_id=group-xxxx'
curl -X POST 'https://api.${endpoint}/v1/org/agent/import' \
-H 'Authorization: Basic ${BASIC_TOKEN}' \
-F 'file=@/path/to/agent.bot' \
-F 'org_id=p-xxxx' \
-F 'custom_name=Imported Agent' \
-F 'enable_api=true' \
-F 'group_id=group-xxxx'
This code block in the floating window
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Basic ${BASIC_TOKEN} | The Basic Token obtained by Base64-encoding DevKey:DevSecret. |
| Content-Type | multipart/form-data | File upload form. |
Request Parameters (Form Data)
| Parameter | Type | Description | required |
|---|---|---|---|
| file | File | .bot file. MultiAgent files are not supported. |
true |
| org_id | String | Organization ID. | true |
| custom_name | String | Custom Agent name after import. | false |
| enable_api | Boolean | Whether to attempt to enable the API, defaults to true. If the plan does not support the API, the import still succeeds and returns api_enabled=false. |
false |
| group_id | String | Join the specified Agent group after a successful import. | false |
Response
Response Example
{
"code": 0,
"message": "OK",
"data": {
"agent_id": "bot-xxxx",
"name": "Imported Agent",
"bot_type": "AGENT",
"api_key": "app-xxxx",
"api_enabled": true,
"version_manage_enabled": false,
"warning": null
}
}
{
"code": 0,
"message": "OK",
"data": {
"agent_id": "bot-xxxx",
"name": "Imported Agent",
"bot_type": "AGENT",
"api_key": "app-xxxx",
"api_enabled": true,
"version_manage_enabled": false,
"warning": null
}
}
This code block in the floating window
Success Response
| Field | Type | Description |
|---|---|---|
| agent_id | String | The Agent ID after import. |
| name | String | Agent name. |
| bot_type | String | Agent type: Agent, FlowAgent, LoopAgent, Audio. |
| api_key | String | The automatically created API Key, returned only once. This key does not have publishing permission; if you need to publish, you must create a Key manually. |
| api_enabled | Boolean | Whether the API is enabled. |
| version_manage_enabled | Boolean | Whether version management is allowed; disabled by default on import. |
| warning | String | Import warning. |
Failure Response
| Field | Type | Description |
|---|---|---|
| code | Integer | Error code. |
| message | String | Error details. |
Status Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Parameter error |
| 401 | Unauthorized |
| 403 | Insufficient permissions |
| 429 | Too many requests |
| 500 | Server error |
