Get an API key
Mailbox

messages.search()

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

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

free40 by defaultsummaries
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

const { messages } = await box.messages.search("invoice");
const inInbox = await box.messages.search("invoice", { folder: "inbox", limit: 20 });
messages = box.messages.search("invoice")["messages"]
in_inbox = box.messages.search("invoice", folder="inbox", limit=20)
querystringrequired

Words to look for.

folderstring

Only that folder. Every folder by default.

limitinteger40

How many.

It returns summaries

The same shape as a listing — sender, subject, date, flags, picture. get() for a whole message.

It searches words, not meaning

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

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

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