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

# List the messages of every chat of a contact

> Answers with the messages of the contact's chats the caller can see, newest first, each carrying its `chatId`. Reads the 50 most recently updated chats, closed ones included, and test chats only with `[with]=tests`. Paginated by `limit`/`offset`, 30 per page by default, with `hasMore`; it does not count the total.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/contacts/{contactId}/messages
openapi: 3.1.0
info:
  title: Leadstaker API
  version: 1.0.0
  description: Public REST API for Leadstaker projects.
servers:
  - url: https://n-api.leadstaker.com
    description: Production
security: []
tags:
  - name: Calls
    description: >-
      Phone calls made through the telephony app or posted from another phone
      system, with their recording, transcript and AI summary.
  - name: Chats
    description: Conversations with a contact over a connected channel.
  - name: Contacts
    description: >-
      People inside a project, holding the custom field values collected about
      them.
  - name: Deals
    description: Opportunities moving through a pipeline, each tied to a contact.
  - name: Field groups
    description: Sections that organize custom fields in the interface.
  - name: Fields
    description: >-
      Custom field definitions, both the built-in ones and the ones a project
      creates.
  - name: Leads
    description: >-
      Chatbot conversations captured in a project, with the answers given and
      where the visitor came from.
  - name: Loss reasons
    description: The catalog of reasons a deal can be marked as lost.
  - name: Messages
    description: Individual messages inside a chat, inbound and outbound.
  - name: Notes
    description: >-
      Free text attached to a contact or a deal, written by a user, an agent, or
      the system.
  - name: Pipelines
    description: Ordered sets of stages a deal travels through.
  - name: Stages
    description: Steps inside a pipeline, including the built-in open and closed ones.
  - name: Tags
    description: Free-form labels attached to deals.
  - name: Tasks
    description: >-
      Follow-up activities with a due date, attached to a deal and assigned to a
      user.
  - name: Touchpoints
    description: >-
      Each time a lead reached the business, traced to the ad, campaign, channel
      or form that brought it.
