# EmailSearchCondition

An RFC 8621 §4.4 FilterCondition; every key optional, conditions in one object AND together. At most one full-text condition (text/subject/body) per filter…

An RFC 8621 §4.4 FilterCondition; every key optional, conditions in one object AND together. At most one full-text condition (text/subject/body) per filter, never under OR/NOT. A full-text condition is at most 512 characters and 64 words; a substring needle (from/to/cc/bcc/header) at most 50 bytes. $deleted is refused.

```ts
type EmailSearchCondition = {
  after?: string
  allInThreadHaveKeyword?: string
  bcc?: string
  before?: string
  body?: string
  cc?: string
  from?: string
  hasAttachment?: boolean
  hasKeyword?: string
  header?: string[]
  inMailbox?: string
  inMailboxOtherThan?: string[]
  maxSize?: number
  minSize?: number
  noneInThreadHaveKeyword?: string
  notKeyword?: string
  someInThreadHaveKeyword?: string
  subject?: string
  text?: string
  to?: string
  [key: string]: unknown
}
```

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `after` | `string` | Optional. Received at or after this RFC 8620 UTCDate (e.g. 2026-08-01T00:00:00Z) |
| `allInThreadHaveKeyword` | `string` | Optional. Every live message in the conversation carries this keyword |
| `bcc` | `string` | Optional. Substring of the Bcc addresses (max 50 bytes) |
| `before` | `string` | Optional. Received strictly before this RFC 8620 UTCDate (e.g. 2026-08-01T00:00:00Z), the one place this API departs from epoch seconds |
| `body` | `string` | Optional. Full-text match over the body parts |
| `cc` | `string` | Optional. Substring of the Cc addresses (max 50 bytes) |
| `from` | `string` | Optional. Substring of the From addresses (max 50 bytes) |
| `hasAttachment` | `boolean` | Optional. Whether the message has file attachments |
| `hasKeyword` | `string` | Optional. The message carries this keyword or flag (e.g. $seen, $flagged, $forwarded) |
| `header` | `string[]` | Optional. [name] = the header is present; [name, value] = the header contains value. Indexed names only: subject, message-id, in-reply-to, from, to, cc, list-id |
| `inMailbox` | `string` | Optional. Only messages in this Mailbox, as L\<labelId>: the `id` from GET /mailboxes/\{mailboxId\}/labels prefixed with L (INBOX is usually L1) |
| `inMailboxOtherThan` | `string[]` | Optional. Only messages in at least one Mailbox NOT listed (same L\<labelId> ids) |
| `maxSize` | `number` | Optional. Size in bytes is strictly below this |
| `minSize` | `number` | Optional. Size in bytes is at least this |
| `noneInThreadHaveKeyword` | `string` | Optional. No live message in the conversation carries this keyword |
| `notKeyword` | `string` | Optional. The message does NOT carry this keyword |
| `someInThreadHaveKeyword` | `string` | Optional. At least one live message in the conversation carries this keyword |
| `subject` | `string` | Optional. Full-text match over the Subject header |
| `text` | `string` | Optional. Full-text match over the whole message (subject and bodies) |
| `to` | `string` | Optional. Substring of the To addresses (max 50 bytes) |

## Used in

[`EmailSearchFilter`](/docs/sdks/typescript/types/email-search-filter).
