{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shopsafe-com-au/json-schema/shopsafe-com-au-batch-response-schema.json",
  "title": "BatchResponse",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shopsafe-com-au-openapi.json#/components/schemas/BatchResponse",
  "properties": {
    "batch_id": {
      "type": "string",
      "title": "Batch Id"
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "complete"
      ],
      "title": "Status"
    },
    "currency": {
      "type": "string",
      "const": "AUD",
      "title": "Currency",
      "default": "AUD"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "input_count": {
      "type": "integer",
      "title": "Input Count"
    },
    "unique_url_count": {
      "type": "integer",
      "title": "Unique Url Count"
    },
    "max_total_cost_aud_cents": {
      "type": "integer",
      "title": "Max Total Cost Aud Cents"
    },
    "unit_price_at_admission_aud_cents": {
      "type": "integer",
      "title": "Unit Price At Admission Aud Cents"
    },
    "cost_aud_cents": {
      "type": "integer",
      "title": "Cost Aud Cents"
    },
    "reserved_aud_cents": {
      "type": "integer",
      "title": "Reserved Aud Cents"
    },
    "released_aud_cents": {
      "type": "integer",
      "title": "Released Aud Cents"
    },
    "items": {
      "items": {
        "$ref": "#/$defs/BatchItem"
      },
      "type": "array",
      "maxItems": 10,
      "title": "Items"
    },
    "interpretation": {
      "type": "string",
      "title": "Interpretation",
      "default": "Complete means batch processing has ended. Inspect each item's risk, coverage and freshness. Null verdicts are not safety findings. Full evidence is available through each verification ID."
    },
    "retry_instruction": {
      "type": "string",
      "title": "Retry Instruction",
      "default": "Repeat the identical batch request after a transport failure. Existing batches never start additional work. Not-started or failed items require a new request within the owner-authorised budget; do not raise the original ceiling without owner authority."
    },
    "advisory": {
      "type": "string",
      "title": "Advisory",
      "default": "Google Web Risk provides URL reputation evidence. Some unsafe sites may be missed and some safe sites may be flagged in error. Neither this evidence nor ShopSafe guarantees the safety of a site or transaction."
    }
  },
  "type": "object",
  "required": [
    "batch_id",
    "status",
    "created_at",
    "input_count",
    "unique_url_count",
    "max_total_cost_aud_cents",
    "unit_price_at_admission_aud_cents",
    "cost_aud_cents",
    "reserved_aud_cents",
    "released_aud_cents",
    "items"
  ],
  "$defs": {
    "AgentFailure": {
      "properties": {
        "error": {
          "type": "string",
          "title": "Error"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "http_status": {
          "type": "integer",
          "title": "Http Status"
        },
        "retryable": {
          "type": "boolean",
          "title": "Retryable",
          "default": false
        },
        "retry_after_seconds": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Retry After Seconds"
        },
        "next_action": {
          "type": "string",
          "enum": [
            "check_credential",
            "request_scope",
            "owner_authorisation",
            "fund_account",
            "wait_and_retry",
            "correct_request",
            "retrieve_original_request",
            "new_request_if_authorised",
            "contact_support"
          ],
          "title": "Next Action"
        },
        "owner_action_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Owner Action Url"
        },
        "quick_price_aud_cents": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Quick Price Aud Cents"
        },
        "charge_status": {
          "type": "string",
          "enum": [
            "not_charged",
            "check_original_request"
          ],
          "title": "Charge Status",
          "default": "not_charged"
        },
        "retry_instruction": {
          "type": "string",
          "title": "Retry Instruction",
          "default": "Reuse the original idempotency key and identical parameters after the stated condition changes."
        }
      },
      "type": "object",
      "required": [
        "error",
        "message",
        "http_status",
        "next_action"
      ],
      "title": "AgentFailure"
    },
    "BatchItem": {
      "properties": {
        "input_indexes": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "maxItems": 10,
          "minItems": 1,
          "title": "Input Indexes"
        },
        "target_url": {
          "type": "string",
          "title": "Target Url"
        },
        "verification_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Verification Id"
        },
        "status": {
          "type": "string",
          "enum": [
            "running",
            "complete",
            "failed",
            "not_started"
          ],
          "title": "Status"
        },
        "billing_mode": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "trial",
                "prepaid",
                "cache"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Billing Mode"
        },
        "cost_aud_cents": {
          "type": "integer",
          "title": "Cost Aud Cents",
          "default": 0
        },
        "reserved_aud_cents": {
          "type": "integer",
          "title": "Reserved Aud Cents",
          "default": 0
        },
        "released_aud_cents": {
          "type": "integer",
          "title": "Released Aud Cents",
          "default": 0
        },
        "freshness": {
          "type": "string",
          "enum": [
            "fresh",
            "stale",
            "unavailable"
          ],
          "title": "Freshness",
          "default": "unavailable"
        },
        "verdict": {
          "anyOf": [
            {
              "$ref": "#/$defs/BatchVerdict"
            },
            {
              "type": "null"
            }
          ]
        },
        "recovery": {
          "anyOf": [
            {
              "$ref": "#/$defs/AgentFailure"
            },
            {
              "type": "null"
            }
          ]
        },
        "coverage_guidance": {
          "anyOf": [
            {
              "$ref": "#/$defs/CoverageGuidance"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "input_indexes",
        "target_url",
        "status"
      ],
      "title": "BatchItem"
    },
    "BatchVerdict": {
      "properties": {
        "risk_level": {
          "type": "string",
          "enum": [
            "high_risk",
            "elevated_risk",
            "no_known_threats",
            "unknown"
          ],
          "title": "Risk Level"
        },
        "risk_score": {
          "type": "integer",
          "maximum": 100.0,
          "minimum": 0.0,
          "title": "Risk Score"
        },
        "score_is_probability": {
          "type": "boolean",
          "const": false,
          "title": "Score Is Probability",
          "default": false
        },
        "coverage": {
          "type": "string",
          "enum": [
            "complete",
            "partial",
            "incomplete"
          ],
          "title": "Coverage"
        },
        "observed_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Observed Url"
        },
        "checked_at": {
          "type": "string",
          "format": "date-time",
          "title": "Checked At"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "title": "Expires At"
        },
        "rules_version": {
          "type": "string",
          "title": "Rules Version"
        },
        "attention_checks": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 8,
          "title": "Attention Checks"
        },
        "unavailable_checks": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 8,
          "title": "Unavailable Checks"
        }
      },
      "type": "object",
      "required": [
        "risk_level",
        "risk_score",
        "coverage",
        "observed_url",
        "checked_at",
        "expires_at",
        "rules_version",
        "attention_checks",
        "unavailable_checks"
      ],
      "title": "BatchVerdict"
    },
    "CoverageGap": {
      "properties": {
        "check": {
          "type": "string",
          "maxLength": 48,
          "title": "Check"
        },
        "affected_checks": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 5,
          "title": "Affected Checks"
        },
        "reason": {
          "type": "string",
          "maxLength": 64,
          "title": "Reason"
        },
        "target_url": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ],
          "title": "Target Url"
        },
        "message": {
          "type": "string",
          "maxLength": 250,
          "title": "Message"
        },
        "next_action": {
          "type": "string",
          "enum": [
            "review_manually",
            "review_destination",
            "wait_for_allowance",
            "contact_service_owner",
            "new_check_if_authorised"
          ],
          "title": "Next Action"
        },
        "action_label": {
          "type": "string",
          "maxLength": 80,
          "title": "Action Label"
        },
        "instruction": {
          "type": "string",
          "maxLength": 300,
          "title": "Instruction"
        }
      },
      "type": "object",
      "required": [
        "check",
        "reason",
        "message",
        "next_action",
        "action_label",
        "instruction"
      ],
      "title": "CoverageGap"
    },
    "CoverageGuidance": {
      "properties": {
        "schema_version": {
          "type": "string",
          "const": "1.0",
          "title": "Schema Version",
          "default": "1.0"
        },
        "based_on": {
          "type": "string",
          "const": "recorded_observations",
          "title": "Based On",
          "default": "recorded_observations"
        },
        "gaps": {
          "items": {
            "$ref": "#/$defs/CoverageGap"
          },
          "type": "array",
          "maxItems": 10,
          "minItems": 1,
          "title": "Gaps"
        },
        "grants_spending_authority": {
          "type": "boolean",
          "const": false,
          "title": "Grants Spending Authority",
          "default": false
        },
        "retry_instruction": {
          "type": "string",
          "title": "Retry Instruction",
          "default": "Retrieving this result or repeating its original request ID returns the saved outcome. It does not fill these gaps. A fresh check needs a new request ID within existing owner authority and limits."
        }
      },
      "type": "object",
      "required": [
        "gaps"
      ],
      "title": "CoverageGuidance"
    }
  }
}