Peer Spending Comparison Summary
Overview
The Peer Spending Comparison Summary insight is a schedule-triggered insight that compares user's spending across categories with the user's peer spending across all their aggregated bank and card accounts. This insight considers the top spending categories and compares spending to the user's peers.
Note: The peer benchmark feature has to be enabled as a pre-requisite to subscribe to this insight.
Following are the additional details for the insight:
Insight Name | PEER_SPENDING_COMPARISON_SUMMARY |
---|---|
Applicable Entity | ACCOUNT |
Insight Type | AGGREGATE |
Trigger Type | SCHEDULE |
Supported Containers | BANK, CARD |
Use Cases
- Customer:
- User engagement
- User:
- Financial wellness - Keep a track of spending.
- Compare spending with peers
Suggested Action
Suggest users to create a VIEW based on the categories in which user has overspent compared to their peers, set a budget, and track spending.
Duplicate Insight Checks
To prevent the same insight from generating repeatedly, the insight is generated only once per scheduled frequency for a user.
The following is the applicable frequency for this insight:
Frequency | Description | |
---|---|---|
MID_MONTHLY | The insight will be triggered once on the 16th of a calendar month. Duplicate check will evaluate if the insight instance that matches the duplicate check criteria exists for the current calendar month (1st of the calendar month to the last day of the month). For example:
|
Insight Dynamic Trigger (On-Demand Evaluation)
This insight can be triggered using the following on-demand insight trigger API:
POST /insights/trigger
Peer Benchmarking Data
This insight provides peer benchmarking (PB) data. This insight cannot be subscribed to by the customer or the user if the customer has not opted for the PB feature during onboarding. The PB feature can be opted post onboarding too.
Based on the segmentation parameter provided by the user, PB data is returned for categories at the peer, state, and national benchmark levels. The order of priority for levels depends on the benchmarkLevel
attribute and is as follows peer
>state
>national
.
Thresholds
Threshold lets the customer or the user decide when the user has to be alerted about the categories where user overspends and underspends.
- Threshold Name: TOP
- Data Type: NUMBER
- Range Allowed: 1 <= TOP <= 100
- Default: 5
Note: Depending on the customer segment and account, threshold might need to be different for different users. If the default value is insufficient, the users can set a threshold they are comfortable tracking.
GET Customer Subscription
The GET customer subscription API provides all the information about the defaults set for the insights that are subscribed by the customer. The default frequency for the insight is MID_MONTHLY
and default duration is LAST_THREE_MONTHS
.
Method and URL:
GET /insights/configs/customerSubscriptions
Header Parameters:
Key | Value | |
---|---|---|
Authorization |
Client credentials-based authorization | Bearer {{Access Token}} |
API key-based authentication | Bearer {{JWT Token_Customer}} |
|
Deprecated cobrand and user credential-based authentication | cobSession={cobSession received in the cobrand login service} |
|
Content-Type |
application/json |
|
Api-Version |
2.1 |
|
2 |
||
Cobrand-Name |
{Name of the Customer} |
Sample Request:
GET /insights/configs/customerSubscriptions
Sample Response:
For more information about the attributes that are returned in the API response, refer to the Insights Data Model page.
- Api-Version 2.1 Response
{
"customerSubscription":[
{
"insightName": "PEER_SPENDING_COMPARISON_SUMMARY",
"insightTitle": "Peer Spending Comparison Summary",
"insightType": "AGGREGATE",
"triggerType": "SCHEDULE",
"containers": [
"BANK",
"CARD"
],
"description": "Generates an insight that provides information about categories the users overspends and underspends compared to their peers spending.",
"applicableEntity": [
"ACCOUNT"
],
"customerConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"frequency": "MID_MONTHLY",
"duration": "LAST_THREE_MONTHS",
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
],
"isBenchmarkEnabled":true
}
]
}
]
}
- Api-Version 2 Response
{
"customerSubscription":[
{
"insightName": "PEER_SPENDING_COMPARISON_SUMMARY",
"insightTitle": "Peer Spending Comparison Summary",
"insightType": "AGGREGATE",
"triggerType": "SCHEDULE",
"container": [
"BANK",
"CARD"
],
"description": "Generates an insight that provides information about categories the users overspends and underspends compared to their peers spending.",
"applicableEntity": [
"ACCOUNT"
],
"customerConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"frequency": "MID_MONTHLY",
"duration": "LAST_THREE_MONTHS",
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
],
"isBenchmarkEnabled":true
}
]
}
]
}
PATCH Customer Subscription
Using the PATCH API for customer subscription, customers can change the defaults for each insight. Alternatively, customers can use the insights configuration tool to achieve the same result.
If the customer has opted for the PB feature during onboarding, the isBenchmarkEnabled
field will be by default true
and cannot be modified.
Warning! Changing any defaults can potentially impact all users who have subscribed to this insight. If the user has overridden the customer threshold, then the user preference will be applied. For all other users, the new defaults will apply.
Method and URL:
PATCH /insights/configs/customerSubscriptions
Header Parameters:
Key | Value | |
---|---|---|
Authorization |
Client credentials-based authorization | Bearer {{Access Token}} |
API key-based authentication | Bearer {{JWT Token_Customer}} |
|
Deprecated cobrand and user credential-based authentication | cobSession={cobSession received in the cobrand login service} |
|
Content-Type |
application/json |
|
Api-Version |
2.1 |
|
2 |
||
Cobrand-Name |
{Name of the Customer} |
Editable Parameters:
Editable Attributes | Impact | Allowed Values |
---|---|---|
isSubscribed | Subscribes or unsubscribes all the users from the Peer Spending Comparison Summary insight. | true, false |
insightTitle | The title returned in the GET feed API as well as the insights config tool can be changed. | Alphanumeric characters up to 100 characters (including spaces) |
duration | The data range that should be considered for evaluating the insight. |
|
threshold | The threshold (TOP) can be modified. | Any number between 1 to 100. |
Sample Request:
{
"customerSubscription": [
{
"insightName": "PEER_SPENDING_COMPARISON_SUMMARY",
"insightTitle": "Peer Spending Comparison Summary",
"customerConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"duration": "LAST_THREE_MONTHS",
"isBenchmarkEnabled":true,
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
]
}
]
}
]
}
Response Messages:
HTTP Status Code | Reason |
---|---|
400 | Y806: Invalid Input |
400 | Y800: Invalid value for insightName |
400 | Y800: Invalid value for insightTitle; special characters ><\""'%{}|^~[] are not supported. |
400 | Y801: Invalid length for insightTitle; min 3 and max 100 characters including spaces are allowed. |
400 | Y800: Invalid value for duration; Supported values are LAST MONTH, LAST_THREE_MONTHS, LAST_SIX_MONTHS, LAST_TWELVE_MONTHS |
400 | Y800: Invalid value for TOP in PEER_SPENDING_COMPARISON_SUMMARY insight Min =1 and Max = 100 |
400 | Y813: Invalid request. The entire object within threshold should be provided |
400 | Y800: Invalid value for isBenchmarkEnabled Supported values are true, false |
400 | Y802: Modifying isBenchmarkEnabled is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying isSubscribed is not allowed |
400 | Y800: PEER_SPENDING_COMPARISON_SUMMARY cannot be subscribed without benchmark enabled for the customer |
400 | Y800: Invalid value for isSubscribed. PEER_SPENDING_COMPARISON_SUMMARY cannot be subscribed without benchmark enabled for the customer |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying applicableEntity is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying triggerType is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying container is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying description is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying frequency is not allowed |
400 | Y800: Invalid value for isSubscribed; Supported values are true, false |
400 | Y825: Update not allowed without a valid request body |
400 | Y803: Invalid request; Either a valid insightTitle or customerConfiguration is required. |
400 | Y812: Required field/value - insightName missing in the request |
400 | Y802: Modifying InsightType attribute is not allowed |
400 | Y813: entityType should be provided |
400 | Y803: At least one additional attribute is required in addition to entityType. |
400 | Y800: Invalid value for customerConfiguration; customerConfiguration is either missing, duplicated, or has insufficient/ incorrect attributes. |
400 | Y800: Invalid value for entityType. Supported entityType for PEER_SPENDING_COMPARISON_SUMMARY insight are - [ACCOUNT] |
400 | Y802: For PEER_SPENDING_COMPARISON_SUMMARY insight, {Invalid String} inside the threshold is either repeated or not allowed |
400 | Y802: For PEER_SPENDING_COMPARISON_SUMMARY insight, {Invalid String} inside the threshold is not allowed |
400 | Y800: Invalid value for input json |
401 | Y020: Invalid token in authorization header |
401 | Y020: Token has expired |
GET User Subscription
The GET user subscription API provides all the information about the user defaults set for the insight.
The entityId
filter does not apply to this insight.
Method and URL:
GET /insights/configs/userSubscriptions
Header Parameters:
Key | Value | |
---|---|---|
Authorization |
Client credentials-based authorization | Bearer {{Access Token}} |
API key-based authentication | Bearer {{JWT Token_Customer}} |
|
Deprecated cobrand and user credential-based authentication | cobSession={cobSession received in the cobrand login service}, userSession={userSession received in the user login service} |
|
Content-Type |
application/json |
|
Api-Version |
2.1 |
|
2 |
||
Cobrand-Name |
{Name of the Customer} |
Sample Request:
GET /insights/configs/userSubscriptions?insightName=PEER_SPENDING_COMPARISON_SUMMARY
Sample Response:
For more information about the attributes that are returned in the API response, refer to the Insights Data Model page.
- Api-Version 2.1 Response
{
"userSubscription":[
{
"insightName": "PEER_SPENDING_COMPARISON_SUMMARY",
"insightTitle": "Peer Spending Comparison Summary",
"insightType": "AGGREGATE",
"triggerType": "SCHEDULE",
"containers": [
"BANK",
"CARD"
],
"description": "Generates an insight that provides information about categories the users overspends and underspends compared to their peers spending.",
"applicableEntity": [
"ACCOUNT"
],
"userConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"frequency": "MID_MONTHLY",
"duration": "LAST_THREE_MONTHS",
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
],
"isBenchmarkEnabled": true
}
],
"customerConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"frequency": "MID_MONTHLY",
"duration": "LAST_THREE_MONTHS",
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
],
"isBenchmarkEnabled": true
}
]
}
]
}
- Api-Version 2 Response
{
"userSubscription":[
{
"insightName": "PEER_SPENDING_COMPARISON_SUMMARY",
"insightTitle": "Peer Spending Comparison Summary",
"insightType": "AGGREGATE",
"triggerType": "SCHEDULE",
"container": [
"BANK",
"CARD"
],
"description": "Generates an insight that provides information about categories the users overspends and underspends compared to their peers spending.",
"applicableEntity": [
"ACCOUNT"
],
"userConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"frequency": "MID_MONTHLY",
"duration": "LAST_THREE_MONTHS",
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
],
"isBenchmarkEnabled": true
}
],
"customerConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"frequency": "MID_MONTHLY",
"duration": "LAST_THREE_MONTHS",
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
],
"isBenchmarkEnabled": true
}
]
}
]
}
PATCH User Subscription
Using the PATCH user subscription API for user subscription, users can change the defaults for each insight. If the user wants the insight to be evaluated for a new account, then add that account using the PATCH user subscription API. The customer default threshold values will apply if the user has not set any values.
If the customer has opted for the PB feature during onboarding, the isBenchmarkEnabled
field will be by default true
and cannot be modified.
Method and URL:
PATCH /insights/configs/userSubscriptions
Header Parameters:
Key | Value | |
---|---|---|
Authorization |
Client credentials-based authorization | Bearer {{Access Token}} |
API key-based authentication | Bearer {{JWT Token_Customer}} |
|
Deprecated cobrand and user credential-based authentication | cobSession={cobSession received in the cobrand login service}, userSession={userSession received in the user login service} |
|
Content-Type |
application/json |
|
Api-Version |
2.1 |
|
2 |
||
Cobrand-Name |
{Name of the Customer} |
Editable Parameters:
Editable Attributes | Impact | Allowed Values |
---|---|---|
isSubscribed | Subscribes or unsubscribes from the Peer Spending Comparison Summary insight. | true, false |
duration | The data range that should be considered for evaluating the insight. |
|
threshold | The threshold (TOP) can be modified. | Any number between 1 to 100. |
Sample Request:
{
"userSubscription": [
{
"insightName": "PEER_SPENDING_COMPARISON_SUMMARY",
"userConfiguration": [
{
"entityType": "ACCOUNT",
"isSubscribed": true,
"duration": "LAST_THREE_MONTHS",
"threshold": [
{
"name": "TOP",
"value": "5",
"type": "NUMBER"
}
],
"isBenchmarkEnabled": true
}
]
}
]
}
Error Messages:
HTTP Status Code | Reason |
---|---|
400 | Y806: Invalid input |
400 | Y800: Invalid value for insightName |
400 | Y800: Invalid value for input param in PEER_SPENDING_COMPARISON_SUMMARY insight |
400 | Y800: Invalid value for duration; Supported values are LAST MONTH, LAST_THREE_MONTHS, LAST_SIX_MONTHS, LAST_TWELVE_MONTHS |
400 | Y800: Invalid value for threshold data in PEER_SPENDING_COMPARISON_SUMMARY insight |
400 | Y800: Invalid value for TOP in PEER_SPENDING_COMPARISON_SUMMARY insight Min =1 and Max = 100 |
400 | Y802: Modifying insightTitle using this API is not allowed |
400 | Y813: Invalid request. The entire object within threshold should be provided |
400 | Y800: Invalid value for isBenchmarkEnabled Supported values are true, false |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying isSubscribed is not allowed |
400 | Y802: Modifying isBenchmarkEnabled is not allowed |
400 | Y800: PEER_SPENDING_COMPARISON_SUMMARY cannot be subscribed without benchmark enabled for the customer |
400 | Y800: Invalid value for isSubscribed. PEER_SPENDING_COMPARISON_SUMMARY cannot be subscribed without benchmark enabled for the customer |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying applicableEntity is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying triggerType is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying container is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying description is not allowed |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, modifying frequency is not allowed |
400 | Y800: Invalid value for isSubscribed; Supported values are true, false |
400 | Y825: Update not allowed without a valid request body |
400 | Y812: Required field/value - insightName missing in the request |
400 | Y802: Modifying InsightType attribute is not allowed |
400 | Y813: entityType should be provided |
400 | Y803: At least one additional attribute is required in addition to entityType. |
400 | Y800: Invalid value for userConfiguration; userConfiguration is either missing, duplicated, or has insufficient/ incorrect attributes |
400 | Y802: For insight PEER_SPENDING_COMPARISON_SUMMARY, configurations at an entityId level are not allowed |
400 | Y800: Invalid value for entityType. Supported entityType for PEER_SPENDING_COMPARISON_SUMMARY insight are - [ACCOUNT] |
400 | Y800: Invalid value for input json |
401 | Y020: Invalid token in authorization header |
401 | Y020: Token has expired |
GET Insight Feeds
The GET insights feed API retrieves all or a subset of the valid insight notifications generated for a particular user. However, using the insightName
filter, the Peer Spending Comparison Summary insight can be specifically requested.
The entityId
filter does not apply to this insight.
Calculation Logic for Derived Attributes:
averageNetTotal
=netTotal
/duration
spendAmount
=benchmark.netTotal.amount
peerSpendingComparison
=netTotal
-spendAmount
peerSpendDifferencePercent
= {(netTotal
-spendAmount
)/spendAmount
} * 100
Method and URL:
GET /insights/feed
Header Parameters:
Key | Value | |
---|---|---|
Authorization |
Client credentials-based authorization | Bearer {{Access Token}} |
API key-based authentication | Bearer {{JWT Token_Customer}} |
|
Deprecated cobrand and user credential-based authentication | cobSession={cobSession received in the cobrand login service}, userSession={userSession received in the user login service} |
|
Content-Type |
application/json |
|
Api-Version |
2.1 |
|
2 |
||
Cobrand-Name |
{Name of the Customer} |
Sample Request:
GET /insights/feed?insightName=PEER_SPENDING_COMPARISON_SUMMARY
Sample Response:
For more information about the attributes that are returned in the API response, refer to the Insights Data Model page.
{
"feed":[
{
"id":"61f1f23d5fa1a2410b0f90ca",
"insightName":"PEER_SPENDING_COMPARISON_SUMMARY",
"insightTitle":"Peer Spending Comparison Summary",
"insightType":"AGGREGATE",
"triggerType":"SCHEDULE",
"createdDate":"2022-01-27T01:15:39Z",
"subscription":[
{
"entityType":"ACCOUNT",
"frequency":"MID_MONTHLY",
"duration":"LAST_THREE_MONTHS",
"threshold":[
{
"name":"TOP",
"value":"5",
"type":"NUMBER"
}
]
}
],
"basicCategoryDetail":[
{
"categoryId":13,
"category":"Home Improvement",
"netTotal":{
"amount":13159.5,
"currency":"USD"
},
"link":{
"entityName":"transaction",
"url":"/derived/transactions?fromDate=2021-10-01&toDate=2021-12-31&categoryId=13&accountId=14568111,14568116,14568114,14568115,14568112,14568113"
},
"basicPeerDetail":{
"dateRange":{
"fromDate":"2021-10-01",
"toDate":"2021-12-31"
},
"benchmarkAsOf":"Dec-2021",
"benchmark":[
{
"geo":{
"level":"national",
"value":"US"
},
"benchmarkLevel":"national",
"netTotal":{
"amount":186.0,
"currency":"USD"
},
"numberOfPeers":3702705
}
]
},
"peerSpendingComparison":{
"peerSpendDifference":{
"amount":12973.5,
"currency":"USD"
},
"peerSpendDifferencePercent":6975.0,
"isOverSpending":true
}
},
{
"categoryId":5,
"category":"Clothing/Shoes",
"netTotal":{
"amount":13303.5,
"currency":"USD"
},
"link":{
"entityName":"transaction",
"url":"/derived/transactions?fromDate=2021-10-01&toDate=2021-12-31&categoryId=5&accountId=14568111,14568116,14568114,14568115,14568112,14568113"
},
"basicPeerDetail":{
"dateRange":{
"fromDate":"2021-10-01",
"toDate":"2021-12-31"
},
"benchmarkAsOf":"Dec-2021",
"benchmark":[
{
"geo":{
"level":"national",
"value":"US"
},
"benchmarkLevel":"national",
"netTotal":{
"amount":429.0,
"currency":"USD"
},
"numberOfPeers":4239700
}
]
},
"peerSpendingComparison":{
"peerSpendDifference":{
"amount":12874.5,
"currency":"USD"
},
"peerSpendDifferencePercent":3001.05,
"isOverSpending":true
}
},
{
"categoryId":15,
"category":"Cable/Satellite Services",
"netTotal":{
"amount":9007.0,
"currency":"USD"
},
"link":{
"entityName":"transaction",
"url":"/derived/transactions?fromDate=2021-10-01&toDate=2021-12-31&categoryId=15&accountId=14568111,14568116,14568114,14568115,14568112,14568113"
},
"basicPeerDetail":{
"dateRange":{
"fromDate":"2021-10-01",
"toDate":"2021-12-31"
},
"benchmarkAsOf":"Dec-2021",
"benchmark":[
{
"geo":{
"level":"national",
"value":"US"
},
"benchmarkLevel":"national",
"netTotal":{
"amount":231.0,
"currency":"USD"
},
"numberOfPeers":2720567
}
]
},
"peerSpendingComparison":{
"peerSpendDifference":{
"amount":8776.0,
"currency":"USD"
},
"peerSpendDifferencePercent":3799.13,
"isOverSpending":true
}
},
{
"categoryId":10,
"category":"Groceries",
"netTotal":{
"amount":8807.0,
"currency":"USD"
},
"link":{
"entityName":"transaction",
"url":"/derived/transactions?fromDate=2021-10-01&toDate=2021-12-31&categoryId=10&accountId=14568111,14568116,14568114,14568115,14568112,14568113"
},
"basicPeerDetail":{
"dateRange":{
"fromDate":"2021-10-01",
"toDate":"2021-12-31"
},
"benchmarkAsOf":"Dec-2021",
"benchmark":[
{
"geo":{
"level":"national",
"value":"US"
},
"benchmarkLevel":"national",
"netTotal":{
"amount":893.0,
"currency":"USD"
},
"numberOfPeers":4349177
}
]
},
"peerSpendingComparison":{
"peerSpendDifference":{
"amount":7914.0,
"currency":"USD"
},
"peerSpendDifferencePercent":886.23,
"isOverSpending":true
}
},
{
"categoryId":23,
"category":"Travel",
"netTotal":{
"amount":7996.5,
"currency":"USD"
},
"link":{
"entityName":"transaction",
"url":"/derived/transactions?fromDate=2021-10-01&toDate=2021-12-31&categoryId=23&accountId=14568111,14568116,14568114,14568115,14568112,14568113"
},
"basicPeerDetail":{
"dateRange":{
"fromDate":"2021-10-01",
"toDate":"2021-12-31"
},
"benchmarkAsOf":"Dec-2021",
"benchmark":[
{
"geo":{
"level":"national",
"value":"US"
},
"benchmarkLevel":"national",
"netTotal":{
"amount":230.0,
"currency":"USD"
},
"numberOfPeers":4092585
}
]
},
"peerSpendingComparison":{
"peerSpendDifference":{
"amount":7766.5,
"currency":"USD"
},
"peerSpendDifferencePercent":3376.74,
"isOverSpending":true
}
}
]
}
]
}