Lists

Filter emails by allowing or blocking specific addresses and domains.

What are Lists?

Lists allow you to filter emails by allowing or blocking specific email addresses or domains. There are six list types based on two dimensions:

  • Direction: send, receive, or reply
  • Type: allow or block
ListDescription
Receive allowOnly accept emails from these addresses or domains
Receive blockReject emails from these addresses or domains
Send allowOnly send emails to these addresses or domains
Send blockPrevent sending emails to these addresses or domains
Reply allowOnly accept reply emails from these addresses or domains
Reply blockReject reply emails from these addresses or domains

Each entry can be either a full email address (e.g., partner@example.com) or an entire domain (e.g., example.com).

Scoping

Lists can be scoped at three levels. A narrower scope overrides a broader one:

  • Organization: Applies to all pods and inboxes in your org. Manage with client.lists.
  • Pod: Applies to all inboxes in a pod. Manage with client.pods.lists.
  • Inbox: Applies to a single inbox. Manage with client.inboxes.lists.

When evaluating whether to allow or block a message, AgentMail checks the most specific scope first. If an inbox-level list has a match, pod and org lists are not checked.

Reply lists

The reply direction handles inbound emails that are replies to previous outbound messages. When an inbound email arrives, AgentMail checks the In-Reply-To header to determine whether it is a reply:

  • If the email is a reply to a previous outbound message, only the reply lists are checked. The receive lists are skipped entirely.
  • If the email is not a reply, only the receive lists are checked. The reply lists are skipped entirely.

The two branches are completely separate. By default, when reply lists are empty, all replies are allowed. You can restrict replies by populating reply allow or reply block lists.

SDK examples

List entries

Retrieve entries from a list with optional pagination.

1entries = client.lists.list("receive", "allow", limit=10)

Create entry

Add an email address or domain to a list. The reason parameter is optional and available on block lists.

1# allow list - no reason needed
2client.lists.create("receive", "allow", entry="partner@example.com")
3
4# block list - reason optional
5client.lists.create("receive", "block", entry="spam@example.com", reason="spam")

Get entry

Retrieve a specific entry from a list by its email address or domain.

1entry = client.lists.get("receive", "allow", entry="partner@example.com")

Delete entry

Remove an entry from a list.

1client.lists.delete("receive", "allow", entry="partner@example.com")

Inbox-scoped lists

Manage lists for a specific inbox. The same operations are available at the inbox level.

1# Add to an inbox-level receive allowlist
2client.inboxes.lists.create(
3 "inbox_id", "receive", "allow", entry="vip@example.com"
4)
5
6# List inbox-level entries
7entries = client.inboxes.lists.list("inbox_id", "receive", "allow")

Reply lists

Control which addresses can send replies to an inbox’s outbound messages.

1# Only allow replies from a specific domain
2client.lists.create("reply", "allow", entry="nobu.com")

Copy for Cursor / Claude

Copy one of the blocks below into Cursor or Claude for complete Lists API knowledge in one shot.

1"""
2AgentMail Lists, copy into Cursor/Claude.
3
4Filter emails by allow/block for send/receive/reply. 6 types: receive|send|reply x allow|block.
5Lists can be scoped to org, pod, or inbox level.
6
7API reference (org-level):
8- lists.list(direction, type, limit?, page_token?)
9- lists.create(direction, type, entry, reason?), reason only for block lists
10- lists.get(direction, type, entry)
11- lists.delete(direction, type, entry)
12
13Pod-level: pods.lists.list(pod_id, direction, type, ...) and same for create/get/delete.
14Inbox-level: inboxes.lists.list(inbox_id, direction, type, ...) and same for create/get/delete.
15
16Entry: full email (user@domain.com) or domain (example.com).
17Cascade: inbox > pod > org (most specific scope wins).
18Reply lists: inbound replies (detected via In-Reply-To) check reply lists, not receive lists.
19"""
20from agentmail import AgentMail
21
22client = AgentMail(api_key="YOUR_API_KEY")
23
24# Org-level lists
25entries = client.lists.list("receive", "allow", limit=10)
26client.lists.create("receive", "allow", entry="partner@example.com")
27client.lists.create("receive", "block", entry="spam@example.com", reason="spam")
28e = client.lists.get("receive", "allow", entry="partner@example.com")
29client.lists.delete("receive", "allow", entry="partner@example.com")
30
31# Reply lists
32client.lists.create("reply", "allow", entry="nobu.com")
33
34# Inbox-level lists
35client.inboxes.lists.create("inbox_id", "receive", "allow", entry="vip@example.com")
36inbox_entries = client.inboxes.lists.list("inbox_id", "receive", "allow")