Skip to main content

Agent Service API

Authentication

# Get token
POST /api/auth/token
Content-Type: application/json

{
"username": "admin@bytedesk.com",
"password": "password"
}

# Response
{
"access_token": "eyJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600
}

Agent Management

Get Agent List

GET /api/agent/list
Authorization: Bearer {token}

# Response
{
"code": 200,
"data": [
{
"id": "agent_id",
"nickname": "Agent Name",
"avatar": "https://example.com/avatar.jpg",
"status": "online",
"role": "agent"
}
]
}

Update Agent Status

PUT /api/agent/status
Authorization: Bearer {token}
Content-Type: application/json

{
"status": "online" // online, offline, busy, away
}

# Response
{
"code": 200,
"message": "Status updated successfully"
}

Get Agent Statistics

GET /api/agent/stats
Authorization: Bearer {token}

# Response
{
"code": 200,
"data": {
"total_chats": 100,
"avg_response_time": 30,
"satisfaction_rate": 4.5,
"online_duration": 28800
}
}

Error Codes

CodeDescription
200Success
400Bad Request
401Unauthorized
403Forbidden
404Not Found
500Server Error