# Insights

### List all Insights Profile

This endpoint is used to get all previous profiles created for a specific customer. Profiles are groups of Insights attributes set up to show only some parts of Insights. Once you have the list of profiles, you can do a search by a specific profile id.

`Method: POST`

`Endpoint: {{env}}/api/insights/Profile/filter`

```json
{
  "statusCode": 200,
  "message": "GET Request successful.",
  "isError": false,
  "result": {
    "CurrentPage": 1,
    "PageSize": 10,
    "TotalCount": 3,
    "Items": [
      {
        "Id": "cc243009-...-e85332a78751",
        "Name": "Profile Name",
        "CustomerId": "074d593a-...-291eb37b72ed",
        "CreatedAt": "2022-08-16T08:36:21.419586Z",
        "InsightProfileItems": [
          {
            "Id": "9d09786b-...-410232caf200",
            "DataDictionaryId": "35b1018f-...-14abd3cf0a3a",
            "Attribute": "Pension Income",
            "Period": "ThreeMonthsAgo",
            "InsightsType": "Income"
          },
          {
            "Id": "a3e490b2-...-c766c75b619e",
            "DataDictionaryId": "35b1018f-...-14abd3cf0a3a",
            "Attribute": "Pension Income",
            "Period": "CurrentMonth",
            "InsightsType": "Income"
          }
        ]
      }
    ]
  }
}
```

**Response**

<table><thead><tr><th width="197">Parameter</th><th width="121">Type</th><th>Description</th></tr></thead><tbody><tr><td>CurrentPage</td><td>number</td><td>The current page</td></tr><tr><td>PageSize</td><td>number</td><td>The amount of rows returned in the current page</td></tr><tr><td>TotalCount</td><td>number</td><td>The total rows the filter returns</td></tr><tr><td><strong>Items</strong></td><td></td><td>List of profiles</td></tr><tr><td>Id</td><td>guid</td><td>Profile id</td></tr><tr><td>Name</td><td>string</td><td>Name</td></tr><tr><td>CustomerId</td><td>guid</td><td>Customer Id</td></tr><tr><td>CreatedAt</td><td>datetime</td><td>When the profile was created</td></tr><tr><td><strong>InsightProfileItems</strong></td><td></td><td>List of profile items</td></tr><tr><td>Id</td><td>guid</td><td>Profile item id</td></tr><tr><td>DataDictionaryId</td><td>guid</td><td>Data dictionary id</td></tr><tr><td>Attribute</td><td>string</td><td>* if available</td></tr><tr><td>Period</td><td>string</td><td>Period</td></tr><tr><td>InsightsType</td><td>string</td><td>Insights Type</td></tr></tbody></table>

### View the Profile of a User

This endpoint is used to get a specific group of Insights attributes according to the previous profile created.

`Method: POST`

`Endpoint: {{env}}/api/insights/GetInsightsProfile`

{% tabs %}
{% tab title="Payload" %}

