|
| 1 | +--- |
| 2 | +title: Lists |
| 3 | +subtitle: Filter emails by allowing or blocking specific addresses and domains. |
| 4 | +slug: lists |
| 5 | +description: Learn how to use Lists to control which email addresses and domains your agents can send to or receive from. |
| 6 | +--- |
| 7 | + |
| 8 | +## What are Lists? |
| 9 | + |
| 10 | +`Lists` allow you to filter emails by allowing or blocking specific email addresses or domains. There are four list types based on two dimensions: |
| 11 | + |
| 12 | +- **Direction**: `send` or `receive` |
| 13 | +- **Type**: `allow` or `block` |
| 14 | + |
| 15 | +| List | Description | |
| 16 | +| --- | --- | |
| 17 | +| Receive allow | Only accept emails from these addresses or domains | |
| 18 | +| Receive block | Reject emails from these addresses or domains | |
| 19 | +| Send allow | Only send emails to these addresses or domains | |
| 20 | +| Send block | Prevent sending emails to these addresses or domains | |
| 21 | + |
| 22 | +Each entry can be either a full email address (e.g., `partner@example.com`) or an entire domain (e.g., `example.com`). |
| 23 | + |
| 24 | +## SDK examples |
| 25 | + |
| 26 | +### List entries |
| 27 | + |
| 28 | +Retrieve entries from a list with optional pagination. |
| 29 | + |
| 30 | +<CodeBlocks> |
| 31 | +```python title="Python" |
| 32 | +entries = client.lists.list("receive", "allow", limit=10) |
| 33 | +``` |
| 34 | + |
| 35 | +```typescript title="TypeScript" |
| 36 | +const entries = await client.lists.list("receive", "allow", { limit: 10 }); |
| 37 | +``` |
| 38 | +</CodeBlocks> |
| 39 | + |
| 40 | +### Create entry |
| 41 | + |
| 42 | +Add an email address or domain to a list. The `reason` parameter is optional and available on block lists. |
| 43 | + |
| 44 | +<CodeBlocks> |
| 45 | +```python title="Python" |
| 46 | +# allow list - no reason needed |
| 47 | +client.lists.create("receive", "allow", entry="partner@example.com") |
| 48 | + |
| 49 | +# block list - reason optional |
| 50 | +client.lists.create("receive", "block", entry="spam@example.com", reason="spam") |
| 51 | +``` |
| 52 | + |
| 53 | +```typescript title="TypeScript" |
| 54 | +// allow list - no reason needed |
| 55 | +await client.lists.create("receive", "allow", { entry: "partner@example.com" }); |
| 56 | + |
| 57 | +// block list - reason optional |
| 58 | +await client.lists.create("receive", "block", { entry: "spam@example.com", reason: "spam" }); |
| 59 | +``` |
| 60 | +</CodeBlocks> |
| 61 | + |
| 62 | +### Get entry |
| 63 | + |
| 64 | +Retrieve a specific entry from a list by its email address or domain. |
| 65 | + |
| 66 | +<CodeBlocks> |
| 67 | +```python title="Python" |
| 68 | +entry = client.lists.get("receive", "allow", entry="partner@example.com") |
| 69 | +``` |
| 70 | + |
| 71 | +```typescript title="TypeScript" |
| 72 | +const entry = await client.lists.get("receive", "allow", "partner@example.com"); |
| 73 | +``` |
| 74 | +</CodeBlocks> |
| 75 | + |
| 76 | +### Delete entry |
| 77 | + |
| 78 | +Remove an entry from a list. |
| 79 | + |
| 80 | +<CodeBlocks> |
| 81 | +```python title="Python" |
| 82 | +client.lists.delete("receive", "allow", entry="partner@example.com") |
| 83 | +``` |
| 84 | + |
| 85 | +```typescript title="TypeScript" |
| 86 | +await client.lists.delete("receive", "allow", "partner@example.com"); |
| 87 | +``` |
| 88 | +</CodeBlocks> |
0 commit comments