預檢 Agent 匯入檔案
預檢 Agent 匯入檔案
支援預檢 .bot 檔案是否可匯入,不寫入業務資源。
可以透過該 API,預檢 .bot 檔案是否可匯入。預檢只會解析與安全掃描檔案,不寫入 Agent、API Key、技能、資料組或插件關係。
請求方式
POST
調用地址
https://api.${endpoint}/v1/org/agent/import/precheck
調用驗證
使用帳號級 DevKey / DevSecret 的 Basic 驗證,並要求調用帳號具備組織 Agent 建立權限。
請求
請求範例
curl -X POST 'https://api.${endpoint}/v1/org/agent/import/precheck' \
-H 'Authorization: Basic ${BASIC_TOKEN}' \
-F 'file=@/path/to/agent.bot' \
-F 'org_id=p-xxxx'
curl -X POST 'https://api.${endpoint}/v1/org/agent/import/precheck' \
-H 'Authorization: Basic ${BASIC_TOKEN}' \
-F 'file=@/path/to/agent.bot' \
-F 'org_id=p-xxxx'
此代碼塊在浮窗中顯示
請求標頭
| 欄位 | 類型 | 說明 |
|---|---|---|
| Authorization | Basic ${BASIC_TOKEN} | 使用 DevKey:DevSecret Base64 後的 Basic Token。 |
| Content-Type | multipart/form-data | 檔案上傳表單。 |
請求參數(Form Data)
| 參數 | 類型 | 說明 | required |
|---|---|---|---|
| file | File | .bot 檔案。 |
true |
| org_id | String | 組織 ID。 | true |
回應
回應範例
{
"code": 0,
"message": "OK",
"data": {
"valid": true,
"error_message": null,
"export_type": "BOT",
"bot_type": "Agent",
"name": "Imported Agent",
"logo": "https://cdn.example.com/agent.png",
"introduction": "Agent introduction",
"format_version": "1.0"
}
}
{
"code": 0,
"message": "OK",
"data": {
"valid": true,
"error_message": null,
"export_type": "BOT",
"bot_type": "Agent",
"name": "Imported Agent",
"logo": "https://cdn.example.com/agent.png",
"introduction": "Agent introduction",
"format_version": "1.0"
}
}
此代碼塊在浮窗中顯示
成功回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| valid | Boolean | 檔案是否可匯入。 |
| error_message | String | 無法匯入時的錯誤訊息。 |
| export_type | String | 匯出檔案類型。 |
| bot_type | String | Agent 類型:Agent、FlowAgent、LoopAgent、Audio。 |
| name | String | 檔案內資源名稱。 |
| logo | String | 圖示 URL。 |
| introduction | String | 簡介。 |
| format_version | String | 檔案格式版本。 |
失敗回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| code | Integer | 錯誤碼。 |
| message | String | 錯誤詳情。 |
狀態碼
| 狀態碼 | 說明 |
|---|---|
| 200 | 成功 |
| 400 | 參數錯誤 |
| 401 | 未授權 |
| 403 | 權限不足 |
| 429 | 請求過於頻繁 |
| 500 | 伺服器錯誤 |
