Figa

Insights API reference

Five read-only analytics endpoints that compute deterministic aggregations from expense data. All require expenses.read permission and accept a workspace-scoped API key.

← Back to API reference

No AI / LLM involved

These endpoints return deterministic calculations (sums, averages, linear regression). The conversational AI chat (/ai/chat) is a separate feature available only through the web UI, not via API key.

Summary

GET /api/v1/insights/summary · Permission: expenses.read

Spending summary for a single month with category and recipient breakdowns.

Query parameters

Param Type Required Description
periodstringYesMonth in YYYY-MM format (e.g. 2026-02).

Example request

curl -X GET "https://app.figa.io/api/v1/insights/summary?period=2026-02" \
  -H "x-api-key: et_live_abc123..."

Response

{
  "period": "2026-02",
  "total": 854250,
  "count": 24,
  "paid": 18,
  "unpaid": 6,
  "byCategory": [
    { "name": "Housing",  "amount": 420000, "count": 1, "pct": 49 },
    { "name": "Cloud",    "amount": 214250, "count": 5, "pct": 25 },
    { "name": "Food",     "amount": 120000, "count": 12, "pct": 14 },
    { "name": "Software", "amount": 100000, "count": 6,  "pct": 12 }
  ],
  "byRecipient": [
    { "name": "WeWork",  "amount": 420000, "count": 1 },
    { "name": "AWS",     "amount": 142500, "count": 3 },
    { "name": "Hetzner", "amount": 71750,  "count": 2 }
  ]
}

Response fields

Field Type Description
periodstringRequested period.
totalintegerTotal amount in cents.
countintegerTotal expense count.
paidintegerNumber of paid expenses.
unpaidintegerNumber of unpaid expenses.
byCategory[]arrayBreakdown by category, sorted by amount descending.
  .namestringCategory name.
  .amountintegerTotal in cents.
  .countintegerExpense count in this category.
  .pctintegerPercentage of total (0–100).
byRecipient[]arrayBreakdown by recipient, sorted by amount descending.
  .namestringRecipient name.
  .amountintegerTotal in cents.
  .countintegerExpense count for this recipient.

Comparison

GET /api/v1/insights/comparison · Permission: expenses.read

Compare two months with absolute/percentage differences and per-category change breakdown.

Query parameters

Param Type Required Description
p1stringYesFirst period in YYYY-MM format.
p2stringYesSecond period in YYYY-MM format (baseline for % calculation).

Example request

curl -X GET "https://app.figa.io/api/v1/insights/comparison?p1=2026-02&p2=2026-01" \
  -H "x-api-key: et_live_abc123..."

Response

{
  "p1": {
    "period": "2026-02", "total": 854250, "count": 24,
    "paid": 18, "unpaid": 6,
    "byCategory": [ ... ],
    "byRecipient": [ ... ]
  },
  "p2": {
    "period": "2026-01", "total": 790000, "count": 22,
    "paid": 22, "unpaid": 0,
    "byCategory": [ ... ],
    "byRecipient": [ ... ]
  },
  "diff": 64250,
  "diffPct": 8.1,
  "categoryChanges": [
    { "name": "Cloud",   "p1": 214250, "p2": 180000, "diff": 34250,  "diffPct": 19.0 },
    { "name": "Food",    "p1": 120000, "p2": 130000, "diff": -10000, "diffPct": -7.7 },
    { "name": "Housing", "p1": 420000, "p2": 420000, "diff": 0,      "diffPct": 0 }
  ]
}

Response fields

Field Type Description
p1SummaryFull summary object for first period.
p2SummaryFull summary object for second period (baseline).
diffintegerAbsolute difference in cents (p1.total − p2.total).
diffPctnumberPercentage change relative to p2 (1 decimal).
categoryChanges[]arrayPer-category changes, sorted by absolute diff descending.
  .namestringCategory name.
  .p1integerAmount in p1 (cents).
  .p2integerAmount in p2 (cents).
  .diffintegerDifference in cents.
  .diffPctnumberPercentage change (1 decimal).

GET /api/v1/insights/trends · Permission: expenses.read

Multi-month trend analysis with linear regression. Returns overall direction and per-category trends.

Query parameters

Param Type Required Description
monthsintegerNoNumber of months to analyze (2–24). Default: 6.

Example request

curl -X GET "https://app.figa.io/api/v1/insights/trends?months=12" \
  -H "x-api-key: et_live_abc123..."

Response

{
  "months": [
    { "period": "2025-03", "total": 680000 },
    { "period": "2025-04", "total": 720000 },
    { "period": "2025-05", "total": 710000 },
    { "period": "2025-06", "total": 780000 },
    { "period": "2025-07", "total": 810000 },
    { "period": "2025-08", "total": 854250 }
  ],
  "avgMonthly": 759042,
  "trend": "up",
  "trendPct": 8.4,
  "categoryTrends": [
    { "name": "Cloud",    "trend": "up",     "trendPct": 15.2 },
    { "name": "Food",     "trend": "stable", "trendPct": 2.1 },
    { "name": "Housing",  "trend": "stable", "trendPct": 0 },
    { "name": "Software", "trend": "down",   "trendPct": 6.8 }
  ]
}

Response fields

Field Type Description
months[]arrayMonthly totals in chronological order.
  .periodstringMonth (YYYY-MM).
  .totalintegerTotal amount in cents.
