Policies can be validated by attaching them to passes or directly via API calls. Passes that are tied to policies will automatically be validated each time they are scanned. To attach policies to passes, please refer to our guides under passes here. To validate passes policies our API, refer to the API reference here.
Each time a policy is validated, you will receive a JSON response containing a breakdown of the policy object and all the rules you have created for it. Within each rule, you will be able to determine whether the rule was satisfied or not, and if it failed, you will receive information on why it failed.
When validating policies using using api/v0/policies/validate, you'll see a response similar to this below.
"name": "Badam Bomb Squad",
The response is in the form of an array because it allows for the validation of multiple wallet addresses against policies. Each object within the array will contain three parent-level properties:
address property represents the wallet owner's address, while
satisfiesAllPolicies is a boolean value that simplifies determining whether all policies have been met.
policies property contains the same object properties as our policy model. In addition, it includes a
valid property that indicates whether the policy's requirements are met, and
verifiedBlockNumber, which specifies the block number used to check asset ownership requirements.
Each policy consists of one or more rules, which are represented by the
rules array within
policies. Each rule has the same object properties as our rule model. It also includes a
valid property that indicates whether the rule requirements are met, and a
results object that provides further information about the evaluated rule.
results object contains three possible properties:
currentBalance: This property reflects the balance of the user's wallet based on the rule type.
tokenChecks: If your rule has a condition that specifies a list of token IDs, this property will be present. It contains an array of objects that break down each token ID and its specific balance.
ruleViolation: An enumeration value that provides details on why a rule condition was not met.
Rule Violation Enum Values:
|ALLOW_LIST_CONDITION_NOT_MET||Wallet address is not included in the allow list|
|ATTRIBUTES_CONDITION_NOT_MET||User does not own an NFT with the required attributes|
|BALANCE_CONDITION_NOT_MET||User does not meet the balance requirements of the rule|
|HOLDING_TIME_CONDITION_NOT_MET||User holds the correct token, but does not meet the holding time requirements|
|OWNERSHIP_REQUIREMENT_NOT_MET||User does not own any NFTs from the collection|
|RESTRICTED_TOKENS_CONDITION_NOT_MET||User owns NFT(s) from a collection, but the preset IDs do not match|