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

# List messages

> This endpoint lets you retrieve the messages for a specific conversation.

⚠️ This endpoint is paginated using cursor pagination. This means that in
order to get the next page of results, you need to provide the cursor
returned in the previous call.




## OpenAPI

````yaml /assets/openapi/openapi-bundled.yaml get /messages
openapi: 3.1.0
info:
  title: Partoo Rest API
  version: v2
  license:
    name: © Copyright Partoo
    url: https://www.partoo.co/en/gtu-api/
  x-logo:
    url: >-
      https://partoo-client-images.s3.amazonaws.com/logo-partoo-restapi-white.png
  description: >
    ## Introduction

    The Partoo Rest API allows you to automate all the actions that are possible
    to do in the Partoo Web Application.


    The Partoo Rest API can be used for many different purposes:
      - Create/update/delete your businesses & users if you are a client.
      - Create/subscribe/manage organizations, businesses & users if you are a reseller.
      - Retrieve data on businesses you have access to if you are a publisher.
      - ...
servers:
  - url: https://api.partoo.co/v2
    description: Production server
  - url: https://api.sandbox.partoo.co/v2
    description: Sandbox server (dev environment for clients & partners)
security:
  - ApiKeyAuth: []
paths:
  /messages:
    get:
      tags:
        - Messages
      summary: List messages
      description: >
        This endpoint lets you retrieve the messages for a specific
        conversation.


        ⚠️ This endpoint is paginated using cursor pagination. This means that
        in

        order to get the next page of results, you need to provide the cursor

        returned in the previous call.
      operationId: listMessages
      parameters:
        - name: conversation_id
          in: query
          schema:
            type: integer
            description: The id of the conversation
          required: true
        - $ref: '#/components/parameters/PerPage'
        - $ref: '#/components/parameters/Cursor'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                description: Response object
                type: object
                properties:
                  messages:
                    type: array
                    description: >-
                      The list of messages for a specific conversation,
                      paginated.
                    items:
                      $ref: '#/components/schemas/Message'
                  count:
                    $ref: '#/components/schemas/Count'
                  next_cursor:
                    $ref: '#/components/schemas/NextCursor'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
