Skip to content

Get My Sessions

Get all chat sessions claimed by the authenticated admin (excluding closed sessions).

Endpoint

GET /v1/chat/admin/sessions/my/

Authentication

Required: Admin authentication token

Authorization: Token <admin_token>

Response

Success (200 OK)

Returns an array of sessions with their last message.

{
  "data": [
    {
      "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"
      },
      "last_message": {
        "id": 123,
        "session_id": 1,
        "sender_type": "store",
        "sender_id": 5,
        "content": "Hello, I need help",
        "attachment_url": "",
        "attachment_type": "",
        "status": "sent",
        "created": "2025-12-16T10:30:00Z"
      }
    }
  ],
  "count": 1
}

Response Fields

Field Type Description
data array Array of session objects
count integer Total number of sessions

Each session object includes: - Session details (id, store_id, admin_id, status, last_message_at, created, updated) - Store information (id, name, logo_url, email) - Last message object with all message fields (if available)

Error Responses

Unauthorized (401)

{
  "error": "Unauthorized"
}

Example Request

curl -X GET "https://api.luxmart.site/v1/chat/admin/sessions/my/" \
  -H "Authorization: Token your_admin_token"

Notes

  • Returns only sessions where admin_id matches the authenticated admin
  • Excludes closed sessions (status != "closed")
  • Results are ordered by last_message_at descending (most recent activity first)
  • Each session includes the last message preview for quick context
  • Store information is automatically included for each session