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

[Skip to content](#%5Ftop) 

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

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

[Account Rules](https://developers.cloudflare.com/api/go/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

client.EmailRouting.AccountRules.List(ctx, params) (\*V4PagePaginationArray\[[AccountRule](https://developers.cloudflare.com/api/go/resources/email%5Frouting#%28resource%29%20email%5Frouting.account%5Frules%20%3E%20%28model%29%20account%5Frule%20%3E%20%28schema%29)\], error)

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 

params AccountRuleListParams

AccountID param.Field\[string\]Optional

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

ZoneID param.Field\[string\]Optional

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

Enabled param.Field\[[AccountRuleListParamsEnabled](https://developers.cloudflare.com/api/go/resources/email%5Frouting/subresources/account%5Frules/methods/list#%28resource%29%20email%5Frouting.account%5Frules%20%3E%20%28method%29%20list%20%3E%20%28params%29%20default%20%3E%20%28param%29%20enabled%20%3E%20%28schema%29)\]Optional

Query param: Filter by enabled routing rules.

const AccountRuleListParamsEnabledTrue [AccountRuleListParamsEnabled](https://developers.cloudflare.com/api/go/resources/email%5Frouting/subresources/account%5Frules/methods/list#%28resource%29%20email%5Frouting.account%5Frules%20%3E%20%28method%29%20list%20%3E%20%28params%29%20default%20%3E%20%28param%29%20enabled%20%3E%20%28schema%29) \= true

const AccountRuleListParamsEnabledFalse [AccountRuleListParamsEnabled](https://developers.cloudflare.com/api/go/resources/email%5Frouting/subresources/account%5Frules/methods/list#%28resource%29%20email%5Frouting.account%5Frules%20%3E%20%28method%29%20list%20%3E%20%28params%29%20default%20%3E%20%28param%29%20enabled%20%3E%20%28schema%29) \= false

Page param.Field\[float64\]Optional

Query param: Page number of paginated results.

minimum1

PerPage param.Field\[float64\]Optional

Query param: Maximum number of results per page.

maximum50

minimum5

##### ReturnsExpand Collapse 

type AccountRule struct{…}

ID stringOptional

Routing rule identifier.

maxLength32

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

List actions patterns.

Type ActionType

Type of supported action.

One of the following:

const ActionTypeDrop ActionType \= "drop"

const ActionTypeForward ActionType \= "forward"

const ActionTypeWorker ActionType \= "worker"

Value \[\]stringOptional

Enabled AccountRuleEnabledOptional

Routing rule status.

One of the following:

const AccountRuleEnabledTrue AccountRuleEnabled \= true

const AccountRuleEnabledFalse AccountRuleEnabled \= false

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

Matching patterns to forward to your actions.

Type MatcherType

Type of matcher.

One of the following:

const MatcherTypeAll MatcherType \= "all"

const MatcherTypeLiteral MatcherType \= "literal"

Field MatcherFieldOptional

Field for type matcher.

Value stringOptional

Value for matcher.

maxLength90

Name stringOptional

Routing rule name.

maxLength256

Priority float64Optional

Priority of the routing rule.

minimum0

Source AccountRuleSourceOptional

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:

const AccountRuleSourceAPI AccountRuleSource \= "api"

const AccountRuleSourceWrangler AccountRuleSource \= "wrangler"

DeprecatedTag stringOptional

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

maxLength32

Zone AccountRuleZoneOptional

Zone information for the routing rule.

Name stringOptional

Zone name.

Tag stringOptional

Zone tag.

maxLength32

### List account or zone routing rules

Go

HTTPHTTP

TypeScriptTypeScript

PythonPython

GoGo

TerraformTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/email_routing"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  page, err := client.EmailRouting.AccountRules.List(context.TODO(), email_routing.AccountRuleListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}

```

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
  }
}
```