{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/signupbouncer-com/json-schema/signupbouncer-com-rules-schema.json",
  "title": "Rules",
  "description": "An app's Rules settings, as the Rules tab of the dashboard shows them, and read-only context.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/signupbouncer-com-openapi.json#/components/schemas/Rules",
  "type": "object",
  "required": [
    "app",
    "mode",
    "challenge_at",
    "block_at",
    "challenge_action",
    "block_message",
    "why_link",
    "velocity",
    "checks",
    "context"
  ],
  "properties": {
    "app": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^app_[0-9a-f]{24}$"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "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.",
      "required": [
        "subnet",
        "asn",
        "inbox",
        "pattern",
        "domain",
        "ip"
      ],
      "properties": {
        "subnet": {
          "type": "object",
          "required": [
            "app",
            "account"
          ],
          "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."
            }
          }
        },
        "asn": {
          "type": "object",
          "required": [
            "app",
            "account"
          ],
          "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."
            }
          }
        },
        "inbox": {
          "type": "object",
          "required": [
            "app"
          ],
          "properties": {
            "app": {
              "type": "integer",
              "oneOf": [
                {
                  "const": 0
                },
                {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 10000
                }
              ],
              "description": "0 turns this count off. Otherwise 2 to 10000."
            }
          }
        },
        "pattern": {
          "type": "object",
          "required": [
            "app",
            "account"
          ],
          "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."
            }
          }
        },
        "domain": {
          "type": "object",
          "required": [
            "app",
            "account"
          ],
          "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."
            }
          }
        },
        "ip": {
          "type": "object",
          "required": [
            "app",
            "account"
          ],
          "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."
            }
          }
        }
      }
    },
    "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.",
      "required": [
        "disposable_domain",
        "stale_list_domain",
        "burner_mx",
        "free_subdomain_mail",
        "repeat_inbox",
        "relay_service",
        "role_account",
        "datacenter_ip",
        "vpn_ip",
        "tor_exit",
        "hijacked_network",
        "residential_proxy",
        "ai_agent"
      ],
      "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"
          ]
        }
      }
    },
    "context": {
      "type": "object",
      "description": "Read-only. A PATCH that sends it is refused.",
      "required": [
        "plan",
        "velocity_counted",
        "locked_checks",
        "checks_above_plan",
        "check_choices",
        "velocity_windows",
        "defaults",
        "limits",
        "dashboard"
      ],
      "properties": {
        "plan": {
          "type": "string",
          "enum": [
            "free",
            "starter",
            "pro",
            "scale"
          ]
        },
        "velocity_counted": {
          "type": "boolean",
          "description": "Whether velocity points count on your plan (Pro and up)."
        },
        "locked_checks": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "invalid_syntax",
              "no_mx"
            ]
          },
          "description": "Checks that always block and have no setting."
        },
        "checks_above_plan": {
          "type": "array",
          "description": "Checks your plan does not count, with the plan they need. Their setting cannot change.",
          "items": {
            "type": "object",
            "required": [
              "code",
              "plan"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "disposable_domain",
                  "stale_list_domain",
                  "burner_mx",
                  "free_subdomain_mail",
                  "repeat_inbox",
                  "relay_service",
                  "role_account",
                  "datacenter_ip",
                  "vpn_ip",
                  "tor_exit",
                  "hijacked_network",
                  "residential_proxy",
                  "ai_agent"
                ]
              },
              "plan": {
                "type": "string",
                "enum": [
                  "free",
                  "starter",
                  "pro",
                  "scale"
                ]
              }
            }
          }
        },
        "check_choices": {
          "type": "object",
          "description": "The values each check takes.",
          "properties": {
            "disposable_domain": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "stale_list_domain": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "burner_mx": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "free_subdomain_mail": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "repeat_inbox": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "relay_service": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "role_account": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "datacenter_ip": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "vpn_ip": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "tor_exit": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "hijacked_network": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "residential_proxy": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            },
            "ai_agent": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "default",
                  "off",
                  "challenge",
                  "block"
                ]
              }
            }
          }
        },
        "velocity_windows": {
          "type": "object",
          "properties": {
            "subnet": {
              "type": "string"
            },
            "asn": {
              "type": "string"
            },
            "inbox": {
              "type": "string"
            },
            "pattern": {
              "type": "string"
            },
            "domain": {
              "type": "string"
            },
            "ip": {
              "type": "string"
            }
          }
        },
        "defaults": {
          "type": "object",
          "description": "A new app's settings.",
          "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.",
              "required": [
                "subnet",
                "asn",
                "inbox",
                "pattern",
                "domain",
                "ip"
              ],
              "properties": {
                "subnet": {
                  "type": "object",
                  "required": [
                    "app",
                    "account"
                  ],
                  "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."
                    }
                  }
                },
                "asn": {
                  "type": "object",
                  "required": [
                    "app",
                    "account"
                  ],
                  "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."
                    }
                  }
                },
                "inbox": {
                  "type": "object",
                  "required": [
                    "app"
                  ],
                  "properties": {
                    "app": {
                      "type": "integer",
                      "oneOf": [
                        {
                          "const": 0
                        },
                        {
                          "type": "integer",
                          "minimum": 2,
                          "maximum": 10000
                        }
                      ],
                      "description": "0 turns this count off. Otherwise 2 to 10000."
                    }
                  }
                },
                "pattern": {
                  "type": "object",
                  "required": [
                    "app",
                    "account"
                  ],
                  "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."
                    }
                  }
                },
                "domain": {
                  "type": "object",
                  "required": [
                    "app",
                    "account"
                  ],
                  "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."
                    }
                  }
                },
                "ip": {
                  "type": "object",
                  "required": [
                    "app",
                    "account"
                  ],
                  "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."
                    }
                  }
                }
              }
            }
          }
        },
        "limits": {
          "type": "object",
          "required": [
            "velocity_min",
            "velocity_max",
            "velocity_max_by_rule",
            "block_message_max"
          ],
          "properties": {
            "velocity_min": {
              "type": "integer"
            },
            "velocity_max": {
              "type": "integer"
            },
            "velocity_max_by_rule": {
              "type": "object",
              "description": "The highest threshold per rule where it differs from velocity_max. ip stops one below the number of other inboxes at which we treat an address as shared, since a higher threshold could never fire.",
              "additionalProperties": {
                "type": "integer"
              }
            },
            "block_message_max": {
              "type": "integer"
            }
          }
        },
        "dashboard": {
          "type": "string",
          "format": "uri",
          "description": "The app's Rules tab on the dashboard."
        }
      }
    }
  }
}