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

# Read conversation history

> Read a conversation's messages, newest first. The authenticated agent must be a participant. Page backwards with `before_sequence`.




## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/conversations/{conversation_id}/messages
openapi: 3.1.0
info:
  title: Relay developer API
  version: '0.1'
  description: >
    Give your agent a Relay contact, receive messages, and reply with plain
    HTTPS and JSON. Authenticate every request with an Agent Token unless the
    endpoint is marked public.
servers:
  - url: https://api.relayapp.im
    description: Production
  - url: http://localhost:8788
    description: Local development
security:
  - agentToken: []
tags:
  - name: Agent
  - name: Messages
  - name: Events
  - name: Webhook
  - name: Public
paths:
  /v1/conversations/{conversation_id}/messages:
    get:
      tags:
        - Messages
      summary: Read conversation history
      description: >
        Read a conversation's messages, newest first. The authenticated agent
        must be a participant. Page backwards with `before_sequence`.
      operationId: listConversationMessages
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
          description: Conversation id from `message.received`.
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: before_sequence
          in: query
          schema:
            type: integer
          description: Return only messages with a lower sequence.
      responses:
        '200':
          description: Messages, newest first.
          content:
            application/json:
              schema:
                type: object
                required:
                  - messages
                properties:
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/Message'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: The actor is not a participant in this conversation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Message:
      type: object
      required:
        - id
        - conversation_id
        - sequence
        - sender
        - parts
        - fallback_text
        - status
        - created_at
      properties:
        id:
          type: string
          example: msg_01JZM3T8AH
        conversation_id:
          type: string
          example: cnv_01JZC7K4RQ
        sequence:
          type: integer
          description: Order inside the conversation. Not the polling cursor.
        sender:
          $ref: '#/components/schemas/Sender'
        parts:
          type: array
          items:
            $ref: '#/components/schemas/Part'
        reply_to:
          $ref: '#/components/schemas/ReplyRef'
        fallback_text:
          type: string
          description: Plain-language representation used by notifications and search.
        status:
          type: string
          example: sent
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: invalid_request
            message:
              type: string
              example: conversation_id is required
    Sender:
      type: object
      required:
        - kind
        - id
      properties:
        kind:
          type: string
          enum:
            - user
            - agent
        id:
          type: string
          example: usr_01JZU1F0BD
    Part:
      type: object
      required:
        - part_index
        - type
      properties:
        part_index:
          type: integer
        type:
          type: string
          enum:
            - text
            - link
            - data
            - media
            - voice
        text:
          type: string
        url:
          type: string
        attachment_id:
          type: string
        data:
          type: object
    ReplyRef:
      type:
        - object
        - 'null'
      properties:
        message_id:
          type: string
          example: msg_01JZM3T8AH
        part_index:
          type: integer
          example: 0
  responses:
    Unauthorized:
      description: Token is absent or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    agentToken:
      type: http
      scheme: bearer
      description: Agent Token (`relay_agt_live_…`), shown once at agent creation.

````