# email_thread_get

Get Email Thread

## Beschreibung

Retrieves a specific email thread by its prefixed ID
(`ethr_…`) including its messages, ordered oldest →
newest. The thread's account binding is inferred from the
ID, so no `account_id` is needed here beyond the account
context.

`message_format` controls how much per-message detail you
get:

- `FULL_CONTENT` (default) — snippet, headers, plain-text
  and HTML body, and the list of attachments (each with
  its `eatt_…` ID and metadata). Use this when you need
  to read or quote the content.
- `MINIMAL` — snippet plus the key headers (Subject, From,
  To, Cc, Date) only; body content and attachment metadata
  are omitted. Use this for cheap thread previews.

Body content arrives as plain text (`body_text`) and HTML
(`body_html`). Plain text is usually what an agent should
reason over; the HTML is included for completeness.

To download an attachment's bytes, call
`email_attachment_url` with the `eatt_…` ID returned here.

## Zugriff

Zugriffsprofil: `gated`. Module: `email`.
Die Freigabe im Profil ersetzt keine Account-, Workspace- oder Rollenberechtigung.

## Parameter

| Name | Typ | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| `account_id` | string | Ja | Account prefix ID (acct_…). |
| `thread_id` | string | Ja | Thread prefix ID (ethr_…) from email_thread_search. |
| `message_format` | string | Nein | Per-message detail level. Default FULL_CONTENT. |

## Eingabeschema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "account_id": {
      "type": "string",
      "description": "Account prefix ID (acct_…)."
    },
    "thread_id": {
      "type": "string",
      "description": "Thread prefix ID (ethr_…) from email_thread_search."
    },
    "message_format": {
      "type": "string",
      "enum": [
        "FULL_CONTENT",
        "MINIMAL"
      ],
      "description": "Per-message detail level. Default FULL_CONTENT."
    }
  },
  "required": [
    "account_id",
    "thread_id"
  ],
  "type": "object"
}
```

## Ausgabeschema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "thread": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "account_id": {
          "type": "string"
        },
        "subject": {
          "type": [
            "string",
            "null"
          ]
        },
        "snippet": {
          "type": [
            "string",
            "null"
          ]
        },
        "participants": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "message_count": {
          "type": "integer"
        },
        "last_message_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "is_unread": {
          "type": "boolean"
        },
        "is_starred": {
          "type": "boolean"
        },
        "has_attachments": {
          "type": "boolean"
        },
        "messages": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "from": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "to": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "cc": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "bcc": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "subject": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "snippet": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "date": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "is_unread": {
                "type": "boolean"
              },
              "is_starred": {
                "type": "boolean"
              },
              "is_draft": {
                "type": "boolean"
              },
              "is_sent": {
                "type": "boolean"
              },
              "labels": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "body_text": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Only in FULL_CONTENT."
              },
              "body_html": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Only in FULL_CONTENT."
              },
              "attachments": {
                "type": "array",
                "description": "Only in FULL_CONTENT. Use email_attachment_url to download.",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "content_type": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "size_bytes": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "is_inline": {
                      "type": "boolean"
                    }
                  }
                }
              }
            },
            "required": [
              "id",
              "from",
              "subject",
              "snippet",
              "date",
              "is_unread",
              "is_starred",
              "is_draft",
              "is_sent",
              "labels"
            ]
          }
        }
      },
      "required": [
        "id",
        "account_id",
        "subject",
        "snippet",
        "message_count",
        "last_message_at",
        "is_unread",
        "is_starred",
        "has_attachments",
        "messages"
      ]
    }
  },
  "required": [
    "thread"
  ],
  "type": "object"
}
```
