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

# Search messages within a conversation

> Returns `{ messageId, createdAt }` for each `body` field regex match in the conversation, plus a total count and truncation flag. Backs the in-conversation find bar — does not return message bodies. Email messages whose content lives only in `emailMetadata.bodyHtml` will not match.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/conversation/{conversationId}/messages/search
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/conversation/{conversationId}/messages/search:
    get:
      tags:
        - Conversations
      summary: Search messages within a conversation
      description: >-
        Returns `{ messageId, createdAt }` for each `body` field regex match in
        the conversation, plus a total count and truncation flag. Backs the
        in-conversation find bar — does not return message bodies. Email
        messages whose content lives only in `emailMetadata.bodyHtml` will not
        match.
      operationId: get_conversation_messages_search
      parameters:
        - in: path
          name: conversationId
          required: true
          schema:
            type: string
        - in: query
          name: q
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 500
          description: Search query (regex-escaped server-side)
        - in: query
          name: matchCase
          required: false
          schema:
            type: boolean
            default: false
        - in: query
          name: wholeWord
          required: false
          schema:
            type: boolean
            default: false
        - in: query
          name: limit
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 5000
            default: 2000
        - in: query
          name: fromDate
          required: false
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          description: Inclusive lower bound (UTC), YYYY-MM-DD
        - in: query
          name: toDate
          required: false
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          description: Inclusive upper bound (UTC), YYYY-MM-DD
      responses:
        '200':
          description: Search matches returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationMessageSearchResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '404':
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ConversationMessageSearchResponse:
      type: object
      properties:
        matches:
          type: array
          items:
            $ref: '#/components/schemas/ConversationMessageSearchMatch'
        total:
          type: integer
        truncated:
          type: boolean
          description: True when results were capped at `limit`
      required:
        - matches
        - total
        - truncated
      additionalProperties: true
      example:
        matches:
          - messageId: 67e0a0b0c0d0e0f0a0b0c0d0
            createdAt: '2026-05-18T13:30:00.000Z'
          - messageId: 67e0a0b0c0d0e0f0a0b0c0d3
            createdAt: '2026-05-18T13:45:00.000Z'
        total: 2
        truncated: false
    LegacyErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        data: {}
      additionalProperties: true
      example:
        error: Attachment not found
        message: Attachment not found
    ConversationMessageSearchMatch:
      type: object
      properties:
        messageId:
          type: string
        createdAt:
          type: string
          format: date-time
      required:
        - messageId
        - createdAt
      additionalProperties: false
      example:
        messageId: 67e0a0b0c0d0e0f0a0b0c0d0
        createdAt: '2026-05-18T13:30:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````