---
title: "Get Spending Insights"
method: GET
path: "/insights/v3/spending"
tags: ["Spending (NEW)"]
---

# Get Spending Insights

`GET /insights/v3/spending`

## Request

- Base URL: `https://sandbox.leantech.me`
- URL: `https://sandbox.leantech.me/insights/v3/spending`
- Auth: HTTP bearer

Enriches debit transactions with category, merchant, and location data, returning aggregated spending analytics  by category, merchant, and geography.

## Query parameters

- `entity_id` string, uuid, required
- `start_date` string, date
- `end_date` string, date

## Response `200`

OK

- object
  - `status` 'OK' | 'PENDING' | 'FAILED' | 'CONSENT_EXPIRED' | 'RECONNECT_REQUIRED' | 'PROCESSING_STARTED', required: The status of the request
  - `results_id` string, uuid, required: The unique identifier for the request
  - `message` string, required: A message describing the status of the request
  - `meta` object, nullable: Meta information about the request
  - `timestamp` string, date-time, required: The datetime of when the request was made
  - `status_detail` StatusDetail, nullable
    - `granular_status_code` string, nullable: Granular status code
    - `status_additional_info` string, nullable: Additional information about the status
  - `insights` SpendingPayload: Insights payload wrapper carrying the spend aggregations on debit transactions
    - `spending` Spending, required: Spending insights aggregating debit transactions over a period: three breakdown sections (by category, by merchant, by location), each carrying its own detected-* counts and entry breakdown.
      - `by_category` SpendingCategorySection, required: Category breakdown with detected-category counts.
        - `detected_primary_category_count` integer, required: Number of distinct primary categories detected.
        - `detected_secondary_category_count` integer, required: Number of distinct (primary, secondary) category combinations detected.
        - `transaction_count` integer, required: Total number of classifiable debit transactions in the analysis window.
        - `breakdown` SpendingCategoryBreakdown[], required: One entry per (primary_category, secondary_category) combination.
          - `primary_category` string, required: Primary category name.
          - `secondary_category` string, required: Secondary category name.
          - `merchant_names` string[], required: Distinct merchant names observed within this category.
          - `merchant_count` integer, required: Number of distinct merchants in this category.
          - `total_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_transaction_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `transaction_count` integer, required: Number of transactions in this category.
          - `average_monthly_transactions` number, double, required: Average monthly transaction count across the full analysis window.
          - `average_monthly_transactions_active` number, double, required: Average monthly transaction count across months that had at least one transaction in this category.
          - `average_monthly_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_monthly_amount_active` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `first_transaction_date` string, date-time, required: Timestamp of the first transaction in this category.
          - `last_transaction_date` string, date-time, required: Timestamp of the most recent transaction in this category.
          - `active_months` integer, required: Number of months with at least one transaction in this category.
      - `by_merchant` SpendingMerchantSection, required: Merchant breakdown with detected-merchant count.
        - `detected_merchant_count` integer, required: Number of distinct merchants detected.
        - `transaction_count` integer, required: Total number of classifiable debit transactions in the analysis window.
        - `breakdown` SpendingMerchantBreakdown[], required: One entry per detected merchant.
          - `merchant_name` string, required: Merchant name.
          - `transaction_count` integer, required: Number of transactions with this merchant.
          - `total_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_transaction_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_monthly_transactions` number, double, required: Average monthly transaction count for this merchant across the full analysis window.
          - `average_monthly_transactions_active` number, double, required: Average monthly transaction count for this merchant across active months only.
          - `average_monthly_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_monthly_amount_active` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `first_transaction_date` string, date-time, required: Timestamp of the first transaction with this merchant.
          - `last_transaction_date` string, date-time, required: Timestamp of the most recent transaction with this merchant.
          - `active_months` integer, required: Number of months with at least one transaction with this merchant.
      - `by_location` SpendingLocationSection, required: Location breakdown with detected-location count.
        - `detected_location_count` integer, required: Number of distinct locations detected.
        - `transaction_count` integer, required: Total number of classifiable debit transactions in the analysis window.
        - `breakdown` SpendingLocationBreakdown[], required: One entry per detected location.
          - `location` string, required: Location name where transactions occurred.
          - `transaction_count` integer, required: Number of transactions in this location.
          - `total_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_transaction_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_monthly_transactions` number, double, required: Average monthly transaction count in this location across the full analysis window.
          - `average_monthly_transactions_active` number, double, required: Average monthly transaction count in this location across active months only.
          - `average_monthly_amount` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `average_monthly_amount_active` CurrencyAmount, required
            - `currency` string, required: The ISO 3 letter currency code
            - `amount` number, required: The amount of money in the currency specified.
          - `first_transaction_date` string, date-time, required: Timestamp of the first transaction in this location.
          - `last_transaction_date` string, date-time, required: Timestamp of the most recent transaction in this location.
          - `active_months` integer, required: Number of months with at least one transaction in this location.
  - `type` 'income' | 'employment' | 'cashflow' | 'credits-obligations' | 'non-credits-obligations' | 'expenses' | 'cash-balances' | 'freelancer-cashflow' | 'cashflow-patterns' | 'credit-assessments' | 'account-controls' | 'credit-obligations' | 'spending': type of insight

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `408`: Request Timeout
- `500`: Internal Server Error

---

[API](https://skmtc.dev/leantech/apis/insights-api-account-controls.md) - [All operations](https://skmtc.dev/leantech/apis/insights-api-account-controls/llms.txt) - [OpenAPI document](https://skmtc.dev/leantech/apis/insights-api-account-controls/revisions/6a904c24f1e4?raw)
