Skip to content

Close Chat Session

Close an active chat session. Only admins can close sessions they have claimed.

Endpoint

POST /v1/chat/admin/close/

Authentication

Required: Admin authentication token

Authorization: Token <admin_token>

Request Body

{
  "session_id": 1
}

Parameters

Field Type Required Description
session_id integer Yes ID of the session to close

Response

Success (200 OK)

Returns the closed session object.

{
  "id": 1,
  "store_id": 5,
  "admin_id": 2,
  "status": "closed",
  "last_message_at": "2025-12-16T10:30:00Z",
  "closed_at": "2025-12-16T11:00:00Z",
  "created": "2025-12-16T10:00:00Z",
  "updated": "2025-12-16T11:00:00Z"
}

Error Responses

Missing Session ID (400)

{
  "error": "session_id is required"
}

Session Not Found or Not Assigned (403)

{
  "error": "Session not found or not assigned"
}

Session Already Closed (400)

{
  "error": "Session already closed"
}

Unauthorized (401)

{
  "error": "Unauthorized"
}

Example Request

curl -X POST "https://api.luxmart.site/v1/chat/admin/close/" \
  -H "Authorization: Token your_admin_token" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": 1
  }'

Notes

  • Only admins can close sessions
  • Admin must have claimed the session (session must be assigned to them)
  • Closing a session sets status to "closed" and records closed_at timestamp
  • WebSocket events are sent to both the store and all admins when a session is closed
  • Once closed, a session cannot be reopened (a new session must be created)