{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/secureai-one/json-schema/secureai-one-inspection-schema.json",
  "title": "Inspection",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/secureai-one-openapi.json#/components/schemas/Inspection",
  "type": "object",
  "properties": {
    "decision": {
      "type": "string",
      "enum": [
        "allow",
        "redact",
        "approve",
        "block"
      ],
      "description": "The most severe decision across every finding. \"approve\" means a person must decide before this can happen."
    },
    "input": {
      "description": "The action rewritten and ready to send. Absent when the decision is block — a refusal deliberately carries nothing sendable."
    },
    "map": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "{standIn: real}. The only way to restore the reply; not stored here."
    },
    "findings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Finding"
      }
    },
    "toolDenied": {
      "type": "boolean",
      "description": "True when the tool itself was refused, in which case nothing was inspected."
    },
    "policySource": {
      "type": "string",
      "enum": [
        "account",
        "default",
        "unreadable"
      ]
    },
    "auditId": {
      "type": "string"
    },
    "approvalId": {
      "type": "string",
      "description": "Set when the decision is \"approve\". Poll /approvals/{id}, then re-submit the same input with this id."
    },
    "expiresAt": {
      "type": "integer",
      "description": "When waiting stops being worth it. Milliseconds since epoch."
    }
  },
  "required": [
    "decision",
    "map",
    "findings",
    "toolDenied",
    "policySource",
    "auditId"
  ],
  "$defs": {
    "Finding": {
      "type": "object",
      "description": "Something the scanner located. Carries the kind and where it sat, never the value.",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "secret",
            "card",
            "iban",
            "ssn",
            "govid",
            "email",
            "phone",
            "address",
            "postcode",
            "name",
            "host"
          ]
        },
        "path": {
          "type": "string",
          "description": "Dotted path into the action, e.g. \"body.customer.email\". Empty when the input was a bare string."
        },
        "decision": {
          "type": "string",
          "enum": [
            "allow",
            "redact",
            "approve",
            "block"
          ]
        }
      },
      "required": [
        "kind",
        "path",
        "decision"
      ]
    }
  }
}