> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roostedhr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Chat Messages

> Retrieves a paginated list of messages in a chat. Supports cursor-based pagination for infinite scroll.

<Info>
  This endpoint uses cursor-based pagination for infinite scroll. Pass `last_seen_id` with the ID of the last message from the previous page to fetch the next set of results. Omit it for the first page.
</Info>


## OpenAPI

````yaml api-reference/v01.12.00/openapi-v01.12.00.json GET /workers/{id}/chats/{chat_id}/messages
openapi: 3.0.0
info:
  title: Roosted
  version: 0.1.12
  contact:
    name: Support
    url: https://support.roostedhr.com/support/home
    email: support@roostedhr.com
  description: |-
    Enterprise API

    Sandbox keys and Production keys are requested from support
servers:
  - url: https://api.roostedhr.com/api/1_12
  - url: https://sandbox.roostedhr.com/api/1_12
security:
  - X-API-KEY: []
tags:
  - name: Announcements
  - name: Areas
  - name: Clients
  - name: Company
  - name: Configuration
  - name: Events
  - name: Locations
  - name: Payroll Groups
  - name: Rate Cards
  - name: Shifts
  - name: Skillsets
  - name: Time Tracking
  - name: Wage Rules
  - name: Workers
paths:
  /workers/{id}/chats/{chat_id}/messages:
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: Worker ID
      - schema:
          type: string
        name: chat_id
        in: path
        required: true
        description: Chat ID
    get:
      tags:
        - Workers
      summary: Get Chat Messages
      description: >-
        Retrieves a paginated list of messages in a chat. Supports cursor-based
        pagination for infinite scroll.
      operationId: get-chat-messages
      parameters:
        - schema:
            type: string
          in: query
          name: last_seen_id
          description: >-
            ID of the last message from the previous page. Omit for the first
            page.
        - schema:
            type: integer
            default: 20
          in: query
          name: limit
          description: Maximum number of messages to return per page.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    description: List of chat messages.
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Message ID.
                        message:
                          type: string
                          description: Message content.
                        sender_id:
                          type: string
                          description: ID of the message sender.
                        sender_name:
                          type: string
                          description: Name of the message sender.
                        date_created:
                          type: string
                          format: date-time
                          description: Timestamp when the message was sent.
                        read:
                          type: string
                          description: Whether the message has been read.
                  has_more:
                    type: boolean
                    description: >-
                      Whether there are more messages available beyond this
                      page.
              examples:
                Success:
                  value:
                    messages:
                      - id: rxsVGOYHC9u
                        message: Hello there
                        sender_id: '5'
                        sender_name: Chris Davis
                        date_created: '2024-01-05T17:10:00.000Z'
                        read: '1'
                      - id: HavJuiLxDiR
                        message: Hi, how are you?
                        sender_id: '12'
                        sender_name: Jane Smith
                        date_created: '2024-01-05T17:11:00.000Z'
                        read: '0'
                    has_more: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Invalid limit parameter:
                  value:
                    code: WRK-3500
                    error: Invalid limit parameter
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Invalid or missing API key:
                  value:
                    code: ATH-100
                    error: Invalid or missing API key
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Insufficient permissions to manage chats:
                  value:
                    code: WRK-3200
                    error: Insufficient permissions to manage chats
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Worker not found:
                  value:
                    code: WRK-300
                    error: Worker not found
                Chat not found:
                  value:
                    code: WRK-3400
                    error: Chat not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Failed to send message:
                  value:
                    code: WRK-3300
                    error: Failed to send message
components:
  securitySchemes:
    X-API-KEY:
      name: X-API-KEY
      type: apiKey
      in: header

````