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

[Skip to content](#_top)

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

[Email Routing](https://developers.cloudflare.com/api/go/resources/email_routing)

[Account Rules](https://developers.cloudflare.com/api/go/resources/email_routing/subresources/account_rules)

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_routing#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)>)], 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

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



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

**Example:**<code>X-Auth-Email: user@example.com</code>

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

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### ParametersExpand Collapse

<details>

<summary>

params AccountRuleListParams

</summary>

AccountID param.Field\[string]Optional

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

<a href="#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

ZoneID param.Field\[string]Optional

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

<a href="#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20zone_id">Link to this property</a>

<details>

<summary>

Enabled param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/email_routing/subresources/account_rules/methods/list#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20enabled%20%3E%20(schema)">AccountRuleListParamsEnabled</a>]Optional

Query param: Filter by enabled routing rules.

</summary>

const AccountRuleListParamsEnabledTrue <a href="https://developers.cloudflare.com/api/go/resources/email_routing/subresources/account_rules/methods/list#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20enabled%20%3E%20(schema)">AccountRuleListParamsEnabled</a> = true

<a href="#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20enabled%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const AccountRuleListParamsEnabledFalse <a href="https://developers.cloudflare.com/api/go/resources/email_routing/subresources/account_rules/methods/list#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20enabled%20%3E%20(schema)">AccountRuleListParamsEnabled</a> = false

<a href="#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20enabled%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20enabled">Link to this property</a>

Page param.Field\[float64]Optional

Query param: Page number of paginated results.

minimum1

<a href="#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20page">Link to this property</a>

PerPage param.Field\[float64]Optional

Query param: Maximum number of results per page.

maximum50

minimum5

<a href="#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20per_page">Link to this property</a>

</details>

[Link to this property](<#(resource)%20email_routing.account_rules%20%3E%20(method)%20list%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type AccountRule struct{…}

</summary>

ID stringOptional

Routing rule identifier.

maxLength32

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

Actions \[]<a href="https://developers.cloudflare.com/api/go/resources/email_routing#(resource)%20email_routing.rules%20%3E%20(model)%20action%20%3E%20(schema)">Action</a>Optional

List actions patterns.

</summary>

<details>

<summary>

Type ActionType

Type of supported action.

</summary>

One of the following:

const ActionTypeDrop ActionType = "drop"

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20action%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%200">Link to this property</a>

const ActionTypeForward ActionType = "forward"

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20action%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%201">Link to this property</a>

const ActionTypeWorker ActionType = "worker"

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20action%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20action%20%3E%20(schema)%20%3E%20(property)%20type">Link to this property</a>

Value \[]stringOptional

List of values for the action. Currently limited to a single value.

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20action%20%3E%20(schema)%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20actions">Link to this property</a>

<details>

<summary>

Enabled AccountRuleEnabledOptional

Routing rule status.

</summary>

One of the following:

const AccountRuleEnabledTrue AccountRuleEnabled = true

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20enabled%20%3E%20(member)%200">Link to this property</a>

const AccountRuleEnabledFalse AccountRuleEnabled = false

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20enabled%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20enabled">Link to this property</a>

<details>

<summary>

Matchers \[]<a href="https://developers.cloudflare.com/api/go/resources/email_routing#(resource)%20email_routing.rules%20%3E%20(model)%20matcher%20%3E%20(schema)">Matcher</a>Optional

Matching patterns to forward to your actions.

</summary>

<details>

<summary>

Type MatcherType

Type of matcher.

</summary>

One of the following:

const MatcherTypeAll MatcherType = "all"

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20matcher%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%200">Link to this property</a>

const MatcherTypeLiteral MatcherType = "literal"

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20matcher%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20matcher%20%3E%20(schema)%20%3E%20(property)%20type">Link to this property</a>

Field MatcherFieldOptional

Field for type matcher.

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20matcher%20%3E%20(schema)%20%3E%20(property)%20field">Link to this property</a>

Value stringOptional

Value for matcher.

maxLength90

<a href="#(resource)%20email_routing.rules%20%3E%20(model)%20matcher%20%3E%20(schema)%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20matchers">Link to this property</a>

Name stringOptional

Routing rule name.

maxLength256

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

Priority float64Optional

Priority of the routing rule.

minimum0

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20priority">Link to this property</a>

<details>

<summary>

Source AccountRuleSourceOptional

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

</summary>

One of the following:

const AccountRuleSourceAPI AccountRuleSource = "api"

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(member)%200">Link to this property</a>

const AccountRuleSourceWrangler AccountRuleSource = "wrangler"

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20source">Link to this property</a>

DeprecatedTag stringOptional

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

maxLength32

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20tag">Link to this property</a>

<details>

<summary>

Zone AccountRuleZoneOptional

Zone information for the routing rule.

</summary>

Name stringOptional

Zone name.

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20zone%20%3E%20(property)%20name">Link to this property</a>

Tag stringOptional

Zone tag.

maxLength32

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20zone%20%3E%20(property)%20tag">Link to this property</a>

</details>

<a href="#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)%20%3E%20(property)%20zone">Link to this property</a>

</details>

[Link to this property](<#(resource)%20email_routing.account_rules%20%3E%20(model)%20account_rule%20%3E%20(schema)>)

### List account or zone routing rules

Go

HTTPTypeScriptPythonGoTerraform

```
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.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  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
  }
}
```