```json
{
  "UserId": "fe244550-...-d75432a79751",
  "ProfileId": "0bc9894d-....-f691024aca19"
}
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "statusCode": 200,
  "message": "POST Request successful.",
  "isError": false,
  "result": [
    {
      "Value": 0,
      "InsightsType": "Income",
      "Period": "TwoMonthsAgo",
      "Title": "Credit Transfer"
    },
    {
      "Attribute": "AccountAgeDays",
      "Value": 250,
      "InsightsType": "Insights",
      "Period": "CurrentMonth",
      "Title": "Account Age Days"
    },
    {
      "Attribute": "Name",
      "Value": "Employer Name",
      "InsightsType": "Insights",
      "Period": "CurrentMonth",
      "Title": "Employer Name"
    },
    {
      "Value": 65.17,
      "InsightsType": "Expense",
      "Period": "OneMonthAgo",
      "Title": "Alcohol & Cannabis"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

**Response**

<table><thead><tr><th width="156">Parameter</th><th width="133">Type</th><th>Description</th></tr></thead><tbody><tr><td>Value</td><td>guid</td><td>The corresponding value of the InsightsType</td></tr><tr><td>InsightsType</td><td>string</td><td>Insights type</td></tr><tr><td>Period</td><td>string</td><td>Inform the period, Use the table below for valid options</td></tr><tr><td>Title</td><td>string</td><td>Attribute title</td></tr></tbody></table>

**Period**

| Period          |
| --------------- |
| CurrentMonth    |
| OneMonthAgo     |
| TwoMonthsAgo    |
| ThreeMonthsAgo  |
| FourMonthsAgo   |
| FiveMonthsAgo   |
| SixMonthsAgo    |
| SevenMonthsAgo  |
| EightMonthsAgo  |
| NineMonthsAgo   |
| TenMonthsAgo    |
| ElevenMonthsAgo |

### Get Insights

This endpoint is used to get the full Insights from a user in a specific period of time.

`Method: POST`

`Endpoint: {{env}}/api/insights/GetInsights`

{% tabs %}
{% tab title="Payload" %}

```json
  {
    "UserId": "fe244550-...-d75432a79751",
    "InsightPeriod": 360
  }
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "statusCode": 200,
  "message": "POST Request successful.",
  "isError": false,
  "result": {
    "Expenses": {
      "bills&utilities": {
        "total": {
          "period1": {
            "Amount": 188.86,
            "Percentage": 8.23,
            "Transactions": [
              {
                "Id": "c1db6b4d-...-f30cc96ae43f",
                "Date": "2022-07-04T23:00:00Z",
                "Description": "...",
                "Debit": 188.86,
                "Balance": 920.12,
                "Category": {
                  "Name": "Telecommunication",
                  "CategoryGroup": {
                    "Name": "Bills & Utilities"
                  }
                }
              }
              // ... potentially even more transactions ...
            ]
          },
          "total": {
            "Amount": 188.86,
            "Percentage": 8.23
          }
        }
      },
      "food&dining": {
        "total": {
          "period1": {
            "Amount": 73.18,
            "Percentage": 3.19
          },
          "total": {
            "Amount": 73.18,
            "Percentage": 3.19
          }
        }
      },
      "health&fitness": {
        "total": {
          "period1": {
            "Amount": 18.25,
            "Percentage": 0.8
          },
          "total": {
            "Amount": 18.25,
            "Percentage": 0.8
          }
        }
      },
      "investments": {
        "total": {
          "period1": {
            "Amount": 9.5,
            "Percentage": 0.41
          },
          "total": {
            "Amount": 9.5,
            "Percentage": 0.41
          }
        }
      },
      "shopping": {
        "total": {
          "period1": {
            "Amount": 69.24,
            "Percentage": 3.02
          },
          "total": {
            "Amount": 69.24,
            "Percentage": 3.02
          }
        }
      },
      "transfer": {
        "total": {
          "period1": {
            "Amount": 1067.57,
            "Percentage": 46.52
          },
          "total": {
            "Amount": 1689.07,
            "Percentage": 73.6
          }
        }
      },
      "travel": {
        "total": {
          "period1": {
            "Amount": 50.57,
            "Percentage": 2.2
          },
          "total": {
            "Amount": 50.57,
            "Percentage": 2.2
          }
        }
      },
      "uncategorized": {
        "total": {
          "period1": {
            "Amount": 190.52,
            "Percentage": 8.3
          },
          "total": {
            "Amount": 190.52,
            "Percentage": 8.3
          }
        }
      }
    },
    "Total": {
      "period1": {
        "Amount": 1673.33,
        "Percentage": 31.39
      },
      "total": {
        "Amount": 2294.83,
        "Percentage": 43.05
      }
    }
  },
  "Periods": {
    "period1": "Jul-2022"
  }
}
```

{% endtab %}
{% endtabs %}
