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

# Resend: Inboxes Search Threads

> Search the threads of an inbox. Includes SDK V2 and CLI requests, input constraints, response fields, and Deepline credit cost.

Search the threads of an inbox.

> [!NOTE]
>
> Tool ID: `resend_inboxes_search_threads`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'resend_inboxes_search_threads',
  {
    "inbox_id": "inbox_123"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline run resend_inboxes_search_threads --input '{
  "inbox_id": "inbox_123"
}'
```

## Example response

The static output schema lacks the details for a reliable example. Use `deepline describe resend_inboxes_search_threads --json` for the complete live contract.

## Input reference

Finds threads by the text of their emails, who sent or received them, whether they have attachments, and their dates. Results are ordered by latest activity, newest first, and paginate like the list threads endpoint, so a cursor that is not a thread ID returns a 422. Search can be up to about a minute behind new emails. Different parameters combine, so a thread must match all of them. `folders`, `labels`, and `read` apply to the thread. `query`, `from`, `to`, `cc`, `bcc`, `has_attachment`, `start_date`, and `end_date` must all match the same email in the thread. When any of these email filters is set, the matching email must itself be in one of `folders`. For `sent`, that means an email the inbox sent. When more than 10,000 threads match, search covers the 10,000 with the newest matching email.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.inbox_id` | `string` | Yes | — | The Inbox ID or the inbox email address, such as `support@acme.com`. A value that contains `@` must be a valid email address, and any other value must be a UUID, or the request returns a 422. The address match is case-insensitive and never falls back to the inbox `name`. An address that matches no inbox returns a 404. |
| `payload.query` | `string` | No | — | Free text to search for in the subject, body, sender, recipients, and attachment names. Every word must match. Wrap words in double quotes to match an exact phrase. Start a word or quoted phrase with `-` to exclude it. Max 256 characters and 32 words. Maximum length: 256. |
| `payload.from` | `array` | No | — | Comma-separated senders. Each value matches part of the sender's address or name, without case. Returns threads that match any of them. Up to 20 values. Repeating the parameter returns a 422 validation\_error. Maximum items: 20. |
| `payload.to` | `array` | No | — | Comma-separated recipients, matched the same way as `from`. Up to 20 values. Repeating the parameter returns a 422 validation\_error. Maximum items: 20. |
| `payload.cc` | `array` | No | — | Comma-separated CC recipients, matched the same way as `from`. Up to 20 values. Repeating the parameter returns a 422 validation\_error. Maximum items: 20. |
| `payload.bcc` | `array` | No | — | Comma-separated BCC recipients, matched the same way as `from`. Up to 20 values. Repeating the parameter returns a 422 validation\_error. Maximum items: 20. |
| `payload.has_attachment` | `boolean` | No | — | `true` matches emails with an attachment. `false` matches emails without one. Only the literal values `true` and `false` are accepted. |
| `payload.start_date` | `string` | No | — | Matches emails sent on or after this date. Accepts a date like `2026-09-01` or an ISO 8601 timestamp, in UTC unless the timestamp has an offset. An empty value returns a 422. |
| `payload.end_date` | `string` | No | — | Matches emails sent on or before this date. Same formats as `start_date`. A date covers that whole day, so `start_date=2026-09-01&end_date=2026-09-30` covers all of September. A timestamp is used as given. An `end_date` before `start_date` returns a 422 validation\_error. An empty value returns a 422. |
| `payload.folders` | `array` | No | — | Comma-separated folders to search, for example `inbox,sent`. Repeating the parameter returns a 422 validation\_error. A thread is returned when any of its emails is in one of the folders. Defaults to `inbox`, or to `inbox,archive,sent` when `labels` is set. `spam` and `trash` are only included when you name them. |
| `payload.labels` | `array` | No | — | Comma-separated label IDs. Returns threads with any of these labels. Up to 50 IDs. An ID that does not exist in the inbox returns a 404. Repeating the parameter returns a 422 validation\_error. Maximum items: 50. |
| `payload.read` | `boolean` | No | — | `true` returns threads where every email is read. `false` returns threads with at least one unread email. Only the literal values `true` and `false` are accepted. |
| `payload.limit` | `integer` | No | — | Number of items to return. Minimum: 1. Maximum: 100. |
| `payload.after` | `string` | No | — | Return items after this cursor. |
| `payload.before` | `string` | No | — | Return items before this cursor. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Finds threads by the text of their emails, who sent or received them, whether they have attachments, and their dates. Results are ordered by latest activity, newest first, and paginate like the list threads endpoint, so a cursor that is not a thread ID returns a 422. Search can be up to about a minute behind new emails. Different parameters combine, so a thread must match all of them. `folders`, `labels`, and `read` apply to the thread. `query`, `from`, `to`, `cc`, `bcc`, `has_attachment`, `start_date`, and `end_date` must all match the same email in the thread. When any of these email filters is set, the matching email must itself be in one of `folders`. For `sent`, that means an email the inbox sent. When more than 10,000 threads match, search covers the 10,000 with the newest matching email.",
    "properties": {
      "inbox_id": {
        "type": "string",
        "description": "The Inbox ID or the inbox email address, such as `support@acme.com`. A value that contains `@` must be a valid email address, and any other value must be a UUID, or the request returns a 422. The address match is case-insensitive and never falls back to the inbox `name`. An address that matches no inbox returns a 404."
      },
      "query": {
        "type": "string",
        "description": "Free text to search for in the subject, body, sender, recipients, and attachment names. Every word must match. Wrap words in double quotes to match an exact phrase. Start a word or quoted phrase with `-` to exclude it. Max 256 characters and 32 words.",
        "maxLength": 256
      },
      "from": {
        "type": "array",
        "description": "Comma-separated senders. Each value matches part of the sender's address or name, without case. Returns threads that match any of them. Up to 20 values. Repeating the parameter returns a 422 validation_error.",
        "maxItems": 20,
        "items": {
          "type": "string"
        }
      },
      "to": {
        "type": "array",
        "description": "Comma-separated recipients, matched the same way as `from`. Up to 20 values. Repeating the parameter returns a 422 validation_error.",
        "maxItems": 20,
        "items": {
          "type": "string"
        }
      },
      "cc": {
        "type": "array",
        "description": "Comma-separated CC recipients, matched the same way as `from`. Up to 20 values. Repeating the parameter returns a 422 validation_error.",
        "maxItems": 20,
        "items": {
          "type": "string"
        }
      },
      "bcc": {
        "type": "array",
        "description": "Comma-separated BCC recipients, matched the same way as `from`. Up to 20 values. Repeating the parameter returns a 422 validation_error.",
        "maxItems": 20,
        "items": {
          "type": "string"
        }
      },
      "has_attachment": {
        "type": "boolean",
        "description": "`true` matches emails with an attachment. `false` matches emails without one. Only the literal values `true` and `false` are accepted."
      },
      "start_date": {
        "type": "string",
        "description": "Matches emails sent on or after this date. Accepts a date like `2026-09-01` or an ISO 8601 timestamp, in UTC unless the timestamp has an offset. An empty value returns a 422."
      },
      "end_date": {
        "type": "string",
        "description": "Matches emails sent on or before this date. Same formats as `start_date`. A date covers that whole day, so `start_date=2026-09-01&end_date=2026-09-30` covers all of September. A timestamp is used as given. An `end_date` before `start_date` returns a 422 validation_error. An empty value returns a 422."
      },
      "folders": {
        "type": "array",
        "description": "Comma-separated folders to search, for example `inbox,sent`. Repeating the parameter returns a 422 validation_error. A thread is returned when any of its emails is in one of the folders. Defaults to `inbox`, or to `inbox,archive,sent` when `labels` is set. `spam` and `trash` are only included when you name them.",
        "items": {
          "type": "string",
          "enum": [
            "inbox",
            "archive",
            "spam",
            "sent",
            "trash"
          ]
        }
      },
      "labels": {
        "type": "array",
        "description": "Comma-separated label IDs. Returns threads with any of these labels. Up to 50 IDs. An ID that does not exist in the inbox returns a 404. Repeating the parameter returns a 422 validation_error.",
        "maxItems": 50,
        "items": {
          "type": "string",
          "format": "uuid"
        }
      },
      "read": {
        "type": "boolean",
        "description": "`true` returns threads where every email is read. `false` returns threads with at least one unread email. Only the literal values `true` and `false` are accepted."
      },
      "limit": {
        "type": "integer",
        "description": "Number of items to return.",
        "minimum": 1,
        "maximum": 100
      },
      "after": {
        "type": "string",
        "description": "Return items after this cursor."
      },
      "before": {
        "type": "string",
        "description": "Return items before this cursor."
      }
    },
    "required": [
      "inbox_id"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | Provider response payload. |
| `result.data.object` | `string` | Yes | — | Type of the response object. |
| `result.data.has_more` | `boolean` | Yes | — | Indicates if there are more results available. |
| `result.data.data` | `array` | Yes | — | The matching threads, most recently active first. |
| `result.data.data[].id` | `string` | Yes | — | The ID of the thread. Format: `uuid`. |
| `result.data.data[].subject` | `string \| null` | Yes | — | The subject of the thread. |
| `result.data.data[].from` | `string \| null` | Yes | — | The sender email address. Can include the display name. |
| `result.data.data[].to` | `array` | Yes | — | The recipients of the most recent email. For a received email, these are the addresses it was delivered to, not the full `To` header. |
| `result.data.data[].cc` | `array` | Yes | — | The CC recipients of the most recent email. |
| `result.data.data[].bcc` | `array` | Yes | — | The BCC recipients of the most recent email. Always empty for a received email. |
| `result.data.data[].labels` | `array` | Yes | — | The labels attached to the thread. |
| `result.data.data[].labels[].id` | `string` | Yes | — | The ID of the label. Format: `uuid`. |
| `result.data.data[].labels[].name` | `string` | Yes | — | The name of the label. |
| `result.data.data[].labels[].color` | `string` | Yes | — | The color of the label, as a `#RRGGBB` hex color in uppercase. Pattern: `^#[0-9A-Fa-f]&#123;6&#125;$`. |
| `result.data.data[].email_count` | `integer` | Yes | — | The number of emails in the thread. |
| `result.data.data[].has_attachment` | `boolean` | Yes | — | Whether the most recent email in the thread has an attachment. |
| `result.data.data[].has_draft` | `boolean` | Yes | — | Whether the thread has an unsent draft. |
| `result.data.data[].read` | `boolean` | Yes | — | True only when every email in the thread is read. |
| `result.data.data[].received_at` | `string` | Yes | — | Timestamp when the thread was last active. Format: `date-time`. |
| `result.data.data[].folder` | `"inbox" \| "archive" \| "spam" \| "sent" \| "trash"` | Yes | — | The folder the thread is in. Every thread is in exactly one folder. `inbox` holds threads with at least one received email. `archive` and `spam` hold threads moved there. `trash` holds threads scheduled for deletion in 30 days. `sent` holds threads whose emails are all outbound, and is assigned automatically. Allowed: `inbox`, `archive`, `spam`, `sent`, `trash`. |
| `result.data.data[].matched_email_id` | `string \| null` | Yes | — | The ID of the email in the thread that matched the search. When `query` has words or phrases, it is the most relevant match. Otherwise, it is the newest. It is the same `id` that the list thread emails endpoint returns, so use it as `email_id` with the get, reply and forward endpoints. Null when the search index returns no matched email for the thread. Format: `uuid`. |
| `result.meta` | `object` | No | — | Additional response metadata (status, paging). |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "object",
        "description": "Provider response payload.",
        "properties": {
          "object": {
            "type": "string",
            "description": "Type of the response object."
          },
          "has_more": {
            "type": "boolean",
            "description": "Indicates if there are more results available."
          },
          "data": {
            "type": "array",
            "description": "The matching threads, most recently active first.",
            "items": {
              "type": "object",
              "description": "A thread as it appears in the list of an inbox's threads.",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The ID of the thread.",
                  "format": "uuid"
                },
                "subject": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The subject of the thread."
                },
                "from": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The sender email address. Can include the display name."
                },
                "to": {
                  "type": "array",
                  "description": "The recipients of the most recent email. For a received email, these are the addresses it was delivered to, not the full `To` header.",
                  "items": {
                    "type": "string"
                  }
                },
                "cc": {
                  "type": "array",
                  "description": "The CC recipients of the most recent email.",
                  "items": {
                    "type": "string"
                  }
                },
                "bcc": {
                  "type": "array",
                  "description": "The BCC recipients of the most recent email. Always empty for a received email.",
                  "items": {
                    "type": "string"
                  }
                },
                "labels": {
                  "type": "array",
                  "description": "The labels attached to the thread.",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "The ID of the label.",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string",
                        "description": "The name of the label."
                      },
                      "color": {
                        "type": "string",
                        "description": "The color of the label, as a `#RRGGBB` hex color in uppercase.",
                        "pattern": "^#[0-9A-Fa-f]{6}$"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "color"
                    ],
                    "additionalProperties": false
                  }
                },
                "email_count": {
                  "type": "integer",
                  "description": "The number of emails in the thread."
                },
                "has_attachment": {
                  "type": "boolean",
                  "description": "Whether the most recent email in the thread has an attachment."
                },
                "has_draft": {
                  "type": "boolean",
                  "description": "Whether the thread has an unsent draft."
                },
                "read": {
                  "type": "boolean",
                  "description": "True only when every email in the thread is read."
                },
                "received_at": {
                  "type": "string",
                  "description": "Timestamp when the thread was last active.",
                  "format": "date-time"
                },
                "folder": {
                  "type": "string",
                  "description": "The folder the thread is in. Every thread is in exactly one folder. `inbox` holds threads with at least one received email. `archive` and `spam` hold threads moved there. `trash` holds threads scheduled for deletion in 30 days. `sent` holds threads whose emails are all outbound, and is assigned automatically.",
                  "enum": [
                    "inbox",
                    "archive",
                    "spam",
                    "sent",
                    "trash"
                  ]
                },
                "matched_email_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The ID of the email in the thread that matched the search. When `query` has words or phrases, it is the most relevant match. Otherwise, it is the newest. It is the same `id` that the list thread emails endpoint returns, so use it as `email_id` with the get, reply and forward endpoints. Null when the search index returns no matched email for the thread.",
                  "format": "uuid"
                }
              },
              "required": [
                "id",
                "subject",
                "from",
                "to",
                "cc",
                "bcc",
                "labels",
                "email_count",
                "has_attachment",
                "has_draft",
                "read",
                "received_at",
                "folder",
                "matched_email_id"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Connect integrations](https://deepline.com/docs/integrations.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


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