{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://weverlabs.com/x402-index/schema.json",
  "title": "Wever x402 endpoint index",
  "type": "object",
  "required": ["version", "updated", "endpoints"],
  "properties": {
    "version": { "const": "1.0.0" },
    "updated": { "$ref": "#/definitions/timestamp" },
    "endpoints": {
      "type": "array",
      "maxItems": 1000,
      "items": {
        "type": "object",
        "required": ["id", "operator", "url", "protocol", "network", "asset", "price_per_call_usdc", "free_tier", "capabilities", "discovery_doc_url", "last_verified", "verification"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$", "maxLength": 100 },
          "operator": { "type": "string", "minLength": 1, "maxLength": 200 },
          "url": { "$ref": "#/definitions/httpsUrl" },
          "protocol": { "type": "string", "minLength": 1, "maxLength": 80 },
          "transport": { "enum": ["mcp", "http"] },
          "network": { "type": "string", "pattern": "^eip155:[1-9][0-9]*$", "maxLength": 40 },
          "asset": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
          "price_per_call_usdc": { "type": "string", "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,6})?$" },
          "price_note": { "type": "string", "minLength": 1, "maxLength": 2000 },
          "free_tier": {
            "type": "object",
            "required": ["calls", "window_days", "scope"],
            "properties": {
              "calls": { "type": ["integer", "null"], "minimum": 0 },
              "window_days": { "type": ["integer", "null"], "minimum": 1 },
              "scope": { "type": "string", "minLength": 1, "maxLength": 1000 }
            },
            "additionalProperties": false
          },
          "capabilities": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 300 } },
          "tool_count": { "type": "integer", "minimum": 1 },
          "discovery_doc_url": { "$ref": "#/definitions/httpsUrl" },
          "last_verified": { "$ref": "#/definitions/timestamp" },
          "verification": { "const": "live-probe-402" },
          "verification_details": {
            "type": "object",
            "required": ["http_status", "backend_status", "method", "payment_required_matches_body"],
            "properties": {
              "http_status": { "type": "integer", "enum": [200, 402] },
              "backend_status": { "type": ["integer", "null"], "enum": [402, null] },
              "method": { "type": "string", "enum": ["GET", "POST", "POST tools/call"] },
              "sampled_tool": { "type": "string", "minLength": 1, "maxLength": 200 },
              "payment_required_matches_body": { "type": "boolean" }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false,
  "definitions": {
    "httpsUrl": { "type": "string", "pattern": "^https://[^\\s/?#]+(?:/[^\\s]*)?$", "maxLength": 2000 },
    "timestamp": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{3})?Z$" }
  }
}
