API Endpoint
Endpoint:POST /api/agent/createagentorupdate
Content-Type: multipart/form-data
Authentication: Required (Token header: token or api_access_token)
Request Structure
The endpoint accepts amultipart/form-data request with the following structure. Include agent_id in basic_details to perform an update:
basic_details[chatbot_image]- Chatbot image file (replaces existing)- Knowledge base files (PDF, DOC, DOCX, XLSX, CSV) - Up to 3 files, max 10MB each
cURL Example
basic_details[agent_id] is required. All other fields are optional and only provided fields will be updated.
Response
Success Response
Status Code:200 OK
Error Responses
422 - Validation Error
Status Code:422 Unprocessable Entity
"Agent ID is missing"- Required fieldagent_idis missing inbasic_details"Agent ID is invalid"- Invalid agent ID format"Agent not found"- Agent with provided ID does not exist"Basic details are required"-basic_detailsobject is missing
401 - Authentication Error
Status Code:401 Unauthorized
500 - Server Error
Status Code:500 Internal Server Error
Error Codes
| Status Code | Error Code | Description |
|---|---|---|
| 200 | - | Success |
| 401 | AUTH_REQUIRED | Authentication required - Missing or invalid token |
| 401 | AUTH_INVALID | Invalid authentication token or session expired |
| 422 | VALIDATION_ERROR | Validation failed - Check required fields and data format |
| 422 | MISSING_FIELD | Required field missing |
| 422 | INVALID_FORMAT | Invalid data format or type |
| 422 | AGENT_NOT_FOUND | Agent with provided ID does not exist |
| 500 | SERVER_ERROR | Internal server error |
Update Behavior
Partial Updates
- Only fields you provide will be updated
- Fields not included in the request remain unchanged
- You can update specific sections without affecting others
Behavior Fields Merging
When updating behavior fields (tone, style, instruction_sensitivity):
- If you provide only one field, the others remain unchanged
- Example: Updating only
tonepreserves existingstyleandinstruction_sensitivity
Knowledge Base Updates
- New files are added to existing knowledge base
- Existing files remain unless explicitly removed
- Tools and sub-agents can be enabled/disabled
- Agent training status is reset when knowledge base is updated
Tools and Sub-agents
- Existing tools/sub-agents are matched by ID
- You can enable/disable existing tools/sub-agents
- New tools/sub-agents can be added
- Tools not included in the update remain unchanged
Additional Update Endpoints
Update Agent Status
Endpoint:POST /api/agent/status
Request:
- 1 (Published): Agent is active and available for use
- 2 (Deleted): Agent is soft-deleted
- 3 (Unpublished): Agent is inactive but not deleted
Update Knowledge Base Status
Endpoint:POST /api/agent/updateKnowledgeBaseStatus
Request:
Update Denied Word and Disposition Status
Endpoint:POST /api/agent/updateDeniedWordAndDisposition
Request:
Important Notes
agent_idis required inbasic_detailsfor all updates- All configuration sections are optional - only include what you want to update
- Partial updates are supported - only provided fields are updated
- File uploads replace existing files (chatbot image) or add new files (knowledge base)
- Knowledge base updates reset agent training status
- Updates are atomic - if any part fails, all changes are rolled back
- All updates are tracked in change history for audit purposes

