# messages.search()

Canonical URL: https://developers.iagenify.com/sdk/ref/mailbox/messages/search/
Language: en

`mailbox.messages.search(query, { folder?, limit? }) → Promise<Page>`

Finds messages by words, across folders or inside one. Summaries, like a listing.

Status: free · 40 by default · summaries

```javascript
const { messages } = await box.messages.search("invoice");
const inInbox = await box.messages.search("invoice", { folder: "inbox", limit: 20 });
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `query` | string | required | Words to look for. |
| `folder` | string |  | Only that folder. Every folder by default. |
| `limit` | integer | 40 | How many. |

## It returns summaries {#summaries}

The same shape as a listing — sender, subject, date, flags, picture. [get()](/sdk/ref/mailbox/messages/get) for a whole message.

## It searches words, not meaning {#words}

> **For meaning, documents are a different mechanism**
>
> Semantic search works on documents uploaded to a storage, not on a mailbox. This finds « invoice » in messages that contain the word.

## All folders by default {#folders}

Including trash and spam — which is usually what someone looking for a message wants, and occasionally surprising. Pass `folder` to narrow it.

## There is no cursor here {#no-cursor}

A search returns its best results up to `limit`. To go deeper, narrow the query or the folder rather than paging.

- [messages.list()](/sdk/ref/mailbox/messages/list): Walking a folder instead.
- [messages.get()](/sdk/ref/mailbox/messages/get): A whole message.

```python
messages = box.messages.search("invoice")["messages"]
in_inbox = box.messages.search("invoice", folder="inbox", limit=20)
```
