Rules

Validate a CEL condition

Check whether a CEL expression is syntactically valid without creating a rule.

post/v1/rules/validate

Request

  • Base URL: https://api.scrip.dev
  • URL: https://api.scrip.dev/v1/rules/validate
  • Auth: HTTP bearer

Request body

actionsRuleActionDraft[] (unresolved $ref)

Draft actions to check along with the condition. Incomplete actions are accepted. Expressions are checked as they are when saving a rule. With program_id, validation also checks asset restrictions and recognizes keys these actions set, so reading those keys does not produce an unknown-key warning.

conditionstring required

CEL expression to validate

program_idstring uuid

Program to check the draft against. Checks tier keys and warns about counters, tags, or attributes that no rule in the program sets. With actions, also checks whether the asset supports expires_at, matures_at, and reference_id, plus reference_id length and format. Without program_id, checks cover tier field structure, participant fields, and deprecated names.

rule_idstring uuid

Rule you are editing. Excludes its saved actions from the known state keys so renaming a key in the draft does not hide a warning. Omit when creating a rule.

Response

Validation result

messagestring

Human-readable validation result or error detail

notestring

Additional context about validation scope (present only on success)

validboolean

Whether the condition is syntactically valid

Example response

{
  "message": "CEL condition is valid",
  "note": "Validation checks syntax only. Field references are not verified against an event schema.",
  "valid": true,
  "warnings": [
    {
      "code": "unknown_state_key",
      "key": "purchaseCnt",
      "kind": "counter",
      "message": "unknown counter \"purchaseCnt\" on participant: no rule in this program writes it; did you mean \"purchase_count\"?",
      "scope": "participant",
      "suggestion": "purchase_count"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.