{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/envestnet/json-schema/envestnet-peer-data-response-schema.json",
  "title": "PeerDataResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/envestnet-view-api-openapi.yml#/components/schemas/PeerDataResponse",
  "properties": {
    "peerData": {
      "type": "string",
      "allOf": [
        {
          "$ref": "#/$defs/PeerData"
        }
      ]
    }
  },
  "$defs": {
    "GeoData": {
      "properties": {
        "level": {
          "type": "string",
          "description": "Geography level i.e. one of City/State/National of the peer for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /Views/{ViewId}/peerData</li></ul>"
        },
        "value": {
          "type": "string",
          "description": "Value corresponding to the Geography level i.e. one of City/State/National of the peer for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /Views/{ViewId}/peerData</li></ul>"
        }
      }
    },
    "Geography": {
      "properties": {
        "state": {
          "type": "string",
          "description": "State name of the peer for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /views/{viewId}/peerData</li></ul>"
        },
        "city": {
          "type": "string",
          "description": "city name of the peer for which the response is returned. returned<br><br><b>Endpoints</b> -<ul><li>GET /views/{viewId}/peerData</li></ul>"
        }
      }
    },
    "GeographyWithDataArray": {
      "properties": {
        "benchmarkLevel": {
          "type": "string",
          "description": "describes benchmark level."
        },
        "geo": {
          "$ref": "#/$defs/GeoData"
        },
        "metric": {
          "$ref": "#/$defs/PeerDataAtGeo"
        }
      }
    },
    "Money": {
      "properties": {
        "amount": {
          "type": "number",
          "description": "\"amount\" field is a child of Generic Yodlee model \"Money\". Amount should be a Floating point number.",
          "format": "double"
        },
        "currency": {
          "type": "string",
          "description": "\"currency\" field is a child of Generic Yodlee model \"Money\". Currency is a String with a predefined value(s) such as USD.",
          "enum": [
            "USD"
          ]
        },
        "convertedAmount": {
          "type": "number",
          "description": "\"convertedAmount\" field is a child of Generic Yodlee model \"Money\".  This field should be a Floating point number. It contains value of \"amount\" i.e. Money child field multiplied by the conversion rate derived from the currency mentioned in field \"covertedCurrency\"",
          "format": "double"
        },
        "convertedCurrency": {
          "type": "string",
          "description": "\"convertedCurrency\" field is a child of Generic Yodlee model \"Money\". This field contains preferred currency of user for that entity and is a String with a predefined value(s) such as INR.",
          "enum": [
            "INR"
          ]
        }
      }
    },
    "PeerData": {
      "properties": {
        "timePeriod": {
          "type": "string",
          "description": "Duration considered for generating the peer bechmarks across applicable categories and merchants for the view.<br> <br> The default value is LAST_MONTH for this parameter i.e. previous month's data is considered when this parameter is not passed.<br><br><b>Endpoints</b> -<ul><li>GET /views/{viewId}/peerData</li></ul>"
        },
        "monthYear": {
          "type": "string",
          "description": "month and year information on when the benchmark values are computed returned<br><br><b>Endpoints</b> -<ul><li>GET /views/{viewId}/peerData</li></ul>"
        },
        "fromDate": {
          "type": "string",
          "description": "Start date in UTC format - yyyy-MM-dd'T'HH:mm:ss derived from the timePeriod query parameter for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /views/{viewId}/peerData</li></ul>"
        },
        "toDate": {
          "type": "string",
          "description": "To date in UTC format - yyyy-MM-dd'T'HH:mm:ss derived from the timePeriod query parameter for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /views/{viewId}/peerData</li></ul>"
        },
        "segement": {
          "$ref": "#/$defs/SegementationParameter"
        },
        "peerCategorySummary": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/peerDetailCategorySummary"
          }
        },
        "peerDetailCategorySummary": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/peerDetailCategorySummary"
          }
        },
        "peerMerchantSummary": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PeerMerchantSummary"
          }
        }
      }
    },
    "PeerDataAtGeo": {
      "properties": {
        "numberOfPeers": {
          "type": "integer",
          "description": "Median number of the peers in the same income range for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /Views/{ViewId}/peerData</li></ul>",
          "format": "int64"
        },
        "spendAmount": {
          "description": "The median amount spent by the peers in that segment for the specified category or merchant <br>",
          "allOf": [
            {
              "$ref": "#/$defs/Money"
            }
          ]
        }
      }
    },
    "PeerMerchantSummary": {
      "properties": {
        "name": {
          "type": "string",
          "description": "Merchant Name for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /Views/{ViewId}/peerData</li></ul>"
        },
        "benchmark": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GeographyWithDataArray"
          }
        }
      }
    },
    "SegementationParameter": {
      "properties": {
        "incomeRange": {
          "type": "string",
          "description": "Income range of the user in format - min_income - max_income for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /views/{viewId}/peerData</li></ul>"
        },
        "geo": {
          "$ref": "#/$defs/Geography"
        }
      }
    },
    "peerDetailCategorySummary": {
      "properties": {
        "id": {
          "type": "string",
          "description": "Category Id of the category belonging to peer for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /Views/{ViewId}/peerData</li></ul>"
        },
        "name": {
          "type": "string",
          "description": "Category Name for which the response is returned<br><br><b>Endpoints</b> -<ul><li>GET /Views/{ViewId}/peerData</li></ul>"
        },
        "benchmark": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GeographyWithDataArray"
          }
        }
      }
    }
  }
}