Deploy payment ruleset
PUT/zones/{zone_id}/monetization/rules
Replaces the zone’s Payment Required ruleset with the submitted desired state. Submit an empty rules array to clear all payment rules.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Deploy payment ruleset
curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/monetization/rules \
-X PUT \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"rules": [
{
"address": "0x1234567890abcdef1234567890abcdef12345678===",
"expression": "(http.request.uri.path eq \\"/premium\\" and http.request.method in {\\"GET\\" \\"POST\\"})",
"price": "250000",
"scheme": "exact"
}
]
}'{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"result": {
"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
}
]
},
"success": true
}Returns Examples
{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"result": {
"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
}
]
},
"success": true
}