# List your recent messages

`GET https://api.mailmasker.org/api/v1/mail/messages`

The sender, subject and date of the newest messages in one folder.

- Who can use it: Any signed-in account
- Area: Mail
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/mail-list

The most recent messages in a folder, the oldest of them first. Each `uid` is the message's lasting number in that folder; use it to read the message. Listing doesn't mark anything as read.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `mailbox` | query | no | The folder to list. INBOX if you leave it out. |  |
| `limit` | query | no | How many of the newest messages to return. 20 if you leave it out. | `10` |

## Good to know

- A folder that doesn't exist answers 502, the same as when your mailbox can't be reached.

## Examples

cURL:

```bash
curl -s 'https://api.mailmasker.org/api/v1/mail/messages?limit=10' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

```perl
use Mojo::Base -strict;
use Mojo::UserAgent;

my $ua  = Mojo::UserAgent->new;
my $res = $ua->get('https://api.mailmasker.org/api/v1/mail/messages',
    { Authorization => "Bearer $ENV{TOKEN}" },
    form => { limit => 10 })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

```bash
homelab-cli mail list --limit 10
```

## Response

200 OK:

```json
[
  {
    "uid": "41",
    "from": "Alex <alex@example.com>",
    "subject": "Lunch on Friday?",
    "date": "Tue, 3 Nov 2026 12:05:44 -0600"
  },
  {
    "uid": "42",
    "from": "billing@example.com",
    "subject": "Your November invoice",
    "date": "Tue, 3 Nov 2026 21:42:10 -0600"
  }
]
```
