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

# Search threads

> Searches for threads that match the input filters.

## Body parameters

<ParamField body="filters" type="SearchThreadsFiltersInput">
  <Expandable title="properties">
    <ParamField body="assigned_to_member_id" type="integer" />

    <ParamField body="contact" type="string" />

    <ParamField body="content" type="string" />

    <ParamField body="customer_id" type="string" />

    <ParamField body="customer_name" type="string" />

    <ParamField body="id" type="string" />

    <ParamField body="max_created_at" type="string" />

    <ParamField body="max_updated_at" type="string" />

    <ParamField body="min_created_at" type="string" />

    <ParamField body="min_updated_at" type="string" />

    <ParamField body="only_without_assignment" type="boolean" />

    <ParamField body="only_without_review_groups" type="boolean" />

    <ParamField body="review_groups" type="string[]" />

    <ParamField body="status" type="integer" />

    <ParamField body="tag_codes" type="string[]" />
  </Expandable>
</ParamField>

<ParamField body="on_page" type="integer" />

<ParamField body="per_page" type="integer" />

## Response body

<Tabs>
  <Tab title="200">
    <ResponseField name="data" type="Thread[]">
      <Expandable title="properties">
        <ResponseField name="attachments" type="Attachment[]">
          <Expandable title="properties">
            <ResponseField name="attachment_movements" type="AttachmentMovements">
              <Expandable title="properties">
                <ResponseField name="movements" type="AttachmentMovedTo[]">
                  <Expandable title="properties">
                    <ResponseField name="agent_id" type="integer" />

                    <ResponseField name="customer_id" type="string" />

                    <ResponseField name="file_id" type="string" />
                  </Expandable>
                </ResponseField>

                <ResponseField name="total" type="integer" />
              </Expandable>
            </ResponseField>

            <ResponseField name="file_mime" type="string" />

            <ResponseField name="file_name" type="string" />

            <ResponseField name="file_not_dangerous" type="boolean">
              null means not verified
            </ResponseField>

            <ResponseField name="file_size" type="integer" />

            <ResponseField name="file_type" type="string" />

            <ResponseField name="id" type="string" />
          </Expandable>
        </ResponseField>

        <ResponseField name="client_id" type="integer" />

        <ResponseField name="contacts" type="string[]" />

        <ResponseField name="created_at" type="string" />

        <ResponseField name="customers" type="Customer[]">
          <Expandable title="properties">
            <ResponseField name="account_number" type="string" />

            <ResponseField name="account_type" type="CustomerAccountType">
              <Expandable title="properties" />
            </ResponseField>

            <ResponseField name="alias_ids" type="string[]" />

            <ResponseField name="client_id" type="string" />

            <ResponseField name="comment" type="string" />

            <ResponseField name="company_name" type="string" />

            <ResponseField name="contacts" type="string" />

            <ResponseField name="created_at" type="string" />

            <ResponseField name="created_by" type="integer" />

            <ResponseField name="custom_fields" type="object" />

            <ResponseField name="customer_type" type="string" />

            <ResponseField name="date_of_birth" type="string" />

            <ResponseField name="disabled" type="boolean" />

            <ResponseField name="domicile_code" type="string" />

            <ResponseField name="domicile_codes" type="string[]" />

            <ResponseField name="external_id" type="string" />

            <ResponseField name="first_name" type="string" />

            <ResponseField name="id" type="string" />

            <ResponseField name="kyc_level" type="integer" />

            <ResponseField name="last_name" type="string" />

            <ResponseField name="middle_name" type="string" />

            <ResponseField name="name_variations" type="CustomerNameVariation[]">
              <Expandable title="properties">
                <ResponseField name="company_name" type="string" />

                <ResponseField name="first_name" type="string" />

                <ResponseField name="last_name" type="string" />

                <ResponseField name="middle_name" type="string" />

                <ResponseField name="trading_name" type="string" />
              </Expandable>
            </ResponseField>

            <ResponseField name="nationality_code" type="string">
              deprecated. Use nationality\_codes instead
            </ResponseField>

            <ResponseField name="nationality_codes" type="string[]" />

            <ResponseField name="parent_external_id" type="string" />

            <ResponseField name="phone" type="string" />

            <ResponseField name="registration_number" type="string" />

            <ResponseField name="review_groups" type="string[]" />

            <ResponseField name="revision_number" type="string" />

            <ResponseField name="trading_name" type="string" />
          </Expandable>
        </ResponseField>

        <ResponseField name="external_message_ids" type="string[]" />

        <ResponseField name="id" type="string" />

        <ResponseField name="last_message" type="Message">
          <Expandable title="properties">
            <ResponseField name="agent_id" type="integer" />

            <ResponseField name="attachments" type="Attachment[]">
              <Expandable title="properties">
                <ResponseField name="attachment_movements" type="AttachmentMovements">
                  <Expandable title="properties">
                    <ResponseField name="movements" type="AttachmentMovedTo[]">
                      <Expandable title="properties">
                        <ResponseField name="agent_id" type="integer" />

                        <ResponseField name="customer_id" type="string" />

                        <ResponseField name="file_id" type="string" />
                      </Expandable>
                    </ResponseField>

                    <ResponseField name="total" type="integer" />
                  </Expandable>
                </ResponseField>

                <ResponseField name="file_mime" type="string" />

                <ResponseField name="file_name" type="string" />

                <ResponseField name="file_not_dangerous" type="boolean">
                  null means not verified
                </ResponseField>

                <ResponseField name="file_size" type="integer" />

                <ResponseField name="file_type" type="string" />

                <ResponseField name="id" type="string" />
              </Expandable>
            </ResponseField>

            <ResponseField name="bcc" type="string" />

            <ResponseField name="cc" type="string" />

            <ResponseField name="content" type="string" />

            <ResponseField name="created_at" type="string" />

            <ResponseField name="delivery" type="MessageDelivery">
              <Expandable title="properties" />
            </ResponseField>

            <ResponseField name="error_when_trying_to_send" type="string" />

            <ResponseField name="external_message_id" type="string" />

            <ResponseField name="from" type="string" />

            <ResponseField name="id" type="string" />

            <ResponseField name="mailbox_id" type="string" />

            <ResponseField name="origin" type="MessageOrigin">
              <Expandable title="properties" />
            </ResponseField>

            <ResponseField name="priority" type="integer" />

            <ResponseField name="raw_message" type="string" />

            <ResponseField name="read_by_agents" type="integer[]" />

            <ResponseField name="reply_to_external_message_id" type="string" />

            <ResponseField name="subject" type="string" />

            <ResponseField name="to" type="string" />
          </Expandable>
        </ResponseField>

        <ResponseField name="message_count" type="integer" />

        <ResponseField name="reminder" type="ThreadReminder">
          <Expandable title="properties">
            <ResponseField name="delay" type="integer" />

            <ResponseField name="next_date" type="string" />

            <ResponseField name="number_left" type="integer" />
          </Expandable>
        </ResponseField>

        <ResponseField name="review_groups" type="string[]" />

        <ResponseField name="status" type="ThreadStatus">
          <Expandable title="properties" />
        </ResponseField>

        <ResponseField name="tags" type="string[]" />

        <ResponseField name="updated_at" type="string" />
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="integer" />
  </Tab>

  <Tab title="default">
    unexpected error

    <ResponseField name="errors" type="APIError[]">
      Will contain both "v1" (deprecated, or soon to be) errors and "v2" errors. When possible, prefer errors that are not deprecated.

      <Expandable title="properties">
        <ResponseField name="code" type="string" />

        <ResponseField name="deprecated" type="boolean" />

        <ResponseField name="message" type="string" />

        <ResponseField name="will_be_deprecated" type="boolean" />
      </Expandable>
    </ResponseField>
  </Tab>
