List messages
cooper_list_messagesUse this when you need to check an inbox for new or recent mail (sent and received), for example after sending a message and waiting for a reply. Read-only; requires auth. Inputs: inbox_id (optional; inbox id, username, or email — omit to use the account's newest inbox), limit (optional, default 50, max 200), labels (optional; the message must have every label, for example ["unread"]), unread (optional boolean; true keeps only unread mail, false drops it), before (optional ISO-8601 exclusive upper bound on created_at), after (optional ISO-8601 exclusive lower bound on created_at), from (optional case-insensitive substring of From), to (optional case-insensitive substring of To or Cc), subject (optional case-insensitive substring), direction (optional inbound or outbound), thread_id (optional), ascending (optional; true returns oldest first), page_token (optional cursor), wait_seconds (optional integer from 0 to 55; when set, hold until unread mail arrives and return object inbox_wait with timed_out). Filters run on the server before limit. Returns {object:"list", inbox_id, data:[{id, thread_id, direction, status, from, to, subject, preview, created_at, labels, attachments?}], next_page_token}, newest first unless ascending is true. When wait_seconds is set, returns unread mail immediately if any is already stored. page_token is the base64url of created_at and id. Previews only, not full bodies: call cooper_get_message to read one message. Mark one read with cooper_update_message. Fails with 400 invalid_date, invalid_direction, invalid_ascending, invalid_page_token, invalid_label, invalid_unread, or label_conflict, or 404 inbox_not_found.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Case-insensitive substring of To or Cc. % and _ match those characters. | |
| from | No | Case-insensitive substring of From. % and _ match those characters. | |
| after | No | ISO-8601 exclusive lower bound on created_at. A bad value returns invalid_date. | |
| limit | No | Max messages to return (default 50, max 200) | |
| before | No | ISO-8601 exclusive upper bound on created_at. A bad value returns invalid_date. | |
| labels | No | Keep messages that have every one of these labels. Example: ["unread"]. | |
| unread | No | true lists only messages labeled unread. false omits them. | |
| subject | No | Case-insensitive substring of the subject. % and _ match those characters. | |
| inbox_id | No | Inbox id, username, or email. Omit to use the newest inbox. | |
| ascending | No | true lists oldest first. false, the default, lists newest first. | |
| direction | No | inbound or outbound. Anything else returns invalid_direction. | |
| thread_id | No | Only messages on this thread (thr_…). | |
| page_token | No | Cursor from next_page_token. A bad token returns invalid_page_token. | |
| wait_seconds | No | Optional. When set, hold until unread mail arrives, from 0 to 55 seconds. Returns immediately when unread mail is already stored. At most 5 waits can run at once for this key. The result is object inbox_wait with timed_out. |