avgMonthlyintegerAverage monthly amount in cents.
trendstring"up" (>5%), "down" (<−5%), or "stable".
trendPctnumberAbsolute trend percentage (1 decimal). Calculated via linear regression.
categoryTrends[]arrayPer-category trends, sorted by trendPct descending.
  .namestringCategory name.
  .trendstring"up", "down", or "stable".
  .trendPctnumberAbsolute trend percentage (1 decimal).

Trend calculation

Trend direction is determined by linear regression across all months. The percentage represents the total change from first to last month relative to the first month's value. Thresholds: > 5% = up, < −5% = down, otherwise stable.

Anomalies

GET /api/v1/insights/anomalies · Permission: expenses.read

Detects unusually large expenses using two methods: (1) comparison against 6-month historical average per category, (2) median-based intra-period outlier detection.

Query parameters

Param Type Required Description
periodstringYesMonth in YYYY-MM format.
thresholdnumberNoMultiplier threshold (1–10). Default: 2.0. Expense flagged when amount ≥ threshold × average.

Example requests

# Default threshold (2x)
curl -X GET "https://app.figa.io/api/v1/insights/anomalies?period=2026-02" \
  -H "x-api-key: et_live_abc123..."

# Stricter threshold (3x)
curl -X GET "https://app.figa.io/api/v1/insights/anomalies?period=2026-02&threshold=3" \
  -H "x-api-key: et_live_abc123..."

Response

{
  "period": "2026-02",
  "anomalies": [
    {
      "expense": {
        "id": "Emergency server-1740009600000",
        "name": "Emergency server",
        "amount": 450000
      },
      "reason": "4.7x średnia dla kategorii Cloud",
      "avgForCategory": 95744
    },
    {
      "expense": {
        "id": "Team offsite-1740268800000",
        "name": "Team offsite",
        "amount": 280000
      },
      "reason": "3.1x mediana wydatków w okresie",
      "avgForCategory": 90000
    }
  ]
}

Response fields

Field Type Description
periodstringRequested period.
anomalies[]arrayDetected anomalies, sorted by ratio (highest first). Empty array if none found.
  .expense.idstringGenerated identifier.
  .expense.namestringExpense name.
  .expense.amountintegerAmount in cents.
  .reasonstringHuman-readable explanation, e.g. "4.7x średnia dla kategorii Cloud" or "3.1x mediana wydatków w okresie".
  .avgForCategoryintegerThe reference average or median used for comparison (cents).

Detection methods

Method Logic reason prefix
HistoricalCompares each expense against the 6-month average for its category.Nx średnia dla kategorii X
Intra-periodUses median of all expenses in the period. Catches outliers without history.Nx mediana wydatków w okresie

Forecast

GET /api/v1/insights/forecast · Permission: expenses.read

Linear projection of current spending to full month, plus scheduled recurring expenses that haven't been paid yet.

Query parameters

Param Type Required Description
periodstringYesMonth in YYYY-MM format.

Example request

curl -X GET "https://app.figa.io/api/v1/insights/forecast?period=2026-02" \
  -H "x-api-key: et_live_abc123..."

Response

{
  "period": "2026-02",
  "currentTotal": 520000,
  "daysElapsed": 16,
  "daysRemaining": 12,
  "projectedTotal": 910000,
  "upcomingRecurring": [
    { "name": "Netflix",     "amount": 4999,   "dueDate": "2026-02-20" },
    { "name": "Office rent", "amount": 420000, "dueDate": "2026-03-01" }
  ],
  "projectedWithRecurring": 1334999
}

Response fields

Field Type Description
periodstringRequested period.
currentTotalintegerAmount spent so far (cents).
daysElapsedintegerDays passed in the period.
daysRemainingintegerDays left in the period.
projectedTotalintegerLinear projection: (currentTotal / daysElapsed) × daysInMonth.
upcomingRecurring[]arrayUnpaid recurring expenses still due this month, sorted by date.
  .namestringRecurring expense name.
  .amountintegerAmount in cents.
  .dueDatestringDue date (YYYY-MM-DD).
projectedWithRecurringintegerprojectedTotal + sum(upcomingRecurring.amount).

Projection logic

For the current month, daysElapsed is today's date and upcomingRecurring only includes items scheduled after today. For past months, the full month is used and there are no upcoming items. For future months, currentTotal is 0 and all recurring items are listed.

Integration examples

Monthly Slack report (Make / n8n)

Fetch summary at end of month and post to Slack.

# 1. Fetch summary for current month
curl -X GET "https://app.figa.io/api/v1/insights/summary?period=2026-02" \
  -H "x-api-key: et_live_abc123..."

# 2. Fetch comparison with previous month
curl -X GET "https://app.figa.io/api/v1/insights/comparison?p1=2026-02&p2=2026-01" \
  -H "x-api-key: et_live_abc123..."

# 3. Format and send to Slack webhook

Spending anomaly alert

Run daily/weekly to catch unusual expenses early.

# Flag expenses exceeding 3x category average
curl -X GET "https://app.figa.io/api/v1/insights/anomalies?period=2026-02&threshold=3" \
  -H "x-api-key: et_live_abc123..."

# If anomalies[] is non-empty → send alert

Budget projection dashboard

Combine forecast with trends for a dashboard widget.

# Current month projection
curl -X GET "https://app.figa.io/api/v1/insights/forecast?period=2026-02" \
  -H "x-api-key: et_live_abc123..."

# 12-month trend for chart
curl -X GET "https://app.figa.io/api/v1/insights/trends?months=12" \
  -H "x-api-key: et_live_abc123..."