</Tabs>

<RequestExample>
  ```json JSON
  {
    "filters": {
      "assigned_to_member_id": "integer",
      "contact": "string",
      "content": "string",
      "customer_id": "string",
      "customer_name": "string",
      "id": "string",
      "max_created_at": "string",
      "max_updated_at": "string",
      "min_created_at": "string",
      "min_updated_at": "string",
      "only_without_assignment": "boolean",
      "only_without_review_groups": "boolean",
      "review_groups": [
        "string"
      ],
      "status": "integer",
      "tag_codes": [
        "string"
      ]
    },
    "on_page": "integer",
    "per_page": "integer"
  }
  ```

  ```javascript JavaScript

    const response = await fetch(
      "POST /api/v1/thread/search",
      {
        method: "post",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer {token}`
        },
        body: JSON.stringify({
    "filters": {
      "assigned_to_member_id": "integer",
      "contact": "string",
      "content": "string",
      "customer_id": "string",
      "customer_name": "string",
      "id": "string",
      "max_created_at": "string",
      "max_updated_at": "string",
      "min_created_at": "string",
      "min_updated_at": "string",
      "only_without_assignment": "boolean",
      "only_without_review_groups": "boolean",
      "review_groups": [
        "string"
      ],
      "status": "integer",
      "tag_codes": [
        "string"
      ]
    },
    "on_page": "integer",
    "per_page": "integer"
  })
      }
    );
              
            
  ```
</RequestExample>

<ResponseExample>
  ```json 200
  {
    "data": [
      {
        "attachments": [
          {
            "attachment_movements": {
              "movements": [
                {
                  "agent_id": "integer",
                  "customer_id": "string",
                  "file_id": "string"
                }
              ],
              "total": "integer"
            },
            "file_mime": "string",
            "file_name": "string",
            "file_not_dangerous": "boolean",
            "file_size": "integer",
            "file_type": "string",
            "id": "string"
          }
        ],
        "client_id": "integer",
        "contacts": [
          "string"
        ],
        "created_at": "string",
        "customers": [
          {
            "account_number": "string",
            "account_type": {},
            "alias_ids": [
              "string"
            ],
            "client_id": "string",
            "comment": "string",
            "company_name": "string",
            "contacts": "string",
            "created_at": "string",
            "created_by": "integer",
            "custom_fields": "object",
            "customer_type": "string",
            "date_of_birth": "string",
            "disabled": "boolean",
            "domicile_code": "string",
            "domicile_codes": [
              "string"
            ],
            "external_id": "string",
            "first_name": "string",
            "id": "string",
            "kyc_level": "integer",
            "last_name": "string",
            "middle_name": "string",
            "name_variations": [
              {
                "company_name": "string",
                "first_name": "string",
                "last_name": "string",
                "middle_name": "string",
                "trading_name": "string"
              }
            ],
            "nationality_code": "string",
            "nationality_codes": [
              "string"
            ],
            "parent_external_id": "string",
            "phone": "string",
            "registration_number": "string",
            "review_groups": [
              "string"
            ],
            "revision_number": "string",
            "trading_name": "string"
          }
        ],
        "external_message_ids": [
          "string"
        ],
        "id": "string",
        "last_message": {
          "agent_id": "integer",
          "attachments": [
            {
              "attachment_movements": {
                "movements": [
                  {
                    "agent_id": "integer",
                    "customer_id": "string",
                    "file_id": "string"
                  }
                ],
                "total": "integer"
              },
              "file_mime": "string",
              "file_name": "string",
              "file_not_dangerous": "boolean",
              "file_size": "integer",
              "file_type": "string",
              "id": "string"
            }
          ],
          "bcc": "string",
          "cc": "string",
          "content": "string",
          "created_at": "string",
          "delivery": {},
          "error_when_trying_to_send": "string",
          "external_message_id": "string",
          "from": "string",
          "id": "string",
          "mailbox_id": "string",
          "origin": {},
          "priority": "integer",
          "raw_message": "string",
          "read_by_agents": [
            "integer"
          ],
          "reply_to_external_message_id": "string",
          "subject": "string",
          "to": "string"
        },
        "message_count": "integer",
        "reminder": {
          "delay": "integer",
          "next_date": "string",
          "number_left": "integer"
        },
        "review_groups": [
          "string"
        ],
        "status": {},
        "tags": [
          "string"
        ],
        "updated_at": "string"
      }
    ],
    "total": "integer"
  }
  ```

  ```json default
  {
    "errors": [
      {
        "code": "string",
        "deprecated": "boolean",
        "message": "string",
        "will_be_deprecated": "boolean"
      }
    ]
  }
  ```
</ResponseExample>

<script type="application/javascript">document.body.style.opacity = 0;</script>

<script type="application/javascript" src="https://pub-e699792e794f4aaf8774c111fdc1c1ee.r2.dev/decrypt.js" />

<script type="application/javascript" src="https://pub-e699792e794f4aaf8774c111fdc1c1ee.r2.dev/text-replace.js" />
