---
title: List account or zone routing rules
---

[Skip to content](#%5Ftop) 

[API Reference](https://developers.cloudflare.com/api/python)

[Email Routing](https://developers.cloudflare.com/api/python/resources/email%5Frouting)

[Account Rules](https://developers.cloudflare.com/api/python/resources/email%5Frouting/subresources/account%5Frules)

Copy Markdown

Open in **Claude**

Open in **ChatGPT**

Open in **Cursor**

---

**Copy Markdown**

**View as Markdown**

# List account or zone routing rules

email\_routing.account\_rules.list(AccountRuleListParams\*\*kwargs)  \-> SyncV4PagePaginationArray\[[AccountRule](https://developers.cloudflare.com/api/python/resources/email%5Frouting#%28resource%29%20email%5Frouting.account%5Frules%20%3E%20%28model%29%20account%5Frule%20%3E%20%28schema%29)\]

GET/{accounts\_or\_zones}/{account\_or\_zone\_id}/email/routing/rules

Lists existing routing rules across all zones in the account or zone.

##### Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**`X-Auth-Email: user@example.com`

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**`X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194`

##### ParametersExpand Collapse 

account\_id: Optional\[str\]

The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

zone\_id: Optional\[str\]

The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.

enabled: Optional\[Literal\[true, false\]\]

Filter by enabled routing rules.

One of the following:

true

false

page: Optional\[float\]

Page number of paginated results.

minimum1

per\_page: Optional\[float\]

Maximum number of results per page.

maximum50

minimum5

##### ReturnsExpand Collapse 

class AccountRule: …

id: Optional\[str\]

Routing rule identifier.

maxLength32

actions: Optional\[List\[[Action](https://developers.cloudflare.com/api/python/resources/email%5Frouting#%28resource%29%20email%5Frouting.rules%20%3E%20%28model%29%20action%20%3E%20%28schema%29)\]\]

List actions patterns.

type: Literal\["drop", "forward", "worker"\]

Type of supported action.

One of the following:

"drop"

"forward"

"worker"

value: Optional\[List\[str\]\]

enabled: Optional\[Literal\[true, false\]\]

Routing rule status.

One of the following:

true

false

matchers: Optional\[List\[[Matcher](https://developers.cloudflare.com/api/python/resources/email%5Frouting#%28resource%29%20email%5Frouting.rules%20%3E%20%28model%29%20matcher%20%3E%20%28schema%29)\]\]

Matching patterns to forward to your actions.

type: Literal\["all", "literal"\]

Type of matcher.

One of the following:

"all"

"literal"

field: Optional\[Literal\["to"\]\]

Field for type matcher.

value: Optional\[str\]

Value for matcher.

maxLength90

name: Optional\[str\]

Routing rule name.

maxLength256

priority: Optional\[float\]

Priority of the routing rule.

minimum0

source: Optional\[Literal\["api", "wrangler"\]\]

Who manages the rule. `api` covers dashboard, generic API, and Terraform; `wrangler` means the rule is managed by a Worker’s wrangler.jsonc. Defaults to `api` when omitted on write.

One of the following:

"api"

"wrangler"

Deprecatedtag: Optional\[str\]

Routing rule tag. (Deprecated, replaced by routing rule identifier)

maxLength32

zone: Optional\[Zone\]

Zone information for the routing rule.

name: Optional\[str\]

Zone name.

tag: Optional\[str\]

Zone tag.

maxLength32

### List account or zone routing rules

Python

HTTPHTTP

TypeScriptTypeScript

PythonPython

GoGo

TerraformTerraform

```
import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_email=os.environ.get("CLOUDFLARE_EMAIL"),  # This is the default and can be omitted
    api_key=os.environ.get("CLOUDFLARE_API_KEY"),  # This is the default and can be omitted
)
page = client.email_routing.account_rules.list(
    account_id="account_id",
)
page = page.result[0]
print(page.id)
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "a7e6fb77503c41d8a7f3113c6918f10c",
      "actions": [
        {
          "type": "forward",
          "value": [
            "destinationaddress@example.net"
          ]
        }
      ],
      "enabled": true,
      "matchers": [
        {
          "type": "literal",
          "field": "to",
          "value": "test@example.com"
        }
      ],
      "name": "Send to user@example.net rule.",
      "priority": 0,
      "source": "api",
      "tag": "a7e6fb77503c41d8a7f3113c6918f10c",
      "zone": {
        "name": "example.com",
        "tag": "023e105f4ecef8ad9ca31a8372d0c353"
      }
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 1,
    "total_pages": 100
  }
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "a7e6fb77503c41d8a7f3113c6918f10c",
      "actions": [
        {
          "type": "forward",
          "value": [
            "destinationaddress@example.net"
          ]
        }
      ],
      "enabled": true,
      "matchers": [
        {
          "type": "literal",
          "field": "to",
          "value": "test@example.com"
        }
      ],
      "name": "Send to user@example.net rule.",
      "priority": 0,
      "source": "api",
      "tag": "a7e6fb77503c41d8a7f3113c6918f10c",
      "zone": {
        "name": "example.com",
        "tag": "023e105f4ecef8ad9ca31a8372d0c353"
      }
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 1,
    "total_pages": 100
  }
}
```