---
title: Get a payment rule
---

[Skip to content](#_top)

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

[Monetization](https://developers.cloudflare.com/api/go/resources/monetization)

[Rules](https://developers.cloudflare.com/api/go/resources/monetization/subresources/rules)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Get a payment rule

client.Monetization.Rules.GetRule(ctx, ruleID, query) (\*[MonetizationRule](<https://developers.cloudflare.com/api/go/resources/monetization#(resource)%20monetization.rules%20%3E%20(model)%20monetization_rule%20%3E%20(schema)>), error)

GET/zones/{zone\_id}/monetization/rules/{rule\_id}

Returns a single Payment Required rule identified by its ID.

##### 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

ruleID string

maxLength32

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(method)%20get_rule%20%3E%20(params)%20default%20%3E%20(param)%20rule_id%20%3E%20(schema)>)

<details>

<summary>

query RuleGetRuleParams

</summary>

ZoneID param.Field\[string]

The unique ID of the zone.

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

</details>

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(method)%20get_rule%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type MonetizationRule interface{…}

Payment rule with a fixed price set at configuration time.

</summary>

One of the following:

<details>

<summary>

type MonetizationRuleMonetizationRulesMonetizationRuleInputFixedPrice struct{…}

Payment rule with a fixed price set at configuration time.

</summary>

ID string

The server-assigned unique ID of the payment rule. Stable across full-ruleset replacements.

maxLength32

<a href="#(resource)%20monetization.rules%20%3E%20(model)%20monetization_rule%20%3E%20(schema)%20%3E%20(variant)%200%20%3E%20(entry)%201%20%3E%20(property)%20id">Link to this property</a>

</details>

<a href="#(resource)%20monetization.rules%20%3E%20(model)%20monetization_rule%20%3E%20(schema)%20%3E%20(variant)%200">Link to this property</a>

<details>

<summary>

type MonetizationRuleMonetizationRulesMonetizationRuleInputOriginControlled struct{…}

Payment rule whose price the origin server sets dynamically. The rule carries no price and the price field must be omitted — any provided value, including “0”, is rejected because it would not be enforced.

</summary>

ID string

The server-assigned unique ID of the payment rule. Stable across full-ruleset replacements.

maxLength32

<a href="#(resource)%20monetization.rules%20%3E%20(model)%20monetization_rule%20%3E%20(schema)%20%3E%20(variant)%201%20%3E%20(entry)%201%20%3E%20(property)%20id">Link to this property</a>

</details>

<a href="#(resource)%20monetization.rules%20%3E%20(model)%20monetization_rule%20%3E%20(schema)%20%3E%20(variant)%201">Link to this property</a>

</details>

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(model)%20monetization_rule%20%3E%20(schema)>)

### Get a payment rule

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  monetizationRule, err := client.Monetization.Rules.GetRule(
    context.TODO(),
    "023e105f4ecef8ad9ca31a8372d0c353",
    monetization.RuleGetRuleParams{
      ZoneID: cloudflare.F("9f1839b6152d298aca64c4e906b6d074"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", monetizationRule)
}
```

200 example

```
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "address": "0x1234567890abcdef1234567890abcdef12345678===",
    "expression": "(http.request.uri.path eq \"/premium\" and http.request.method in {\"GET\" \"POST\"})",
    "price": "250000",
    "scheme": "exact",
    "id": "023e105f4ecef8ad9ca31a8372d0c353",
    "description": "Premium API endpoint",
    "enabled": true
  },
  "success": true
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "address": "0x1234567890abcdef1234567890abcdef12345678===",
    "expression": "(http.request.uri.path eq \"/premium\" and http.request.method in {\"GET\" \"POST\"})",
    "price": "250000",
    "scheme": "exact",
    "id": "023e105f4ecef8ad9ca31a8372d0c353",
    "description": "Premium API endpoint",
    "enabled": true
  },
  "success": true
}
```