---
title: "CLI: Mail"
description: "The commands of the doorman command line under Mail. Threads, messages, raw and HTML bodies, attachments and their extracted text."
url: https://doorman.fyi/docs/cli/commands/mail
markdown: https://doorman.fyi/docs/cli/commands/mail.md
area: "SDKs and tools"
section: "Command line"
---

# CLI: Mail

The commands of the doorman command line under Mail. Threads, messages, raw and HTML bodies, attachments and their extracted text.

Source: https://doorman.fyi/docs/cli/commands/mail

## doorman inboxes threads list

Command:
```sh
doorman inboxes threads list <inboxId> [flags]
```

Operation [`inboxes.threads.list`](https://doorman.fyi/docs/reference/mail.md#inboxes-threads-list): `GET /v1/inboxes/{inboxId}/threads`

List threads. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--inbox-id` | `string` | no | The same as the argument `<inboxId>`, for a script that names everything. |
| `--is-read` | `"true" \| "false"` | no | Only read or only unread threads. |
| `--q` | `string` | no | Keep the threads whose subject or a participant address contains this text, case-insensitively. |
| `--label` | `string` | no | Only threads containing this exact, case-sensitive label. |
| `--limit` | `integer` | no | Page size, 1 to 100. Defaults to 50. |
| `--offset` | `integer` | no | Rows to skip. Defaults to 0. |

Example:
```sh
doorman inboxes threads list inb_01jc4q7w9k2m5n8p3r6t1v4x7z
```

## doorman threads get

Command:
```sh
doorman threads get <threadId> [flags]
```

Operation [`threads.get`](https://doorman.fyi/docs/reference/mail.md#threads-get): `GET /v1/threads/{threadId}`

Read a thread. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--thread-id` | `string` | no | The same as the argument `<threadId>`, for a script that names everything. |

Example:
```sh
doorman threads get thr_01jc5a1b2c3d4e5f6g7h8j9k0m
```

## doorman threads update

Command:
```sh
doorman threads update <threadId> [flags]
```

Operation [`threads.update`](https://doorman.fyi/docs/reference/mail.md#threads-update): `PATCH /v1/threads/{threadId}`

Update a thread. Access `any`: any API key, or a console session. An app token needs `mail:write` and `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--thread-id` | `string` | no | The same as the argument `<threadId>`, for a script that names everything. |
| `--is-read` | `boolean` | no |  |
| `--metadata` | `object of string \| number \| boolean \| null` | no | Extension state: at most 20 keys and 2048 bytes of UTF-8 JSON. Keys are 1 to 64 ASCII letters, digits, underscores, dots, colons or hyphens, starting with a letter or digit. Values are strings, finite numbers, booleans or null. Replaced as a whole; {} clears it. Do not store secrets. |
| `--labels` | `string[]` | no | At most 20 unique labels. Replaced as a whole; [] clears the labels. |
| `--json` | `object` | no | The request body as one JSON object. A flag given beside it replaces the field of the same name. |

Example:
```sh
doorman threads update thr_01jc5a1b2c3d4e5f6g7h8j9k0m \
  --is-read true
```

## doorman threads trash

Command:
```sh
doorman threads trash <threadId> [flags]
```

Operation [`threads.trash`](https://doorman.fyi/docs/reference/mail.md#threads-trash): `DELETE /v1/threads/{threadId}`

Trash a thread. Access `any`: any API key, or a console session. An app token needs `mail:write` and `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--thread-id` | `string` | no | The same as the argument `<threadId>`, for a script that names everything. |

Example:
```sh
doorman threads trash thr_01jc5a1b2c3d4e5f6g7h8j9k0m
```

## doorman threads messages

Command:
```sh
doorman threads messages <threadId> [flags]
```

Operation [`threads.messages`](https://doorman.fyi/docs/reference/mail.md#threads-messages): `GET /v1/threads/{threadId}/messages`

Read a thread's messages. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--thread-id` | `string` | no | The same as the argument `<threadId>`, for a script that names everything. |

Example:
```sh
doorman threads messages thr_01jc5a1b2c3d4e5f6g7h8j9k0m
```

## doorman inboxes messages list

Command:
```sh
doorman inboxes messages list <inboxId> [flags]
```

Operation [`inboxes.messages.list`](https://doorman.fyi/docs/reference/mail.md#inboxes-messages-list): `GET /v1/inboxes/{inboxId}/messages`

List messages. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--inbox-id` | `string` | no | The same as the argument `<inboxId>`, for a script that names everything. |
| `--direction` | `"inbound" \| "outbound"` | no | Only received or only sent messages. |
| `--limit` | `integer` | no | Page size, 1 to 100. Defaults to 50. |
| `--offset` | `integer` | no | Rows to skip. Defaults to 0. |

Example:
```sh
doorman inboxes messages list inb_01jc4q7w9k2m5n8p3r6t1v4x7z
```

## doorman messages get

Command:
```sh
doorman messages get <messageId> [flags]
```

Operation [`messages.get`](https://doorman.fyi/docs/reference/mail.md#messages-get): `GET /v1/messages/{messageId}`

Read a message. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--message-id` | `string` | no | The same as the argument `<messageId>`, for a script that names everything. |

Example:
```sh
doorman messages get msg_01jc5a6g7h8j9k0m1n2p3q4r5s
```

## doorman messages raw

Command:
```sh
doorman messages raw <messageId> [flags]
```

Operation [`messages.raw`](https://doorman.fyi/docs/reference/mail.md#messages-raw): `GET /v1/messages/{messageId}/raw`

Download the original message. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--message-id` | `string` | no | The same as the argument `<messageId>`, for a script that names everything. |
| `--out` | `path` | no | Write the answer to this file instead of standard output. |

Example:
```sh
doorman messages raw msg_01jc5a6g7h8j9k0m1n2p3q4r5s
```

## doorman messages html

Command:
```sh
doorman messages html <messageId> [flags]
```

Operation [`messages.html`](https://doorman.fyi/docs/reference/mail.md#messages-html): `GET /v1/messages/{messageId}/html`

Read the HTML body. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--message-id` | `string` | no | The same as the argument `<messageId>`, for a script that names everything. |
| `--out` | `path` | no | Write the answer to this file instead of standard output. |

Example:
```sh
doorman messages html msg_01jc5a6g7h8j9k0m1n2p3q4r5s
```

## doorman attachments download

Command:
```sh
doorman attachments download <messageId> <filename> [flags]
```

Operation [`attachments.download`](https://doorman.fyi/docs/reference/mail.md#attachments-download): `GET /v1/attachments/{messageId}/{filename}`

Download an attachment. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--message-id` | `string` | no | The same as the argument `<messageId>`, for a script that names everything. |
| `--filename` | `string` | no | The same as the argument `<filename>`, for a script that names everything. |
| `--out` | `path` | no | Write the answer to this file instead of standard output. |

Example:
```sh
doorman attachments download msg_01jc5a6g7h8j9k0m1n2p3q4r5s invoice.pdf
```

## doorman attachments text

Command:
```sh
doorman attachments text <messageId> <filename> [flags]
```

Operation [`attachments.text`](https://doorman.fyi/docs/reference/mail.md#attachments-text): `GET /v1/attachments/{messageId}/{filename}/text`

Read an attachment's text. Access `any`: any API key, or a console session. An app token needs `mail:read`.

**Flags**

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--message-id` | `string` | no | The same as the argument `<messageId>`, for a script that names everything. |
| `--filename` | `string` | no | The same as the argument `<filename>`, for a script that names everything. |

Example:
```sh
doorman attachments text msg_01jc5a6g7h8j9k0m1n2p3q4r5s invoice.pdf
```
