API Endpoint
Endpoint:POST /api/agent/status
Content-Type: application/json
Authentication: Required (Token header: token or api_access_token)
Request Structure
cURL Example
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"Status is missing"- Required fieldstatusis missing"Agent ID is invalid"- Invalid agent ID format"Agent not found"- Agent with provided ID does not exist or belongs to different workspace
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 |
Soft Delete Mechanism
What is Soft Delete?
Soft delete means the agent record remains in the database but is marked as deleted. The agent is not physically removed from the database. Benefits:- Data Preservation: Historical data is maintained
- Audit Trail: Complete record of all agents and their history
- Recovery: Deleted agents can be restored
- Referential Integrity: Related records remain intact
How It Works
- Status Update: Agent
STATUSfield is set to2(deleted) - Visibility: Deleted agents are automatically excluded from:
- Agent lists
- Agent searches
- Agent selections
- Public agent listings
- Data Preservation: All agent data and related records remain in the database
What Happens When an Agent is Deleted
1. Agent Record
- Status is set to
2(deleted) - Agent becomes invisible in queries
- All agent data is preserved
2. Related Data
All related records remain in the database:- Agent configuration
- Knowledge base records
- Tools and sub-agents
- Calling numbers
- Denied words
- Dispositions
- Guardrails
- Metadata configurations
- Change history
3. External Services Cleanup
Millis AI Platform:- Agent is deleted from Millis AI platform
- Errors are logged but don’t prevent deletion
- Knowledge base is deleted from AI service
- Agent can no longer access knowledge base in AI service
Agent Status Values
| Status | Value | Description |
|---|---|---|
| Published | 1 | Agent is active and available for use |
| Deleted | 2 | Agent is soft-deleted (marked as deleted) |
| Unpublished | 3 | Agent is inactive but not deleted |
Restoring Deleted Agents
Deleted agents can be restored by updating their status back to1 (Published) or 3 (Unpublished).
Restore to Published
Restore to Unpublished
Important Notes
- Deletion is a soft delete - agent remains in database with status
2 - All related data (knowledge base, tools, configurations) is preserved
- External services (Millis AI, AI Service) are cleaned up during deletion
- Deleted agents are automatically excluded from all queries and listings
- Deleted agents can be restored by updating status to
1or3 - Complete audit trail is maintained for all deletions
- External service cleanup errors don’t prevent deletion from completing
- Knowledge base files remain in cloud storage (not automatically removed)