paths:
  /v1/contacts/{contactId}/messages:
    get:
      tags:
        - Messages
      summary: List the messages of every chat of a contact
      description: >-
        Answers with the messages of the contact's chats the caller can see,
        newest first, each carrying its `chatId`. Reads the 50 most recently
        updated chats, closed ones included, and test chats only with
        `[with]=tests`. Paginated by `limit`/`offset`, 30 per page by default,
        with `hasMore`; it does not count the total.
      operationId: getContactsByContactIdMessages
      parameters:
        - name: contactId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
        - name: '[limit]'
          in: query
          required: false
          description: How many records to return, at most 250.
          schema:
            type: integer
            minimum: 1
            maximum: 250
        - name: '[offset]'
          in: query
          required: false
          description: How many records to skip.
          schema:
            type: integer
            minimum: 0
        - name: '[with]'
          in: query
          required: false
          description: '`tests` also reads the contact''s test chats.'
          schema:
            type: string
            minLength: 1
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          minLength: 1
                        sender:
                          type: object
                          properties:
                            type:
                              type: string
                              minLength: 1
                            id:
                              type: string
                              minLength: 1
                            name:
                              type: string
                              minLength: 1
                            automation:
                              type: object
                              properties:
                                workflowId:
                                  type: string
                                  minLength: 1
                                executionId:
                                  type: string
                                  minLength: 1
                              required:
                                - workflowId
                                - executionId
                              additionalProperties: false
                              description: >-
                                On a SYSTEM sender: the workflow run that sent
                                it, when an automation did.
                          required:
                            - type
                          additionalProperties: false
                        timestamp:
                          type: string
                          format: date-time
                        status:
                          type: string
                          enum:
                            - PENDING
                            - SENT
                            - RECEIVED
                            - READ
                            - PLAYED
                            - FAILED
                        content:
                          anyOf:
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: TEXT
                                content:
                                  type: object
                                  properties:
                                    text:
                                      type: string
                                      minLength: 1
                                    selectedButton:
                                      type: string
                                      minLength: 1
                                  required:
                                    - text
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: IMAGE
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: VIDEO
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                        isAnimated:
                                          type: boolean
                                          default: false
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: AUDIO
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                      required:
                                        - url
                                        - fileId
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: DOCUMENT
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                        filename:
                                          type: string
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: STICKER
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                        isAnimated:
                                          type: boolean
                                          default: false
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: CONTACT
                                content:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                      minLength: 1
                                    phones:
                                      type: array
                                      items:
                                        type: string
                                    emails:
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                        format: email
                                    urls:
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                        format: uri
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: LOCATION
                                content:
                                  type: object
                                  properties:
                                    latitude:
                                      type: number
                                    longitude:
                                      type: number
                                    name:
                                      type: string
                                    address:
                                      type: string
                                  required:
                                    - latitude
                                    - longitude
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: REACTION
                                content:
                                  type: object
                                  properties:
                                    value:
                                      type: string
                                  required:
                                    - value
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: TEMPLATE
                                content:
                                  type: object
                                  properties:
                                    templateId:
                                      type: string
                                      minLength: 1
                                    variables:
                                      type: array
                                      items:
                                        type: object
                                        properties:
                                          name:
                                            type: string
                                            minLength: 1
                                          value:
                                            type: string
                                            minLength: 1
                                        required:
                                          - name
                                          - value
                                        additionalProperties: false
                                  required:
                                    - templateId
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: URL
                                content:
                                  type: object
                                  properties:
                                    text:
                                      type: string
                                      minLength: 1
                                    showPreview:
                                      type: boolean
                                  required:
                                    - text
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                        readBy:
                          type: object
                          properties:
                            type:
                              type: string
                              minLength: 1
                            id:
                              type: string
                              minLength: 1
                            name:
                              type: string
                              minLength: 1
                            at:
                              type: string
                              format: date-time
                          required:
                            - type
                            - at
                          additionalProperties: false
                        deletedAt:
                          type: string
                          format: date-time
                        editedId:
                          type: string
                          minLength: 1
                        repliedId:
                          type: string
                          minLength: 1
                        forwardedId:
                          type: string
                          minLength: 1
                        error:
                          type: string
                          description: >-
                            A FAILED message's error, as the provider or the API
                            gave it.
                        chatId:
                          type: string
                          minLength: 1
                      required:
                        - id
                        - type
                        - sender
                        - timestamp
                        - status
                        - chatId
                      additionalProperties: false
                  reactions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          minLength: 1
                        sender:
                          type: object
                          properties:
                            type:
                              type: string
                              minLength: 1
                            id:
                              type: string
                              minLength: 1
                            name:
                              type: string
                              minLength: 1
                            automation:
                              type: object
                              properties:
                                workflowId:
                                  type: string
                                  minLength: 1
                                executionId:
                                  type: string
                                  minLength: 1
                              required:
                                - workflowId
                                - executionId
                              additionalProperties: false
                              description: >-
                                On a SYSTEM sender: the workflow run that sent
                                it, when an automation did.
                          required:
                            - type
                          additionalProperties: false
                        timestamp:
                          type: string
                          format: date-time
                        status:
                          type: string
                          enum:
                            - PENDING
                            - SENT
                            - RECEIVED
                            - READ
                            - PLAYED
                            - FAILED
                        content:
                          anyOf:
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: TEXT
                                content:
                                  type: object
                                  properties:
                                    text:
                                      type: string
                                      minLength: 1
                                    selectedButton:
                                      type: string
                                      minLength: 1
                                  required:
                                    - text
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: IMAGE
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: VIDEO
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                        isAnimated:
                                          type: boolean
                                          default: false
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: AUDIO
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                      required:
                                        - url
                                        - fileId
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: DOCUMENT
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                        filename:
                                          type: string
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: STICKER
                                content:
                                  type: object
                                  properties:
                                    caption:
                                      type: string
                                    media:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                          format: uri
                                        mimeType:
                                          type: string
                                          minLength: 1
                                        fileId:
                                          type: string
                                          minLength: 1
                                        isAnimated:
                                          type: boolean
                                          default: false
                                      required:
                                        - url
                                      additionalProperties: false
                                  required:
                                    - media
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: CONTACT
                                content:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                      minLength: 1
                                    phones:
                                      type: array
                                      items:
                                        type: string
                                    emails:
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                        format: email
                                    urls:
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                        format: uri
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: LOCATION
                                content:
                                  type: object
                                  properties:
                                    latitude:
                                      type: number
                                    longitude:
                                      type: number
                                    name:
                                      type: string
                                    address:
                                      type: string
                                  required:
                                    - latitude
                                    - longitude
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: REACTION
                                content:
                                  type: object
                                  properties:
                                    value:
                                      type: string
                                  required:
                                    - value
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: TEMPLATE
                                content:
                                  type: object
                                  properties:
                                    templateId:
                                      type: string
                                      minLength: 1
                                    variables:
                                      type: array
                                      items:
                                        type: object
                                        properties:
                                          name:
                                            type: string
                                            minLength: 1
                                          value:
                                            type: string
                                            minLength: 1
                                        required:
                                          - name
                                          - value
                                        additionalProperties: false
                                  required:
                                    - templateId
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: URL
                                content:
                                  type: object
                                  properties:
                                    text:
                                      type: string
                                      minLength: 1
                                    showPreview:
                                      type: boolean
                                  required:
                                    - text
                                  additionalProperties: false
                              required:
                                - type
                                - content
                              additionalProperties: false
                        readBy:
                          type: object
                          properties:
                            type:
                              type: string
                              minLength: 1
                            id:
                              type: string
                              minLength: 1
                            name:
                              type: string
                              minLength: 1
                            at:
                              type: string
                              format: date-time
                          required:
                            - type
                            - at
                          additionalProperties: false
                        deletedAt:
                          type: string
                          format: date-time
                        editedId:
                          type: string
                          minLength: 1
                        repliedId:
                          type: string
                          minLength: 1
                        forwardedId:
                          type: string
                          minLength: 1
                        error:
                          type: string
                          description: >-
                            A FAILED message's error, as the provider or the API
                            gave it.
                        chatId:
                          type: string
                          minLength: 1
                      required:
                        - id
                        - type
                        - sender
                        - timestamp
                        - status
                        - chatId
                      additionalProperties: false
                  hasMore:
                    type: boolean
                  limit:
                    type: number
                  offset:
                    type: number
                required:
                  - data
                  - reactions
                  - hasMore
                  - limit
                  - offset
                additionalProperties: false
              example:
                data:
                  - id: 6716d2a57e63cc0015b9f4d1
                    chatId: 6713cc481f52bb0014a7d3e9
                    type: TEXT
                    sender:
                      type: CONTACT
                      id: 6712a4d95b38ee0011c9f2b4
                      name: Maria Andrade
                    timestamp: '2026-01-15T09:31:40.000Z'
                    status: RECEIVED
                    content:
                      type: TEXT
                      content:
                        text: Oi! Vocês atendem no sábado?
                reactions: []
                hasMore: false
                limit: 30
                offset: 0
        '401':
          description: Missing or invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    Error:
      type: object
      required:
        - errorCode
        - message
        - status
      properties:
        errorCode:
          type: string
        message:
          type: string
        status:
          type: integer
        errors:
          type: array
          items:
            type: object
            required:
              - field
              - code
              - message
            properties:
              field:
                type: string
              code:
                type: string
              message:
                type: string
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.