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

# Search Threads

> Find threads by what was written in them: message text, email subject, sender name or address

The match is case-insensitive and covers message text, email subject, sender name and sender address (and the HTML of
emails without a text part). Results are threads, newest match first; each thread's `lastMessage` is the newest
**matching** message. Without `fromDate` the last 180 days are searched (`searchedFrom` in the response).

## Use Cases

* **Find a request**: every thread where a contact wrote "refund" (`query=refund&direction=inbound`)
* **Check what you promised**: `direction=outbound` searches what you, your team or your AI sent

To find a thread by the contact's name, email or phone, use `search` on [List Threads](https://docs.minimo.it/api-reference/inbox/list-threads.md).

## Permissions

The API key needs the **Inbox** permission.


## OpenAPI

````yaml get /public/v1/inbox/threads/search
openapi: 3.1.0
info:
  title: API Documentation
  description: Documentation for transactional and subscribe APIs
  version: 1.0.0
servers:
  - url: https://app.minimo.it
security:
  - bearerAuth: []
paths:
  /public/v1/inbox/threads/search:
    servers:
      - url: https://api.minimo.it
    get:
      summary: Search inbox threads
      description: >-
        Find threads by what was written in them. Case-insensitive match on
        message text, email subject, sender name and sender address. Newest
        match first; `lastMessage` is the newest matching message.
      operationId: searchInboxThreads
      parameters:
        - name: query
          in: query
          required: true
          description: The words to find, 2 to 200 characters.
          schema:
            type: string
            minLength: 2
            maxLength: 200
        - name: channel
          in: query
          required: false
          description: Only messages on this channel.
          schema:
            type: string
            enum:
              - whatsapp
              - email
              - sms
              - telegram
        - name: direction
          in: query
          required: false
          description: '`inbound` = written by the contact, `outbound` = sent by you.'
          schema:
            type: string
            enum:
              - all
              - inbound
              - outbound
            default: all
        - name: fromDate
          in: query
          required: false
          description: 'ISO date. Default: 180 days ago.'
          schema:
            type: string
            format: date-time
        - name: toDate
          in: query
          required: false
          description: ISO date.
          schema:
            type: string
            format: date-time
        - name: limit
          in: query
          required: false
          description: ''
          schema:
            type: integer
            minimum: 1
            maximum: 50
            default: 20
      responses:
        '200':
          description: Matching threads
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      threads:
                        type: array
                        items:
                          $ref: '#/components/schemas/InboxThread'
                      searchedFrom:
                        type: string
                        format: date-time
                        description: Start of the searched period.
              example:
                data:
                  threads:
                    - threadId: 1234
                      status: open
                      unreadMessages: 0
                      pinned: false
                      channels:
                        - email
                      contact:
                        contactId: 5678
                        name: Mario Rossi
                        email: mario@example.com
                        phone: null
                      assignedTo: null
                      needsHuman: false
                      ai:
                        state: active
                        since: null
                      snoozedUntil: null
                      updatedAt: '2026-11-12T16:20:00.000Z'
                      lastMessage:
                        messageId: 90087
                        direction: inbound
                        channel: email
                        subject: Refund for order 1042
                        preview: Hello, I would like a refund for order 1042…
                        at: '2026-11-12T16:20:00.000Z'
                  searchedFrom: '2026-05-17T10:00:00.000Z'
        '400':
          description: '`INVALID_PARAMETERS`: a parameter of the wrong type or out of range.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InboxError'
        '401':
          description: Missing or invalid API key, or a key without the `Inbox` permission.
      security:
        - bearerAuth: []
      x-codeSamples:
        - label: CLI
          lang: cURL
          source: |-
            curl --request GET \
              --url 'https://api.minimo.it/public/v1/inbox/threads/search?query=refund&direction=inbound' \
              --header 'Authorization: Bearer {{BEARER_TOKEN}}'
        - lang: JavaScript
          source: >-
            const res = await
            fetch('https://api.minimo.it/public/v1/inbox/threads/search?query=refund&direction=inbound',
            {
              method: 'GET',
              headers: {
                'Authorization': 'Bearer {{BEARER_TOKEN}}',
              },
            });

            const { data } = await res.json();

            console.log(data);
        - lang: Python
          source: |-
            import requests

            res = requests.get(
                'https://api.minimo.it/public/v1/inbox/threads/search?query=refund&direction=inbound',
                headers={'Authorization': 'Bearer {{BEARER_TOKEN}}'},
            )
            print(res.json())
components:
  schemas:
    InboxThread:
      type: object
      description: >-
        One conversation with one contact: email, WhatsApp, SMS and Telegram
        together. The MCP `minimo_inbox_*` tools return the same object.
      properties:
        threadId:
          type: integer
          example: 1234
        status:
          type: string
          enum:
            - open
            - closed
            - snoozed
        unreadMessages:
          type: integer
          example: 2
        pinned:
          type: boolean
        channels:
          type: array
          description: Channels this contact has used in the thread.
          items:
            type: string
            enum:
              - whatsapp
              - email
              - sms
              - telegram
        contact:
          type: object
          properties:
            contactId:
              type: integer
              example: 5678
            name:
              type: string
              nullable: true
              example: Mario Rossi
            email:
              type: string
              nullable: true
              example: mario@example.com
            phone:
              type: string
              nullable: true
              example: '393331234567'
        assignedTo:
          type: object
          nullable: true
          description: The teammate the thread is assigned to, `null` if nobody.
          properties:
            userId:
              type: integer
              example: 42
            name:
              type: string
              nullable: true
              example: Giulia Bianchi
        needsHuman:
          type: boolean
          description: The AI handed the thread over to a person.
        ai:
          type: object
          properties:
            state:
              type: string
              enum:
                - active
                - paused
                - disabled
              description: >-
                `active` = the AI answers. `paused` = a teammate replied or the
                AI handed over; the AI comes back after the assistant's pause
                time. `disabled` = off on this thread until it is turned on
                again.
            since:
              type: string
              format: date-time
              nullable: true
              description: When the AI paused (`paused` only).
        snoozedUntil:
          type: string
          format: date-time
          nullable: true
        updatedAt:
          type: string
          format: date-time
        lastMessage:
          type: object
          nullable: true
          properties:
            messageId:
              type: integer
              example: 90112
            direction:
              type: string
              enum:
                - inbound
                - outbound
              description: >-
                `inbound` = from the contact, `outbound` = from you, your team
                or your AI.
            channel:
              type: string
              enum:
                - whatsapp
                - email
                - sms
                - telegram
            subject:
              type: string
              nullable: true
              description: Email only.
            preview:
              type: string
              description: The text on one line, up to 280 characters.
            at:
              type: string
              format: date-time
    InboxError:
      type: object
      description: >-
        `message` is the code, `userMessage` a sentence you can show to a
        person.
      properties:
        status:
          type: string
          example: FAIL
        message:
          type: string
          example: WHATSAPP_WINDOW_CLOSED
        userMessage:
          type: string
          example: >-
            WhatsApp allows free text only within 24 hours of the contact's last
            WhatsApp message. Send an approved template instead.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: mn-API_CLIENT_ID-API_KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.