> ## 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 across all conversations for a contact

> Full-text body-field search across every conversation the caller can access for a contact. Results are grouped by conversation with matching message snippets. Supports comma-separated `channelType` filter and a date range. Same body-only caveat as the per-conversation search.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/conversation/contact/{contactId}/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/contact/{contactId}/messages/search:
    get:
      tags:
        - Conversations
      summary: Search messages across all conversations for a contact
      description: >-
        Full-text body-field search across every conversation the caller can
        access for a contact. Results are grouped by conversation with matching
        message snippets. Supports comma-separated `channelType` filter and a
        date range. Same body-only caveat as the per-conversation search.
      operationId: get_conversation_contact_messages_search
      parameters:
        - in: path
          name: contactId
          required: true
          schema:
            type: string
        - in: query
          name: q
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 500
        - 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: channelType
          required: false
          schema:
            type: string
          description: Single channel or comma-separated list (e.g. "sms,email")
        - in: query
          name: fromDate
          required: false
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
        - in: query
          name: toDate
          required: false
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
        - in: query
          name: limit
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 5000
            default: 2000
      responses:
        '200':
          description: Grouped search results returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactMessageSearchResponse'
        '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: Contact 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:
    ContactMessageSearchResponse:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/ContactMessageSearchGroup'
        total:
          type: integer
        truncated:
          type: boolean
      required:
        - results
        - total
        - truncated
      additionalProperties: true
      example:
        results:
          - conversationId: 65d3e0f0a0b0c0d0e0f0a0b0
            channelType: sms
            channelIdentifier: '+14155550123'
            matches:
              - messageId: 67e0a0b0c0d0e0f0a0b0c0d0
                body: Yes please, book the demo.
                createdAt: '2026-05-18T13:30:00.000Z'
        total: 1
        truncated: false
    LegacyErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        data: {}
      additionalProperties: true
      example:
        error: Attachment not found
        message: Attachment not found
    ContactMessageSearchGroup:
      type: object
      properties:
        conversationId:
          type: string
        channelType:
          type: string
        channelIdentifier:
          type: string
        subject:
          type: string
          nullable: true
        matches:
          type: array
          items:
            $ref: '#/components/schemas/ContactMessageSearchMatch'
      required:
        - conversationId
        - matches
      additionalProperties: true
      example:
        conversationId: 65d3e0f0a0b0c0d0e0f0a0b0
        channelType: sms
        channelIdentifier: '+14155550123'
        subject: null
        matches:
          - messageId: 67e0a0b0c0d0e0f0a0b0c0d0
            body: Yes please, book the demo.
            createdAt: '2026-05-18T13:30:00.000Z'
    ContactMessageSearchMatch:
      type: object
      properties:
        messageId:
          type: string
        body:
          type: string
        createdAt:
          type: string
          format: date-time
      required:
        - messageId
        - body
        - createdAt
      additionalProperties: false
      example:
        messageId: 67e0a0b0c0d0e0f0a0b0c0d0
        body: Yes please, book the demo.
        createdAt: '2026-05-18T13:30:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````