{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sortance/json-schema/sortance-decide-response-schema.json",
  "title": "DecideResponse",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sortance-openapi.json#/components/schemas/DecideResponse",
  "type": "object",
  "properties": {
    "decision": {
      "type": "string",
      "enum": [
        "allow",
        "allow_with_flow",
        "review",
        "challenge",
        "deny"
      ],
      "description": "Always set, even when every upstream failed."
    },
    "flow": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "rule_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "policy": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "slug": {
              "type": "string"
            },
            "version": {
              "type": "integer"
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "experiment": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "variant": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "enforce",
            "shadow"
          ]
        },
        "shadow_decision": {
          "type": "string",
          "enum": [
            "allow",
            "allow_with_flow",
            "review",
            "challenge",
            "deny"
          ]
        }
      }
    },
    "reasons": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "verification": {
      "$ref": "#/$defs/VerifyResponse"
    },
    "enrichment": {
      "anyOf": [
        {
          "$ref": "#/$defs/EnrichmentProfile"
        },
        {
          "type": "null"
        }
      ]
    },
    "icp": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "score": {
              "type": "integer"
            },
            "fit": {
              "type": "string",
              "enum": [
                "strong",
                "fit",
                "weak",
                "no_fit"
              ]
            },
            "coverage": {
              "type": "number"
            },
            "version": {
              "type": "integer"
            },
            "criteria": {
              "type": "array",
              "items": {
                "type": "object"
              }
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "lists": {
      "type": "object",
      "properties": {
        "matched": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "cost_usd": {
      "type": "number"
    },
    "latency_ms": {
      "type": "integer"
    },
    "trace_id": {
      "type": "string",
      "description": "dc_-prefixed."
    },
    "request": {
      "anyOf": [
        {
          "$ref": "#/$defs/RequestInfo"
        },
        {
          "type": "null"
        }
      ]
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/UsageCounters"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "decision",
    "flow",
    "rule_id",
    "tags",
    "policy",
    "reasons",
    "verification",
    "enrichment",
    "icp",
    "lists",
    "cost_usd",
    "latency_ms",
    "trace_id"
  ],
  "$defs": {
    "CheckStep": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "enum": [
            "syntax",
            "account_rules",
            "mx",
            "disposable",
            "email_type",
            "role",
            "catch_all",
            "mailbox",
            "ai",
            "score",
            "policy"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "warn",
            "info",
            "skip"
          ]
        },
        "detail": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "status",
        "detail"
      ]
    },
    "EnrichmentProfile": {
      "type": "object",
      "properties": {
        "person": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "full_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "first_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "last_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "seniority": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "c_suite",
                        "vp",
                        "director",
                        "manager",
                        "senior",
                        "entry",
                        "unknown"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "department": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "engineering",
                        "product",
                        "design",
                        "marketing",
                        "growth",
                        "sales",
                        "customer_success",
                        "finance",
                        "legal",
                        "hr",
                        "operations",
                        "executive",
                        "other",
                        "unknown"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "linkedin_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "location": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "country": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "region": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "company": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "domain": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "industry": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "fintech",
                        "banking",
                        "insurance",
                        "investment_management",
                        "venture_capital",
                        "accounting",
                        "crypto_web3",
                        "real_estate",
                        "saas",
                        "software",
                        "developer_tools",
                        "artificial_intelligence",
                        "data_analytics",
                        "cybersecurity",
                        "it_services",
                        "internet",
                        "ecommerce",
                        "marketplaces",
                        "gaming",
                        "edtech",
                        "health_tech",
                        "hr_tech",
                        "martech",
                        "proptech",
                        "legal_tech",
                        "hardware",
                        "semiconductors",
                        "telecommunications",
                        "manufacturing",
                        "industrial_automation",
                        "automotive",
                        "aerospace_defense",
                        "construction",
                        "chemicals",
                        "mining_metals",
                        "energy",
                        "clean_energy",
                        "utilities",
                        "agriculture",
                        "logistics",
                        "transportation",
                        "travel",
                        "hospitality",
                        "retail",
                        "consumer_goods",
                        "food_beverage",
                        "sports_fitness",
                        "healthcare",
                        "pharmaceuticals",
                        "biotech",
                        "medical_devices",
                        "consulting",
                        "legal",
                        "marketing_advertising",
                        "staffing_recruiting",
                        "media",
                        "entertainment",
                        "publishing",
                        "education",
                        "government",
                        "nonprofit",
                        "other"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "industry_raw": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "employees": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "employees_range": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "revenue_range": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "founded": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "country": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "type": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "public",
                        "private",
                        "nonprofit",
                        "government",
                        "education",
                        "unknown"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "tech": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "linkedin_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "funding": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "total_usd": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "last_round": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "coverage": {
          "type": "object",
          "properties": {
            "person": {
              "type": "number"
            },
            "company": {
              "type": "number"
            }
          },
          "description": "Fraction (0..1) of the asked-for fields that came back."
        },
        "freshness": {
          "type": "object",
          "properties": {
            "person": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "company": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        "sources": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "match",
                  "no_match",
                  "error",
                  "timeout",
                  "skipped"
                ]
              },
              "ms": {
                "type": "number"
              },
              "cost": {
                "type": "number"
              },
              "fields": {
                "type": "integer"
              }
            }
          }
        },
        "disagreement": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "cache": {
          "type": "object",
          "properties": {
            "hit": {
              "type": "boolean"
            },
            "ttl_s": {
              "type": "integer"
            }
          }
        },
        "visitor": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "identified": {
                  "type": "boolean"
                },
                "first_seen": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "pages": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "source": {
                  "type": "string"
                }
              }
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "RequestInfo": {
      "type": "object",
      "properties": {
        "ip": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "ip_version": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "country": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "region": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "region_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "city": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "continent": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "timezone": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "is_eu": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "asn": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "as_org": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "colo": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "user_agent": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "source": {
          "type": "string",
          "enum": [
            "edge",
            "caller"
          ],
          "description": "caller when context.client supplied the end user's details."
        }
      }
    },
    "UsageCounters": {
      "type": "object",
      "properties": {
        "key": {
          "type": "object",
          "properties": {
            "minute": {
              "type": "integer"
            },
            "hour": {
              "type": "integer"
            },
            "day": {
              "type": "integer"
            }
          }
        },
        "ip": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "minute": {
                  "type": "integer"
                },
                "hour": {
                  "type": "integer"
                },
                "day": {
                  "type": "integer"
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "email": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "day": {
                  "type": "integer"
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "domain": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "hour": {
                  "type": "integer"
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "limits": {
          "type": "object",
          "properties": {
            "per_minute": {
              "type": "integer"
            },
            "remaining_minute": {
              "type": "integer"
            },
            "month_quota": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ]
            },
            "month_used": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        }
      }
    },
    "VerifyResponse": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "The address you sent, echoed back. Never stored."
        },
        "verdict": {
          "type": "string",
          "enum": [
            "valid",
            "likely_valid",
            "risky",
            "likely_invalid",
            "invalid",
            "unknown"
          ],
          "description": "Compatibility field derived from bounce_probability. Prefer the probability."
        },
        "bounce_probability": {
          "type": "number",
          "description": "Calibrated against observed bounces: 0.31 means roughly 31 in 100."
        },
        "confidence_interval": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "minItems": 2,
          "maxItems": 2
        },
        "calibration": {
          "type": "string",
          "enum": [
            "prior",
            "fitted"
          ]
        },
        "recommendation": {
          "type": "string",
          "enum": [
            "send",
            "hold",
            "challenge",
            "drop"
          ],
          "description": "A policy suggestion, not a verdict."
        },
        "actor_class": {
          "type": "string",
          "enum": [
            "human_mailbox",
            "agent_mailbox",
            "relay_alias",
            "role_account",
            "shared",
            "unknown"
          ]
        },
        "mailbox_type": {
          "type": "string",
          "enum": [
            "corporate",
            "consumer",
            "role",
            "unknown"
          ]
        },
        "esp": {
          "type": "string",
          "enum": [
            "microsoft365",
            "google_workspace",
            "consumer_esp",
            "self_hosted",
            "unknown"
          ]
        },
        "email_type": {
          "type": "string",
          "enum": [
            "business",
            "free",
            "role",
            "disposable",
            "relay",
            "unknown"
          ],
          "description": "free is the consumer-provider class (Gmail, Outlook, Yahoo, …)."
        },
        "signals": {
          "type": "object",
          "properties": {
            "syntax": {
              "type": "string",
              "enum": [
                "pass",
                "fail"
              ]
            },
            "mx": {
              "type": "string",
              "enum": [
                "pass",
                "fail"
              ]
            },
            "disposable": {
              "type": "boolean"
            },
            "role_account": {
              "type": "boolean"
            },
            "catch_all": {
              "type": "boolean"
            },
            "relay_alias": {
              "type": "boolean"
            }
          }
        },
        "providers": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "verdict": {
                "type": "string"
              },
              "ms": {
                "type": "number"
              },
              "cost": {
                "type": "number"
              }
            }
          },
          "description": "Per-provider receipts. Empty when the local gate or the cache settled it."
        },
        "disagreement": {
          "type": "number",
          "description": "How far apart the providers landed. 0 = agreement."
        },
        "cache": {
          "type": "object",
          "properties": {
            "hit": {
              "type": "boolean"
            },
            "ttl_s": {
              "type": "integer"
            }
          }
        },
        "cost_usd": {
          "type": "number"
        },
        "latency_ms": {
          "type": "integer"
        },
        "trace_id": {
          "type": "string",
          "description": "vr_-prefixed. Quote it in /v1/outcome."
        },
        "reason": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "syntax_invalid",
                "address_blocklisted",
                "domain_blocklisted",
                "no_mx",
                "mx_unresolved",
                "disposable_domain",
                "disposable_suspected",
                "domain_allowlisted",
                "address_allowlisted"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "reasons": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "syntax_invalid",
              "address_blocklisted",
              "domain_blocklisted",
              "no_mx",
              "mx_unresolved",
              "disposable_domain",
              "disposable_suspected",
              "domain_allowlisted",
              "address_allowlisted"
            ]
          }
        },
        "degraded": {
          "type": "boolean",
          "description": "Present and true only when a provider failed and nothing else added evidence."
        },
        "identity_hash": {
          "type": "string",
          "description": "Per-account salted dedupe key for relay aliases."
        },
        "mailbox_checked": {
          "type": "boolean",
          "description": "True when a mailbox provider said whether the mailbox exists."
        },
        "score": {
          "type": "integer",
          "description": "0–100: how safe it is to let this address in. Higher is better."
        },
        "score_band": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "checks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CheckStep"
          },
          "description": "The checks that ran, in order."
        },
        "ai": {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "ok",
                "skipped",
                "unavailable",
                "failed"
              ]
            },
            "model": {
              "type": "string",
              "enum": [
                "jev"
              ]
            },
            "address": {
              "type": "string",
              "enum": [
                "real",
                "fake",
                "uncertain"
              ]
            },
            "domain": {
              "type": "string",
              "enum": [
                "ok",
                "typo_like",
                "lookalike",
                "placeholder",
                "throwaway_like",
                "uncertain"
              ]
            },
            "cached": {
              "type": "boolean"
            },
            "reason": {
              "type": "string"
            }
          }
        },
        "decision": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "action": {
                  "type": "string",
                  "enum": [
                    "allow",
                    "allow_with_flow",
                    "review",
                    "challenge",
                    "deny"
                  ]
                },
                "policy": {
                  "type": "string"
                },
                "version": {
                  "type": "integer"
                },
                "rule": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "flow": {
                  "type": "string"
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "reasons": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "request": {
          "anyOf": [
            {
              "$ref": "#/$defs/RequestInfo"
            },
            {
              "type": "null"
            }
          ]
        },
        "usage": {
          "anyOf": [
            {
              "$ref": "#/$defs/UsageCounters"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "email",
        "verdict",
        "bounce_probability",
        "confidence_interval",
        "calibration",
        "recommendation",
        "actor_class",
        "mailbox_type",
        "esp",
        "email_type",
        "signals",
        "providers",
        "disagreement",
        "cache",
        "cost_usd",
        "latency_ms",
        "trace_id",
        "reason",
        "reasons"
      ]
    }
  }
}