Get Admin Session
Get detailed information about a chat session including message history. Admins can view any session, but can only interact with sessions they have claimed.
Endpoint
Authentication
Required: Admin authentication token
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id |
integer | Yes | ID of the session to retrieve |
Response
Success (200 OK)
Returns the session with up to 200 most recent messages.
{
"id": 1,
"store_id": 5,
"admin_id": 2,
"status": "claimed",
"last_message_at": "2025-12-16T10:30:00Z",
"created": "2025-12-16T10:00:00Z",
"updated": "2025-12-16T10:30:00Z",
"store": {
"id": 5,
"name": "Tech Store",
"logo_url": "https://example.com/logo.jpg",
"email": "store@example.com"
},
"messages": [
{
"id": 123,
"session_id": 1,
"sender_type": "store",
"sender_id": 5,
"content": "Hello, I need help",
"attachment_url": "",
"attachment_type": "",
"status": "read",
"created": "2025-12-16T10:15:00Z",
"updated": "2025-12-16T10:20:00Z"
},
{
"id": 124,
"session_id": 1,
"sender_type": "admin",
"sender_id": 2,
"content": "How can I help you?",
"attachment_url": "",
"attachment_type": "",
"status": "delivered",
"created": "2025-12-16T10:16:00Z",
"updated": "2025-12-16T10:16:00Z"
}
]
}
Error Responses
Missing Session ID (400)
Invalid Session ID (400)
Session Not Found (404)
Session Belongs to Another Admin (403)
Note: This error occurs when trying to view a session that is claimed by a different admin. Admins can view unclaimed sessions, but once claimed, only the assigned admin can view it.
Unauthorized (401)
Example Request
curl -X GET "https://api.luxmart.site/v1/chat/admin/session/?session_id=1" \
-H "Authorization: Token your_admin_token"
Notes
- Returns up to 200 most recent messages in chronological order (oldest first)
- Store information is automatically included
- Admins can view unclaimed sessions (status = "open")
- Once a session is claimed, only the assigned admin can view it
- Messages are ordered by creation date ascending
- Closed sessions can still be viewed by the assigned admin