# List received emails

`opensend inbound list`

The mail that arrived at the domains of the workspace, newest first. A test key may not read it.

Needs the scope: `emails:read`

## Flags

- `--q` (string): Text to search for. Only items that contain it are returned. Up to 40 characters.
- `--limit` (integer): How many items to return, from 1 to 100. Without it you get 25.
- `--offset` (integer): How many items to skip. Use it with `limit` to read the next page. Default: `0`.
- `--after` (string): The id of the last item you have. The answer starts with the item that follows it, which reads a long list without skipping or repeating when it changes meanwhile. Up to 64 characters.
- `--before` (string): The id of the first item you have. The answer ends with the item just before it. Give this or `after`, not both. Up to 64 characters.
- `--range` (string): The period to look at: `today`, `week`, `month`, `year`, `all` or `custom`. Without it there is no limit in time. One of: `today`, `week`, `month`, `year`, `all`, `custom`.
- `--from` (string): The first day of a `custom` period, as a date such as `2026-11-01`.
- `--to` (string): The last day of a `custom` period, as a date such as `2026-11-30`.
- `--domain` (string): Only mail received on this domain.

## Returns

The command prints the answer: as JSON when its output goes to a file or another program, and as a table or a list of fields in a terminal. When the API refuses, the error goes to the error stream and the command ends with a code that names the failure. [Output and scripts](https://opensend.sh/docs/scripting) lists the codes.

- `object` ("list"): Always `list`.
- `data` (object[]): The items on this page.
- `data[].object` ("inbound_email"): Always `inbound_email`.
- `data[].id` (string): The id of the received email.
- `data[].from` (string): The address it came from.
- `data[].fromName` (string | null): The name of the sender, or `null` when the message gave none.
- `data[].to` (string): The address it was sent to, on one of your domains.
- `data[].subject` (string): The subject line.
- `data[].domain` (string): The domain of yours that received it.
- `data[].spam` (boolean): Whether it was judged to be spam.
- `data[].size` (integer): The size of the whole message in bytes.
- `data[].attachments` (integer): How many files were attached.
- `data[].createdAt` (string): When it arrived.
- `total` (integer): How many items match in all, on every page together.
- `hasMore` (boolean): Whether more items follow this page.

## Example

CLI:

```bash
opensend inbound list --domain mail.example.com
```

Answer:

```json
{
  "object": "list",
  "data": [
    {
      "object": "inbound_email",
      "id": "in_01",
      "from": "grace@customer.example",
      "fromName": "Grace Hopper",
      "to": "support@mail.example.com",
      "subject": "A question about my invoice",
      "domain": "mail.example.com",
      "spam": false,
      "size": 48920,
      "attachments": 1,
      "createdAt": "2026-11-27T09:30:00.000Z"
    }
  ],
  "total": 1,
  "hasMore": false
}
```