components:
  parameters:
    PerPage:
      in: query
      name: per_page
      schema:
        type: integer
        default: 30
        minimum: 1
        maximum: 100
      description: Number of items to return per page.
    Cursor:
      in: query
      name: cursor
      schema:
        type: string
      description: >
        The cursor identifiying the page of data to fetch.

        If no cursor is provided, the query will return the first page of data.

        A cursor for the next page of data is provided in the response of this
        request.
  schemas:
    Message:
      type: object
      title: Message
      properties:
        id:
          type: integer
          description: The id of the message.
        conversation_id:
          type: integer
          description: The id of the parent conversation.
        date:
          type: string
          description: |
            The date at which the message was sent or received, in the ISO 8601
            format (ex: "2023-01-31 16:22:17.327878+00:00").
          example: '2023-01-31 16:22:17.327878+00:00'
        content_type:
          $ref: '#/components/schemas/MessageContentType'
        sender_type:
          $ref: '#/components/schemas/SenderType'
        sender_label:
          type:
            - string
            - 'null'
          description: Name of the person sending the message
          example: Jane Doe
        status:
          $ref: '#/components/schemas/MessageStatus'
        is_deleted:
          type: boolean
          description: |
            If the message has been deleted by the consumer on the messaging
            channel (for now, only "Instagram" messages can be deleted).
          example: false
        is_automated:
          type: boolean
          description: |
            If the message was sent by a Partoo automation (chatbot, ...).
          example: false
        content:
          oneOf:
            - $ref: '#/components/schemas/TextMessageContent'
            - $ref: '#/components/schemas/ImageMessageContent'
            - $ref: '#/components/schemas/VideoMessageContent'
            - $ref: '#/components/schemas/AudioMessageContent'
            - $ref: '#/components/schemas/DocumentMessageContent'
            - $ref: '#/components/schemas/IgStoryReplyMessageContent'
            - $ref: '#/components/schemas/IgStoryMentionMessageContent'
            - $ref: '#/components/schemas/UnsupportedMessageContent'
            - $ref: '#/components/schemas/SolvingMessageContent'
            - $ref: '#/components/schemas/ReopeningMessageContent'
        user_id:
          type:
            - string
            - 'null'
          description: |
            For "User" messages sent via the Partoo application, the id of the
            user that sent the message.
        custom_channel:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/CustomChannelMessage'
          description: >-
            Data about the custom channel, this object is filled only if the
            messaging partner is `Custom`.
    Count:
      description: >
        Total number of results available for the filters and dimensions
        requested.
      type: integer
      example: 1
    NextCursor:
      type:
        - string
        - 'null'
      description: |
        The cursor to use in order to retrieve the next page of data.
        When all data have been fetched, the value is null.
    MessageContentType:
      type: string
      enum:
        - Text
        - Image
        - Video
        - Audio
        - Document
        - IgStoryReply
        - IgStoryMention
        - Unsupported
      description: >
        The type of the message:

        - "Text" describes a simple text message.

        - "Image" describes a message that only contains an image.

        - "IgStoryReply" (for "Instagram" conversations) describes a
        notification

        of reply to an Instagram story.

        - "IgStoryMention" (for "Instagram" conversations) describes a
        notification

        of a mention in an Instagram story.

        - "Unsupported" describes a message whose content is not supported.


        ⚠️ New values may be added to this enum without prior notice and without
        following the classic depreciation cycle.      

        It is up to you to gracefully handle the case where new values are
        added.         

        We recommend showing a "Unhandled content" placeholder to the user in
        place of the message ⚠️
    SenderType:
      type: string
      enum:
        - User
        - Consumer
        - Metadata
      description: >
        Describes the person that sent the Message:

        - "User" indicates that the message was sent as the Business.

        Such messages can be sent by a Partoo user, via API, or directly on the

        messaging platform.

        - "Consumer" indicates that the message was sent by a consumer, a client

        that wants to get in touch with the business.

        - "Metadata" is reserved for special messages that appear in the

        Partoo inbox. They only give contextual information about the
        conversation,

        and are not shown to the consumer.


        ⚠️ New values may be added to this enum without prior notice and without
        following the classic depreciation cycle.        

        It is up to you to gracefully handle the case where new values are
        added.       

        We recommend ignoring messages with unhandled sender_type ⚠️
    MessageStatus:
      type: string
      enum:
        - Sending
        - Success
        - Failed
      description: >
        The delivery status of the message.

        Messages send via Partoo are created with the status "Sending", and

        propagated to the messaging channel.

        If the message is sent successfully, the status is changed to "Success".

        If the messaging channel fails to send the message, the status changed
        to

        "Failed". A failed message can be retried using the [/retry
        endpoint](/api-reference/messages/retry-send-message).
    TextMessageContent:
      title: Text
      type: string
      description: The text of the message.
    ImageMessageContent:
      title: Image
      type: string
      format: url
      description: The url of the image.
    VideoMessageContent:
      type: object
      title: Video
      properties:
        url:
          type: string
          format: url
          description: The url of the video.
        file_name:
          type:
            - string
            - 'null'
          description: Name of the video file.
    AudioMessageContent:
      type: object
      title: Audio
      properties:
        url:
          type: string
          format: url
          description: The url of the audio.
        file_name:
          type:
            - string
            - 'null'
          description: Name of the audio file.
    DocumentMessageContent:
      type: object
      title: Document
      properties:
        url:
          type: string
          format: url
          description: The url of the document.
        file_name:
          type:
            - string
            - 'null'
          description: Name of the document file.
    IgStoryReplyMessageContent:
      type: object
      title: IgStoryReply
      properties:
        url:
          type: string
          format: url
          description: The url of the story that received the reply.
        content:
          type: string
          description: Text of the reply, or url of the image.
        content_type:
          type: string
          enum:
            - Image
            - Text
          description: The type of content of ther reply.
        id:
          type: string
          description: The Instagram ID of the story.
    IgStoryMentionMessageContent:
      type: string
      title: IgStoryMention
      format: url
      description: The url of the story mentionned.
    UnsupportedMessageContent:
      type: object
      title: Unsupported
      properties:
        type:
          type: string
          enum:
            - video
            - audio
            - unknown
    SolvingMessageContent:
      type: string
      enum:
        - Solving
      title: Solving (Metadata)
    ReopeningMessageContent:
      type: string
      enum:
        - Reopening
      title: Reopening (Metadata)
    CustomChannelMessage:
      type: object
      title: Message
      properties:
        external_message_id:
          type: string
          description: The unique id of the message in your system.
  responses:
    '401':
      description: You are not authenticated
      content:
        application/json:
          schema:
            description: Error that occurs when you are not authenticated
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authentication:
                    type: string
                    default: User not authenticated
    '403':
      description: |
        You are not allowed to perform this action
      content:
        application/json:
          schema:
            description: >
              Error that occurs when you are authenticated but you are trying to
              perform an action you are not allowed to perform
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authorization:
                    type: string
                    default: Operation not allowed
  securitySchemes:
    ApiKeyAuth:
      description: >
        The authentication system on Partoo API is using API Key that should be
        put in the header of the request (the name of the header is `x-APIKey`).
        An api_key is linked to a user. This user's role will give you different
        access level to the API features.
      type: apiKey
      in: header
      name: x-APIKey

````