---
title: "Search mail (iCloud Mail)"
method: POST
path: "/v1/icloud_mail/search"
tags: ["read"]
---

# Search mail (iCloud Mail)

`POST /v1/icloud_mail/search`

## Request

- Base URL: `https://muse.space`
- URL: `https://muse.space/v1/icloud_mail/search`
- Auth: HTTP bearer

Search one folder by sender, recipient, subject, text, date or flags, newest first, without bodies; while code and link hiding is on, terms with digits or URL punctuation miss very recent mail.

## Request body

- MailSearchInput
  - `folder` string: Folder path as given by list_folders.
  - `from` string: Sender name or address contains this.
  - `to` string: Recipient name or address contains this.
  - `subject` string: Subject contains this. Recent mail is left out as for `text`.
  - `text` string: Subject or body contains this. While hiding is on, a term with a digit misses the last hour of mail, one with URL punctuation (= ? & / % : #) the last day.
  - `since` string, date-time: Received at or after this time: with Z or an offset, or a date, from its start in UTC.
  - `before` string, date-time: Received before this time: with Z or an offset, or a date, from its start in UTC.
  - `unread` boolean: True for unread only, false for read only.
  - `flagged` boolean: True for flagged only, false for unflagged only.
  - `limit` integer: How many messages to return.
  - `cursor` string: `next_cursor` of the previous page, same filters.

## Response `200`

The result.

- MailSearchOutput
  - `messages` object[], required
    - `id` string, required
    - `date` string, date-time, required
    - `from` string, required
    - `to` string[], required
    - `subject` string, required
    - `unread` boolean, required
    - `flagged` boolean, required
    - `has_attachments` boolean, required
  - `total` integer, required
  - `next_cursor` string, nullable, required

## Other responses

- `401`: `unauthorized`, `token_revoked`, `token_expired`
- `403`: `forbidden`, `recipient_not_allowed`
- `404`: `not_found`
- `409`: `reconnect_required`, `changed_since_read`
- `413`: `too_large`
- `422`: `invalid_arguments`, `unreadable`
- `429`: `rate_limited`, `send_cap_reached`, `send_cooldown`
- `500`: `internal`
- `502`: `upstream_unavailable`, `upstream_rejected`, `delivery_unconfirmed`

---

[API](https://skmtc.dev/muse/apis/muse-space-tool-catalogue.md) · [All operations](https://skmtc.dev/muse/apis/muse-space-tool-catalogue/llms.txt) · [OpenAPI document](https://skmtc.dev/muse/apis/muse-space-tool-catalogue/revisions/8bef59003b3c?raw)
