Get an API key
Mailbox

messages.list()

mailbox.messages.list({ folder?, limit?, cursor?, unread? }) → Promise<Page>

A folder, newest first. The cursor is a date, not a page number — so a message arriving while you read shifts nothing.

free40 by defaultsummaries, not bodies
Using Python?

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

const { messages, nextCursor, unreadCount } =
  await box.messages.list({ folder: "inbox", limit: 40, unread: true });

while (nextCursor) {
  const page = await box.messages.list({ folder: "inbox", cursor: nextCursor });
}
page = box.messages.list(folder="inbox", limit=40, unread=True)
messages, next_cursor, unread_count = page["messages"], page.get("nextCursor"), page.get("unreadCount")

while next_cursor:
    page = box.messages.list(folder="inbox", cursor=next_cursor)
    next_cursor = page.get("nextCursor")
folderstringinbox

inbox · sent · drafts · spam · trash.

limitinteger40

How many.

cursorstring

From the previous page's nextCursor.

unreadbooleanfalse

Only unread.

A date, not a page number

Paging by number double-counts on a moving list

A message arriving between two pages pushes everything down, so page two repeats the last of page one. A date cursor is immune: it means « older than this », and new mail lands above it.

A summary is not the message

Sender, subject, date, flags, and the sender's picture. No body, no HTML, and attachments is a count — a page of forty full messages would be enormous for a list nobody reads in full.

The sender's picture is in the list

Which is where it is most useful. It is resolved when the message is delivered, not when it is read — so reading a folder is a read of our own data, with nothing fetched from outside.

unreadCount is for the folder

Not for the page. It is the number a badge should show.