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

# Get messages

> Fetches messages sent to and received from a lead



## OpenAPI

````yaml get /leads/{leadId}/messages
openapi: 3.0.1
info:
  title: AttentPublicAPI
  version: '2024-05-17T21:09:13Z'
servers:
  - url: https://api.attent.app/v1
security: []
paths:
  /leads/{leadId}/messages:
    get:
      description: Fetches messages sent to and received from a lead
      parameters:
        - name: leadId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the lead to fetch messages for.
      responses:
        '200':
          description: Messages fetched successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      type: object
                      properties:
                        content:
                          type: object
                          properties:
                            text:
                              type: string
                              description: The message content.
                        createdAt:
                          type: string
                          format: date-time
                          description: >-
                            The date and time when the message was sent or
                            received.
                        owner:
                          type: string
                          description: >-
                            The owner of the message. This can be either
                            `"lead"` or `"user"`.
                      description: An array of messages sent to and received from the lead.
                example:
                  messages:
                    - content:
                        text: Hello, how can I help you?
                      createdAt: '2024-05-17T21:09:13Z'
                      owner: user
                    - content:
                        text: I would like to schedule a meeting.
                      createdAt: '2024-05-17T21:09:13Z'
                      owner: lead
      security:
        - api_key: []
components:
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````