published on Wednesday, Oct 21, 2026 by Pulumi
published on Wednesday, Oct 21, 2026 by Pulumi
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleMonetizationRules = new cloudflare.MonetizationRules("example_monetization_rules", {
zoneId: "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,
}],
});
import pulumi
import pulumi_cloudflare as cloudflare
example_monetization_rules = cloudflare.MonetizationRules("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,
}])
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudflare.NewMonetizationRules(ctx, "example_monetization_rules", &cloudflare.MonetizationRulesArgs{
ZoneId: pulumi.String("9f1839b6152d298aca64c4e906b6d074"),
Rules: cloudflare.MonetizationRulesRuleArray{
&cloudflare.MonetizationRulesRuleArgs{
Address: pulumi.String("0x1234567890abcdef1234567890abcdef12345678==="),
Expression: pulumi.String("(http.request.uri.path eq \"/premium\" and http.request.method in {\"GET\" \"POST\"})"),
Price: pulumi.String("250000"),
Scheme: pulumi.String("exact"),
Id: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
Description: pulumi.String("Premium API endpoint"),
Enabled: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var exampleMonetizationRules = new Cloudflare.MonetizationRules("example_monetization_rules", new()
{
ZoneId = "9f1839b6152d298aca64c4e906b6d074",
Rules = new[]
{
new Cloudflare.Inputs.MonetizationRulesRuleArgs
{
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,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.MonetizationRules;
import com.pulumi.cloudflare.MonetizationRulesArgs;
import com.pulumi.cloudflare.inputs.MonetizationRulesRuleArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleMonetizationRules = new MonetizationRules("exampleMonetizationRules", MonetizationRulesArgs.builder()
.zoneId("9f1839b6152d298aca64c4e906b6d074")
.rules(MonetizationRulesRuleArgs.builder()
.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)
.build())
.build());
}
}
resources:
exampleMonetizationRules:
type: cloudflare:MonetizationRules
name: example_monetization_rules
properties:
zoneId: 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
terraform {
required_providers {
cloudflare = {
source = "pulumi/cloudflare"
}
}
}
resource "cloudflare_monetization_rules" "example_monetization_rules" {
lifecycle {
create_before_destroy = true
}
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
}
}
Create MonetizationRules Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MonetizationRules(name: string, args: MonetizationRulesArgs, opts?: CustomResourceOptions);@overload
def MonetizationRules(resource_name: str,
args: MonetizationRulesArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MonetizationRules(resource_name: str,
opts: Optional[ResourceOptions] = None,
rules: Optional[Sequence[MonetizationRulesRuleArgs]] = None,
zone_id: Optional[str] = None)func NewMonetizationRules(ctx *Context, name string, args MonetizationRulesArgs, opts ...ResourceOption) (*MonetizationRules, error)public MonetizationRules(string name, MonetizationRulesArgs args, CustomResourceOptions? opts = null)
public MonetizationRules(String name, MonetizationRulesArgs args)
public MonetizationRules(String name, MonetizationRulesArgs args, CustomResourceOptions options)
type: cloudflare:MonetizationRules
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "cloudflare_monetization_rules" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args MonetizationRulesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MonetizationRulesArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MonetizationRulesArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MonetizationRulesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MonetizationRulesArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var monetizationRulesResource = new Cloudflare.MonetizationRules("monetizationRulesResource", new()
{
Rules = new[]
{
new Cloudflare.Inputs.MonetizationRulesRuleArgs
{
Address = "string",
Expression = "string",
Scheme = "string",
Description = "string",
Enabled = false,
Id = "string",
Price = "string",
},
},
ZoneId = "string",
});
example, err := cloudflare.NewMonetizationRules(ctx, "monetizationRulesResource", &cloudflare.MonetizationRulesArgs{
Rules: cloudflare.MonetizationRulesRuleArray{
&cloudflare.MonetizationRulesRuleArgs{
Address: pulumi.String("string"),
Expression: pulumi.String("string"),
Scheme: pulumi.String("string"),
Description: pulumi.String("string"),
Enabled: pulumi.Bool(false),
Id: pulumi.String("string"),
Price: pulumi.String("string"),
},
},
ZoneId: pulumi.String("string"),
})
resource "cloudflare_monetization_rules" "monetizationRulesResource" {
lifecycle {
create_before_destroy = true
}
rules {
address = "string"
expression = "string"
scheme = "string"
description = "string"
enabled = false
id = "string"
price = "string"
}
zone_id = "string"
}
var monetizationRulesResource = new MonetizationRules("monetizationRulesResource", MonetizationRulesArgs.builder()
.rules(MonetizationRulesRuleArgs.builder()
.address("string")
.expression("string")
.scheme("string")
.description("string")
.enabled(false)
.id("string")
.price("string")
.build())
.zoneId("string")
.build());
monetization_rules_resource = cloudflare.MonetizationRules("monetizationRulesResource",
rules=[{
"address": "string",
"expression": "string",
"scheme": "string",
"description": "string",
"enabled": False,
"id": "string",
"price": "string",
}],
zone_id="string")
const monetizationRulesResource = new cloudflare.MonetizationRules("monetizationRulesResource", {
rules: [{
address: "string",
expression: "string",
scheme: "string",
description: "string",
enabled: false,
id: "string",
price: "string",
}],
zoneId: "string",
});
type: cloudflare:MonetizationRules
properties:
rules:
- address: string
description: string
enabled: false
expression: string
id: string
price: string
scheme: string
zoneId: string
MonetizationRules Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The MonetizationRules resource accepts the following input properties:
- Rules
List<Monetization
Rules Rule> - 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.
- Zone
Id string - The unique ID of the zone.
- Rules
[]Monetization
Rules Rule Args - 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.
- Zone
Id string - The unique ID of the zone.
- rules list(object)
- 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.
- zone_
id string - The unique ID of the zone.
- rules
List<Monetization
Rules Rule> - 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.
- zone
Id String - The unique ID of the zone.
- rules
Monetization
Rules Rule[] - 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.
- zone
Id string - The unique ID of the zone.
- rules
Sequence[Monetization
Rules Rule Args] - 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.
- zone_
id str - The unique ID of the zone.
- rules List<Property Map>
- 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.
- zone
Id String - The unique ID of the zone.
Outputs
All input properties are implicitly available as output properties. Additionally, the MonetizationRules resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing MonetizationRules Resource
Get an existing MonetizationRules resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MonetizationRulesState, opts?: CustomResourceOptions): MonetizationRules@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
rules: Optional[Sequence[MonetizationRulesRuleArgs]] = None,
zone_id: Optional[str] = None) -> MonetizationRulesfunc GetMonetizationRules(ctx *Context, name string, id IDInput, state *MonetizationRulesState, opts ...ResourceOption) (*MonetizationRules, error)public static MonetizationRules Get(string name, Input<string> id, MonetizationRulesState? state, CustomResourceOptions? opts = null)public static MonetizationRules get(String name, Output<String> id, MonetizationRulesState state, CustomResourceOptions options)resources: _: type: cloudflare:MonetizationRules get: id: ${id}import {
to = cloudflare_monetization_rules.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Rules
List<Monetization
Rules Rule> - 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.
- Zone
Id string - The unique ID of the zone.
- Rules
[]Monetization
Rules Rule Args - 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.
- Zone
Id string - The unique ID of the zone.
- rules list(object)
- 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.
- zone_
id string - The unique ID of the zone.
- rules
List<Monetization
Rules Rule> - 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.
- zone
Id String - The unique ID of the zone.
- rules
Monetization
Rules Rule[] - 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.
- zone
Id string - The unique ID of the zone.
- rules
Sequence[Monetization
Rules Rule Args] - 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.
- zone_
id str - The unique ID of the zone.
- rules List<Property Map>
- 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.
- zone
Id String - The unique ID of the zone.
Supporting Types
MonetizationRulesRule, MonetizationRulesRuleArgs
- 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.
- Expression string
- Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.
- 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. Available values: "exact", "upto", "originControlled".
- Description string
- Enabled bool
- 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.
- 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 "origincontrolled" 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 "origincontrolled" rules; the pattern matches exactly the set of values the server accepts.
- 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.
- Expression string
- Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.
- 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. Available values: "exact", "upto", "originControlled".
- Description string
- Enabled bool
- 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.
- 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 "origincontrolled" 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 "origincontrolled" rules; the pattern matches exactly the set of values the server accepts.
- 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.
- expression string
- Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.
- 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. Available values: "exact", "upto", "originControlled".
- description string
- enabled bool
- 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.
- 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 "origincontrolled" 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 "origincontrolled" rules; the pattern matches exactly the set of values the server accepts.
- 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.
- expression String
- Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.
- 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. Available values: "exact", "upto", "originControlled".
- description String
- enabled Boolean
- 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.
- 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 "origincontrolled" 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 "origincontrolled" rules; the pattern matches exactly the set of values the server accepts.
- 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.
- expression string
- Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.
- 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. Available values: "exact", "upto", "originControlled".
- description string
- enabled boolean
- 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.
- 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 "origincontrolled" 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 "origincontrolled" rules; the pattern matches exactly the set of values the server accepts.
- address str
- 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.
- expression str
- Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.
- scheme str
- 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. Available values: "exact", "upto", "originControlled".
- description str
- enabled bool
- id str
- 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.
- price str
- 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 "origincontrolled" 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 "origincontrolled" rules; the pattern matches exactly the set of values the server accepts.
- 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.
- expression String
- Wirefilter expression identifying the requests that require payment. Forwarded verbatim to the Rulesets API, which validates its syntax.
- 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. Available values: "exact", "upto", "originControlled".
- description String
- enabled Boolean
- 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.
- 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 "origincontrolled" 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 "origincontrolled" rules; the pattern matches exactly the set of values the server accepts.
Import
$ pulumi import cloudflare:index/monetizationRules:MonetizationRules example '<zone_id>'
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflareTerraform Provider.
published on Wednesday, Oct 21, 2026 by Pulumi