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

# Get messages from a chat

> List visible Messages and group-history events in a Chat.



## OpenAPI

````yaml /api-reference/openapi.mint.yaml get /v1/chats/{chatId}/messages
openapi: 3.1.0
info:
  title: Relay API
  version: 1.0.0
  description: >-
    Create conversations between users and agents.


    Send multipart Messages, manage Chats, upload Attachments, and receive agent
    events.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://api.relayapp.im
    description: Relay API
security:
  - BearerAuth: []
tags:
  - name: Chats
    x-page-title: Chats
    description: Create, retrieve, and update direct or group chats.
  - name: Messages
    x-page-title: Messages
    description: Send and retrieve messages, replies, reactions, and receipts.
  - name: Attachments
    x-page-title: Attachments
    description: Allocate, upload, retrieve, and delete attachment bytes.
  - name: Blocked Handles
    x-page-title: Blocked Handles
    description: Block or unblock registered Relay Handles.
  - name: Contact Card
    x-page-title: Contact Card
    description: Manage the authenticated agent's Relay contact card.
  - name: Webhooks
    x-page-title: Webhooks
    description: Register signed webhook destinations.
  - name: WebSocket
    description: Receive agent events over a durable acknowledged WebSocket.
paths:
  /v1/chats/{chatId}/messages:
    get:
      tags:
        - Messages
      summary: Get messages from a chat
      description: List visible Messages and group-history events in a Chat.
      operationId: getMessages
      parameters:
        - name: chatId
          in: path
          required: true
          description: Unique identifier of the chat
          schema:
            type: string
            format: uuid
        - name: cursor
          in: query
          description: Pagination cursor from previous next_cursor response
          schema:
            type: string
        - name: limit
          in: query
          description: Maximum number of messages to return
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
      responses:
        '200':
          description: Messages retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessagesResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    GetMessagesResult:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          description: List of messages
          items:
            $ref: '#/components/schemas/Message'
        next_cursor:
          type:
            - string
            - 'null'
          description: |
            Cursor for fetching the next page of results.
            Null if there are no more results to fetch.
            Pass this value as the `cursor` parameter in the next request.
    Message:
      type: object
      required:
        - id
        - chat_id
        - is_from_me
        - delivery_status
        - created_at
        - updated_at
        - is_system_message
      properties:
        id:
          type: string
          description: Unique identifier for the message
          format: uuid
        chat_id:
          type: string
          description: ID of the chat this message belongs to
          format: uuid
        from:
          type:
            - string
            - 'null'
          description: Sender Relay Handle.
        from_handle:
          description: The sender of this message as a full handle object
          oneOf:
            - $ref: '#/components/schemas/ChatHandle'
            - type: 'null'
        parts:
          type:
            - array
            - 'null'
          description: Message parts in order (text, media, and link)
          items:
            oneOf:
              - $ref: '#/components/schemas/TextPartResponse'
              - $ref: '#/components/schemas/MediaPartResponse'
              - $ref: '#/components/schemas/LinkPartResponse'
              - $ref: '#/components/schemas/SystemPartResponse'
        reply_to:
          oneOf:
            - $ref: '#/components/schemas/ReplyTo'
            - type: 'null'
        is_from_me:
          type: boolean
          description: Whether this message was sent by the authenticated user
        delivery_status:
          $ref: '#/components/schemas/DeliveryStatus'
        created_at:
          type: string
          format: date-time
          description: When the message was created
        updated_at:
          type: string
          format: date-time
          description: When the message was last updated
        sent_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the message was sent
        delivered_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the message was delivered
        read_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the message was read
        deliveries:
          type: array
          items:
            $ref: '#/components/schemas/MessageDelivery'
          description: >-
            Per-recipient Delivered and Read truth for direct and group Chats.
            Relay derives this because it controls every recipient endpoint.
        is_system_message:
          type: boolean
          description: Whether this timeline item is a visible Chat event.
        system_event:
          oneOf:
            - $ref: '#/components/schemas/SystemEvent'
            - type: 'null'
    ErrorResponse:
      type: object
      required:
        - error
        - success
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
        success:
          type: boolean
          description: Always false for error responses
        trace_id:
          type: string
          description: Unique trace ID for request tracing and debugging
    ChatHandle:
      type: object
      required:
        - id
        - handle
        - joined_at
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for this handle
        handle:
          type: string
          description: Relay Handle.
        status:
          type:
            - string
            - 'null'
          description: Participant status
          enum:
            - active
            - left
            - removed
          default: active
        joined_at:
          type: string
          format: date-time
          description: When this participant joined the chat
        left_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When they left (if applicable)
        is_me:
          type:
            - boolean
            - 'null'
          description: Whether this handle is the authenticated caller.
        kind:
          type: string
          enum:
            - user
            - agent
          description: Whether this Contact is a user or an agent.
        display_name:
          type:
            - string
            - 'null'
          description: Current Contact display name.
        avatar_url:
          type:
            - string
            - 'null'
          format: uri
          description: Current Contact avatar URL.
    TextPartResponse:
      type: object
      description: A text message part
      required:
        - type
        - value
        - reactions
      properties:
        type:
          type: string
          enum:
            - text
          description: Indicates this is a text message part
        value:
          type: string
          description: The text content
        mention:
          type:
            - string
            - 'null'
          description: Relay Handle mentioned by this text part.
        mention_range:
          type:
            - array
            - 'null'
          prefixItems:
            - type: integer
              minimum: 0
            - type: integer
              minimum: 1
          minItems: 2
          maxItems: 2
          description: UTF-16 [start,end) range of the mention inside value.
        reactions:
          type:
            - array
            - 'null'
          description: Reactions on this message part
          items:
            $ref: '#/components/schemas/Reaction'
    MediaPartResponse:
      type: object
      description: A media attachment part
      required:
        - type
        - id
        - url
        - filename
        - mime_type
        - size_bytes
        - reactions
      properties:
        type:
          type: string
          enum:
            - media
          description: Indicates this is a media attachment part
        id:
          type: string
          format: uuid
          description: Unique attachment identifier
        url:
          type: string
          format: uri
          description: Opaque Relay download URL for the Attachment.
        filename:
          type: string
          description: Original filename
        mime_type:
          type: string
          description: MIME type of the file
        size_bytes:
          type: integer
          description: File size in bytes
        reactions:
          type:
            - array
            - 'null'
          description: Reactions on this message part
          items:
            $ref: '#/components/schemas/Reaction'
        duration_ms:
          type:
            - integer
            - 'null'
          minimum: 0
          description: Audio or video duration in milliseconds when known.
        width:
          type:
            - integer
            - 'null'
          minimum: 1
          description: Pixel width when known. Width and height are supplied together.
        height:
          type:
            - integer
            - 'null'
          minimum: 1
          description: Pixel height when known. Width and height are supplied together.
    LinkPartResponse:
      type: object
      description: A rich link preview part
      required:
        - type
        - value
        - reactions
      properties:
        type:
          type: string
          enum:
            - link
          description: Indicates this is a rich link preview part
        value:
          type: string
          description: The URL
        reactions:
          type:
            - array
            - 'null'
          description: Reactions on this message part
          items:
            $ref: '#/components/schemas/Reaction'
    SystemPartResponse:
      type: object
      additionalProperties: false
      required:
        - type
        - value
        - reactions
      properties:
        type:
          type: string
          enum:
            - system
        value:
          type: string
        reactions:
          type: 'null'
    ReplyTo:
      type: object
      description: Indicates this message is a threaded reply to another message
      required:
        - message_id
      properties:
        message_id:
          type: string
          format: uuid
          description: The ID of the message to reply to
        part_index:
          type: integer
          format: int32
          description: |
            The specific message part to reply to (0-based index).
            Defaults to 0 (first part) if not provided.
            Use this when replying to a specific part of a multipart message.
          minimum: 0
    DeliveryStatus:
      type: string
      description: Current delivery status of a message
      enum:
        - sent
        - delivered
        - read
    MessageDelivery:
      type: object
      additionalProperties: false
      required:
        - contact
        - delivered_at
        - read_at
      properties:
        contact:
          $ref: '#/components/schemas/ChatHandle'
          description: Message recipient whose independent receipt state this row records.
        delivered_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When this recipient durably applied the Message.
        read_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When this recipient marked the Chat Read. Read implies Delivered.
    SystemEvent:
      type: object
      additionalProperties: false
      required:
        - type
        - actor
        - subject
        - value
        - icon_attachment_id
        - contact_card
      properties:
        type:
          type: string
          enum:
            - chat_created
            - participant_added
            - participant_removed
            - group_name_updated
            - group_icon_updated
            - contact_card_shared
        actor:
          $ref: '#/components/schemas/SystemEventParty'
        subject:
          oneOf:
            - $ref: '#/components/schemas/SystemEventParty'
            - type: 'null'
        value:
          type:
            - string
            - 'null'
        icon_attachment_id:
          type:
            - string
            - 'null'
          format: uuid
        contact_card:
          oneOf:
            - $ref: '#/components/schemas/ContactCardItem'
            - type: 'null'
    ErrorDetail:
      type: object
      required:
        - status
        - code
        - message
        - doc_url
      properties:
        status:
          type: integer
          description: HTTP status code (e.g., 400, 404, 500)
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: Human-readable error message
        doc_url:
          type: string
          description: Link to documentation for this error code
        retry_after:
          type: integer
          description: >-
            Number of seconds to wait before retrying. Only present on 429 rate
            limit errors.
    Reaction:
      type: object
      required:
        - is_me
        - handle
        - type
      properties:
        is_me:
          type: boolean
          description: Whether this reaction is from the current user
        handle:
          $ref: '#/components/schemas/ChatHandle'
        type:
          $ref: '#/components/schemas/ReactionType'
        custom_emoji:
          type:
            - string
            - 'null'
          description: Custom emoji if type is "custom", null otherwise
    SystemEventParty:
      type: object
      additionalProperties: false
      required:
        - id
        - handle
        - kind
      properties:
        id:
          type: string
          format: uuid
        handle:
          type: string
        kind:
          type: string
          enum:
            - user
            - agent
    ContactCardItem:
      type: object
      required:
        - handle
        - first_name
        - is_active
        - kind
        - last_name
        - image_url
      properties:
        first_name:
          type: string
        last_name:
          type:
            - string
            - 'null'
        image_url:
          type:
            - string
            - 'null'
          format: uri
        is_active:
          type: boolean
        handle:
          type: string
          description: Relay Handle associated with this contact card.
        kind:
          type: string
          enum:
            - user
            - agent
          description: Whether the Contact is a user or an agent.
    ErrorCode:
      type: integer
      description: Relay API error code.
    ReactionType:
      type: string
      description: Six standard tapbacks or a custom Unicode emoji.
      enum:
        - love
        - like
        - dislike
        - laugh
        - emphasize
        - question
        - custom
  responses:
    Unauthorized:
      description: Unauthorized - missing or invalid authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        Bearer token authentication. Include your API token in the Authorization
        header.


        Format: `Authorization: Bearer <your-token>`

````