{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gridzen-ai/json-schema/gridzen-ai-decision-request-schema.json",
  "title": "DecisionRequest",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gridzen-ai-openapi.json#/components/schemas/DecisionRequest",
  "properties": {
    "event": {
      "$ref": "#/$defs/DecisionEvent"
    },
    "subject": {
      "$ref": "#/$defs/SubjectIdentifiers"
    },
    "context": {
      "$ref": "#/$defs/DecisionContext"
    },
    "providers": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Providers",
      "description": "Optional provider IDs. Omit to use the policy default route."
    }
  },
  "type": "object",
  "required": [
    "event",
    "subject"
  ],
  "$defs": {
    "DecisionContext": {
      "properties": {
        "country": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2,
              "minLength": 2
            },
            {
              "type": "null"
            }
          ],
          "title": "Country"
        },
        "expected_country": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2,
              "minLength": 2
            },
            {
              "type": "null"
            }
          ],
          "title": "Expected Country"
        },
        "client_reference": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ],
          "title": "Client Reference"
        },
        "consent_reference": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ],
          "title": "Consent Reference"
        },
        "callback_url": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2083,
              "minLength": 1,
              "format": "uri"
            },
            {
              "type": "null"
            }
          ],
          "title": "Callback Url"
        }
      },
      "type": "object",
      "title": "DecisionContext",
      "description": "Non-identity context used to select a policy and provider route."
    },
    "DecisionEvent": {
      "type": "string",
      "enum": [
        "onboarding",
        "payout",
        "account_change"
      ],
      "title": "DecisionEvent"
    },
    "SubjectIdentifiers": {
      "properties": {
        "email": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 254
            },
            {
              "type": "null"
            }
          ],
          "title": "Email"
        },
        "phone": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 32
            },
            {
              "type": "null"
            }
          ],
          "title": "Phone"
        },
        "ip_address": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 45
            },
            {
              "type": "null"
            }
          ],
          "title": "Ip Address"
        },
        "national_id": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ],
          "title": "National Id"
        },
        "bank_account": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ],
          "title": "Bank Account"
        }
      },
      "type": "object",
      "title": "SubjectIdentifiers",
      "description": "Identifiers supplied for the subject of a decision.\n\nThe API accepts only the identifiers needed for a requested check.  They are\npassed to providers at evaluation time and are deliberately excluded from\nGridZen's decision audit payload."
    }
  }
}