`lumail@2.1.0` · [`lumail.emails`](/docs/sdk/v2/emails)

```typescript
emails.list(params?: { limit?: number; after?: string; before?: string }): Promise<LumailResult<ListEmailsResponse>>
```

Newest first. Paginate with `after` or `before` email ids. Campaign sends and test emails are excluded.

## Query Parameters

Pass `after` or `before`, not both. The cursor must be an email id in this organization.

| Name | Type | Description |
| -------- | ------ | ----------------------------------------------------------------------- |
| `limit` | number | Page size. Default `20`. Min `1`, max `100`. |
| `after` | string | Return emails older than this id (next page, walking backward in time). |
| `before` | string | Return emails newer than this id. |

## Response Fields

| Field | Type | Description |
| ---------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `object` | `"list"` | Discriminator. Always `list`. |
| `has_more` | boolean | `true` when another page exists in the same direction. |
| `data` | `EmailObject[]` | Email rows, newest first. Same fields as [`emails.get`](/docs/sdk/v2/emails-get) except `object`, `html`, `text`, and `tags`. |

`data` is `{ object, data, has_more }`. Failures return `{ data: null, error: { name, message, statusCode } }`.


## API Reference
**Method:** GET
**Endpoint:** /api/v2/emails

### SDK
```ts
import { Lumail } from "lumail";

const lumail = new Lumail({ apiKey: process.env.LUMAIL_API_KEY });
const { data, error } = await lumail.emails.list({ limit: 20 });
if (error) {
  throw error;
}

for (const email of data.data) {
  console.log(email.id, email.last_event);
}

if (data.has_more) {
  const next = await lumail.emails.list({
    limit: 20,
    after: data.data.at(-1)?.id,
  });
  console.log(next.data?.data.length);
}
```

### cURL
```bash
curl "https://lumail.io/api/v2/emails?limit=20" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

curl "https://lumail.io/api/v2/emails?limit=20&after=eml_abc123def456" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

### JavaScript
```javascript
const response = await fetch("https://lumail.io/api/v2/emails?limit=20", {
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
});
const page = await response.json();

const next = await fetch(
  `https://lumail.io/api/v2/emails?limit=20&after=${page.data.at(-1).id}`,
  { headers: { Authorization: "Bearer YOUR_API_TOKEN" } },
);
await next.json();
```

### Success Response
```json
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "eml_abc123def456",
      "message_id": "0100018f3c2a1b2c-d4e5f6a7-89ab-cdef-0123-456789abcdef-000000",
      "to": ["user@example.com"],
      "from": "hello@yourdomain.com",
      "created_at": "2026-09-05T10:30:00.000Z",
      "subject": "Welcome",
      "last_event": "delivered"
    }
  ]
}
```

### Error Response
```json
{
  "name": "validation_error",
  "message": "Use either after or before, not both",
  "statusCode": 422
}
```
