---
title: "getValidationRules"
method: GET
path: "/v1/validation-rules"
tags: ["Validation Rules"]
---

# getValidationRules

`GET /v1/validation-rules`

Returns all validation rules belonging to the authenticated user's organization.

Results are returned as a flat list. Use this endpoint to list available rules when configuring journeys or entity schemas.

## Response `200`

Success

- GetValidationRulesResponse — Response envelope for listing all validation rules within an organization.
  - `results` ValidationRule[] — Flat list of all validation rules belonging to the authenticated organization.
    - `title` string, required — Title of the validation rule.
    - `placeholder` string — Placeholder for the validation rule.
    - `used_by` UsedBy[] — Describes where and how a validation rule is applied.
      - `type` 'journey' | 'entity', required — The context in which the rule is used - either a journey block or an entity schema attribute.
      - `schema_slug` string — Slug of the entity schema using this rule. Only applicable when `type` is `entity`.
      - `source_id` string — Unique identifier of the source (e.g. journey ID or entity attribute key) that references this rule.
    - `rule` union
      - RegexRuleType — Validation rule that uses a regular expression to validate input.
        - `type` 'regex', required — Indicates this is a regex-based validation rule.
        - `conditions` union, required — Condition definition for a regex-based validation rule (2 levels deep)
          - object — All conditions must be true (AND logic)
            - `all` union[], required
              - …
          - object — Any conditions must be true (OR logic)
            - `any` union[], required
              - …
          - object — NOT condition (negation)
            - `not` union, required
              - …
      - PatternRuleType — Validation rule that uses a sequence of patterns to validate input.
        - `type` 'pattern', required — Indicates this is a pattern-based validation rule.
        - `conditions` union, required — Condition definition for a pattern-based validation rule (2 levels deep)
          - object — All conditions must be true (AND logic)
            - `all` union[], required
              - …
          - object — Any conditions must be true (OR logic)
            - `any` union[], required
              - …
          - object — NOT condition (negation)
            - `not` union, required
              - …
      - NumericRuleType — Validation rule for numeric values, supporting range and digit count constraints.
        - `type` 'numeric', required — Indicates this is a numeric-based validation rule.
        - `conditions` union, required — Condition definition for a numeric-based validation rule (2 levels deep)
          - object — All conditions must be true (AND logic)
            - `all` union[], required
              - …
          - object — Any conditions must be true (OR logic)
            - `any` union[], required
              - …
          - object — NOT condition (negation)
            - `not` union, required
              - …
      - ComparisonRuleType — Declarative validation rule (schema version v2). Supports predefined comparison operators over number, date and text inputs, with static, dynamic (context path) and relative-date comparison values.
        - `input_type` 'number' | 'date' | 'text', required — The kind of input value the rule validates. Determines which operators are allowed.
        - `conditions` Condition[], required — The comparisons the input value must satisfy. All blocking conditions must pass for the input to be valid; `allow_failure` conditions are advisory and excluded from the verdict. Must contain at least one condition (enforced at write time).
          - `id` string, required — Stable identifier of the condition within the rule, used for editing and error reporting.
          - `operator` 'equal' | 'notEqual' | 'greaterThan' | 'greaterThanInclusive' | 'lessThan' | 'lessThanInclusive' | 'between' | 'dateBefore' | 'dateOnOrBefore' | 'dateAfter' | 'dateOnOrAfter' | 'dateBetween' | 'notInFuture' | 'notInPast' | 'contains' | 'doesNotContain' | 'startsWith' | 'endsWith' | 'regexMatch' | 'lengthBetween' | 'maxDigits' | 'maxDecimals', required — Predefined comparison operator. Compatibility (enforced at write time): - number: equal, notEqual, greaterThan, greaterThanInclusive, lessThan, lessThanInclusive, between, regexMatch, maxDigits, maxDecimals - date: dateBefore, dateOnOrBefore, dateAfter, dateOnOrAfter, dateBetween, notInFuture, notInPast, regexMatch - text: equal, notEqual, contains, doesNotContain, startsWith, endsWith, regexMatch, lengthBetween, greaterThan, greaterThanInclusive, lessThan, lessThanInclusive, between, maxDigits, maxDecimals Range operators (between, dateBetween, lengthBetween) require a `range` value; unary operators (notInFuture, notInPast) require a `none` value; all others require a scalar value. regexMatch validates the raw input string's format and always takes a static string pattern. Numeric comparison operators on text rules parse the input as a number at evaluation time (free-text fields often hold numbers); unparsable input fails the condition. maxDigits limits how many digits the written input may contain in total (grouping separators, sign and the decimal separator are not counted); maxDecimals limits how many digits may follow the decimal separator. Both take a non-negative integer comparison value and, like the other numeric operators, are also allowed on text rules.
          - `value` union, required — The comparison value of a condition - a scalar, a range of scalars, or nothing (unary operators).
            - StaticValue — A fixed comparison value.
              - …
            - ContextValue — A dynamic comparison value resolved from runtime context, e.g. `contract.installment_amount` or `previous_reading.value`. The first path segment must match the `name` of a declared context requirement.
              - …
            - RelativeDateValue — A date relative to the evaluation moment, e.g. "today minus 30 days". Only valid for date rules.
              - …
            - RangeValue — A lower and upper bound for range operators (between, dateBetween, lengthBetween). Bounds are inclusive.
              - …
            - NoValue — No comparison value - used by unary operators such as notInFuture / notInPast.
              - …
          - `error_message` string, required — Message shown to the end user when this condition fails.
          - `applies_when` AppliesWhen — Optional precondition on a condition: the condition only takes part in the validation when this comparison over context holds. Examples: apply the dual-tariff reference only when `contract.htnt` is not empty, or run a plausibility check only when a context value reaches a threshold.
            - `path` string, required — Dot-separated context path whose first segment must match a declared context schema.
            - `operator` 'equal' | 'notEqual' | 'greaterThan' | 'greaterThanInclusive' | 'lessThan' | 'lessThanInclusive' | 'isEmpty' | 'isNotEmpty', required — Comparison applied to the resolved context value. `isEmpty` / `isNotEmpty` take no `value`; all other operators require one.
            - `value` union — Static comparison value for binary operators.
              - …
          - `allow_failure` boolean — When true, the condition is advisory: it is always evaluated and reported when it fails, but it never takes part in the validity verdict. The input is valid when every blocking (non-advisory) condition passes. A rule whose conditions are all advisory is always valid (warnings only).
    - `contexts` ContextRequirement[] — Declares the dynamic context a v2 rule needs at evaluation time. `context` condition values reference these sources by using the schema slug as the first segment of their `path`. Only applicable to v2 rules.
      - `schema` string, required — Entity schema slug.
    - `_schema_version` string, required — Schema version of the validation rule.
    - `_id` string, required — Unique identifier for the validation rule.
    - `_organization_id` string, required — Organization ID that owns this rule.
    - `created_at` string, required — ISO timestamp when the rule was created.
    - `updated_at` string, required — ISO timestamp when the rule was last updated.
    - `created_by` string, required — User ID of the creator.
    - `updated_by` string, required — User ID of the last updater.

## Other responses

- `400` — Bad Request - Invalid request body
- `401` — Unauthorized - Authentication required
- `403` — Forbidden - Insufficient permissions
- `500` — Internal Server Error

---

[API](https://skmtc.dev/epilot/apis/validation-rules-api.md) · [All operations](https://skmtc.dev/epilot/apis/validation-rules-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/epilot/validation-rules-api/revisions/017fc8c03fb0/schema)
