Skip to main content
GET
/
v1
/
users
/
spending
Get User Spending Analysis Endpoint
curl --request GET \
  --url https://api.mytruv.com/v1/users/spending \
  --header 'Authorization: Basic <encoded-value>'
{
  "spending": {
    "by_category": [
      {
        "category": "Food & Dining",
        "total_amount": "1020.00",
        "transaction_count": 36,
        "average_transaction": "28.33",
        "percentage_of_total": "20.0",
        "largest_transaction": {
          "transaction_id": "<string>",
          "amount": "200.31",
          "date": "2025-05-04",
          "description": "Whole Foods Market",
          "merchant_category_code": "5812"
        },
        "subcategories": [
          {
            "name": "Groceries",
            "amount": "500.00",
            "count": 15
          }
        ],
        "time_series": [
          {
            "end_date": "2025-10-16",
            "amount": "31.27",
            "count": 1,
            "start_date": "2025-10-16"
          }
        ],
        "trend": "5.0"
      }
    ],
    "by_merchant": [
      {
        "merchant_name": "Whole Foods",
        "category": "Food & Dining",
        "total_amount": "408.00",
        "transaction_count": 12,
        "average_transaction": "34.00",
        "percentage_of_total": "20.0",
        "is_recurring": true,
        "largest_transaction": {
          "transaction_id": "<string>",
          "amount": "200.31",
          "date": "2025-05-04",
          "description": "Whole Foods Market",
          "merchant_category_code": "5812"
        },
        "time_series": [
          {
            "end_date": "2025-10-16",
            "amount": "31.27",
            "count": 1,
            "start_date": "2025-10-16"
          }
        ],
        "trend": "5.0"
      }
    ],
    "by_time_period": [
      {
        "time_period": "month",
        "end_date": "2025-11-01",
        "total_amount": "408.00",
        "transaction_count": 12,
        "average_transaction": "34.00",
        "percentage_of_total": "20.0",
        "largest_transaction": {
          "transaction_id": "<string>",
          "amount": "200.31",
          "date": "2025-05-04",
          "description": "Whole Foods Market",
          "merchant_category_code": "5812"
        },
        "start_date": "2025-10-02",
        "trend": "5.0"
      }
    ]
  },
  "summary": {
    "total_spending": "5100.00",
    "average_daily_spending": "170.00",
    "average_monthly_spending": "5100.00",
    "total_transactions": 249,
    "unique_merchants": 3,
    "top_category": "Food & Dining",
    "top_merchant": "Whole Foods"
  },
  "request_id": "<string>",
  "created_at": "<string>",
  "by_time_period": [
    {
      "end_date": "2024-01-31",
      "total_amount": "1450.00",
      "transaction_count": 52,
      "percentage_of_total": "31.7",
      "breakdown": [
        {
          "name": "Food & Dining",
          "amount": "650.00",
          "transaction_count": 24,
          "percentage": "44.8"
        }
      ],
      "start_date": "2024-01-01",
      "trend": "5.5"
    }
  ]
}

Authorizations

Authorization
string
header
required

Use user_id as username and access_token as password.

Query Parameters

group_by
enum<string>
required
Available options:
category,
merchant,
time_period
time_period
enum<string>
required
Available options:
day,
week,
month,
quarter,
year
link_id
string | null
start_date
string<date> | null
end_date
string<date> | null
account_ids
string | null
categories
string | null
min_total_amount
number | null
default:50
include_income
boolean | null
default:false
secondary_group_by
enum<string> | null
Available options:
category,
merchant

Response

Successful Response

Spending analysis response with optional double aggregation.

Wraps the MyTruv API response and adds by_time_period with breakdown when secondary_group_by is specified.

spending
SpendingData · object
required

Spending data from MyTruv API.

summary
SpendingSummary · object
required

Summary statistics from MyTruv API.

request_id
string
required

Unique request identifier.

created_at
string
required

Analysis creation timestamp.

by_time_period
TimePeriodSpendingEnriched · object[] | null

Time periods with category/merchant breakdown. Only present when group_by=time_period and secondary_group_by is set.