{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/signupbouncer-com/json-schema/signupbouncer-com-rules-change-schema.json",
  "title": "RulesChange",
  "description": "Any of the settings, and only the ones to change. A field left out keeps its value. A field that is not listed here, or one wrong value, refuses the whole change with 400 invalid_body.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/signupbouncer-com-openapi.json#/components/schemas/RulesChange",
  "type": "object",
  "properties": {
    "mode": {
      "type": "string",
      "enum": [
        "shadow",
        "enforce"
      ],
      "description": "shadow checks and logs every signup and refuses none. enforce refuses signups marked block (and challenge, when challenge_action is block, in the Supabase and Ory hooks). Switching to enforce starts refusing real signups at once."
    },
    "challenge_at": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "The score that marks challenge."
    },
    "block_at": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "The score that marks block. It must be higher than challenge_at."
    },
    "challenge_action": {
      "type": "string",
      "enum": [
        "allow",
        "block"
      ],
      "description": "What the Supabase and Ory hooks do with a signup marked challenge: allow and log it, or refuse it. We always allow and log a signup that velocity points alone raised to challenge."
    },
    "block_message": {
      "type": "string",
      "description": "The message a refused person sees, 200 characters at most. We trim spaces and line breaks from both ends first and count what is left. On a PATCH, an empty string restores our default, which /v1/check and the Supabase hook word to fit the reason for each refusal."
    },
    "why_link": {
      "type": "boolean",
      "description": "Adds the \"Why was this refused?\" link to refusals."
    },
    "velocity": {
      "type": "object",
      "description": "Earlier signups in the rule's window before it adds points (subnet, asn, pattern and domain count an hour, inbox 24 hours, ip the other inboxes from the same IP address in 7 days). app counts this app. account counts every app of your account and is 0 or at least app. On plans below Pro the points stay in shadow.",
      "properties": {
        "subnet": {
          "type": "object",
          "properties": {
            "app": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            },
            "account": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            }
          },
          "additionalProperties": false
        },
        "asn": {
          "type": "object",
          "properties": {
            "app": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            },
            "account": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            }
          },
          "additionalProperties": false
        },
        "inbox": {
          "type": "object",
          "properties": {
            "app": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            }
          },
          "additionalProperties": false
        },
        "pattern": {
          "type": "object",
          "properties": {
            "app": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            },
            "account": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            }
          },
          "additionalProperties": false
        },
        "domain": {
          "type": "object",
          "properties": {
            "app": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            },
            "account": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            }
          },
          "additionalProperties": false
        },
        "ip": {
          "type": "object",
          "properties": {
            "app": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 19
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 19."
            },
            "account": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 19
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 19."
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "checks": {
      "type": "object",
      "description": "Per check: \"default\" (our points and rules), \"off\" (listed with 0 points), \"challenge\" (at least challenge when it fires, never toward a block) or \"block\" (block when it fires). \"block\" is not offered for checks that already block. invalid_syntax and no_mx always block and have no setting. A check above your plan keeps its stored setting, and a PATCH may only repeat it.",
      "properties": {
        "disposable_domain": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge"
          ]
        },
        "stale_list_domain": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "burner_mx": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge"
          ]
        },
        "free_subdomain_mail": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "repeat_inbox": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "relay_service": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "role_account": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "datacenter_ip": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "vpn_ip": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "tor_exit": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "hijacked_network": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "residential_proxy": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        },
        "ai_agent": {
          "type": "string",
          "enum": [
            "default",
            "off",
            "challenge",
            "block"
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}