---
title: Monetization
---

[Skip to content](#_top)

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

Copy Markdown

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

---

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

# Monetization

#### MonetizationRules

#### resource cloudflare\_monetization\_rules

##### required Expand Collapse

zone\_id: String

The unique ID of the zone.

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20zone_id>)

<details>

<summary>

rules: List\[Attributes]

Full desired Payment Required ruleset. An empty array clears all payment rules. The ruleset may contain at most 40 unique wallet addresses; address comparison is case-insensitive. Every address must pass wallet screening before deployment.

</summary>

address: String

0x-prefixed 20-byte hexadecimal Ethereum address. Mixed-case addresses must carry a valid EIP-55 checksum; all-lowercase or all-uppercase addresses are also accepted. The address must pass wallet screening whenever its rule is deployed or patched.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20address">Link to this property</a>

expression: String

Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20expression">Link to this property</a>

price?: String

Price in the smallest indivisible unit of the configured payment token, encoded as a decimal string. Must be a canonical decimal integer in \[1000, 100000000]: no leading zeros, and a bare JSON number is rejected. The price is required for the fixed-price schemes (“exact” and “upto”) and must be at least 1000, the smallest amount the payment facilitator can settle ($0.001 for a 6-decimal token such as USDC), and at most 100000000 ($100 for a 6-decimal token). When the scheme is “origin\_controlled” the origin server sets pricing dynamically and the rule carries no price: the field must be omitted — any provided value, including “0”, is rejected because it would not be enforced. Responses always encode this as a string and omit it for “origin\_controlled” rules; the pattern matches exactly the set of values the server accepts.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20price">Link to this property</a>

scheme: String

X402 payment scheme. “exact” requires the specified payment amount; “upto” permits a payment up to the specified amount. Both fixed-price schemes require the price field.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20scheme">Link to this property</a>

id?: String

Optional on input. Include the ID of an existing payment rule to update it in place, preserving its stable identity across the full-ruleset replacement; omit it to create a new rule. An ID that does not match an existing payment rule in the zone is rejected. Rules omitted from the request are deleted.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20id">Link to this property</a>

description?: String

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20description">Link to this property</a>

enabled?: Bool

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20enabled">Link to this property</a>

</details>

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20rules>)

##### computed Expand Collapse

id: String

The unique ID of the zone.

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20id>)

### cloudflare\_monetization\_rules

Terraform

HTTPTypeScriptPythonGoTerraform

```
resource "cloudflare_monetization_rules" "example_monetization_rules" {
  zone_id = "9f1839b6152d298aca64c4e906b6d074"
  rules = [{
    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
  }]
}
```

#### data cloudflare\_monetization\_rules

##### required Expand Collapse

zone\_id: String

The unique ID of the zone.

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20zone_id>)

##### computed Expand Collapse

id: String

The unique ID of the zone.

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20id>)

<details>

<summary>

rules: List\[Attributes]

The zone’s payment rules, in the order they are evaluated. Empty when the zone has no payment rules.

</summary>

address: String

0x-prefixed 20-byte hexadecimal Ethereum address. Mixed-case addresses must carry a valid EIP-55 checksum; all-lowercase or all-uppercase addresses are also accepted. The address must pass wallet screening whenever its rule is deployed or patched.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20address">Link to this property</a>

expression: String

Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20expression">Link to this property</a>

price: String

Price in the smallest indivisible unit of the configured payment token, encoded as a decimal string. Must be a canonical decimal integer in \[1000, 100000000]: no leading zeros, and a bare JSON number is rejected. The price is required for the fixed-price schemes (“exact” and “upto”) and must be at least 1000, the smallest amount the payment facilitator can settle ($0.001 for a 6-decimal token such as USDC), and at most 100000000 ($100 for a 6-decimal token). When the scheme is “origin\_controlled” the origin server sets pricing dynamically and the rule carries no price: the field must be omitted — any provided value, including “0”, is rejected because it would not be enforced. Responses always encode this as a string and omit it for “origin\_controlled” rules; the pattern matches exactly the set of values the server accepts.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20price">Link to this property</a>

scheme: String

X402 payment scheme. “exact” requires the specified payment amount; “upto” permits a payment up to the specified amount. Both fixed-price schemes require the price field.

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20scheme">Link to this property</a>

id: String

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

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20id">Link to this property</a>

description: String

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20description">Link to this property</a>

enabled: Bool

<a href="#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules%20%3E%20(attribute)%20enabled">Link to this property</a>

</details>

[Link to this property](<#(resource)%20monetization.rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20rules>)

### cloudflare\_monetization\_rules

Terraform

HTTPTypeScriptPythonGoTerraform

```
data "cloudflare_monetization_rules" "example_monetization_rules" {
  zone_id = "9f1839b6152d298aca64c4e906b6d074"
}
```