Cashflow Insights — AI-Enhanced Backend with Xano
Source: Dev.to
What I Built
Late payments and unpredictable cash inflows are among the biggest operational risks for small and mid‑sized businesses. While most accounting tools record invoices and payments, they rarely provide actionable insight into when cash will actually arrive, which customers pose the highest risk, or what actions a business should take next. As a result, finance teams often rely on spreadsheets, static reports, or intuition, leading to delayed collections and liquidity stress.
This project addresses that gap by providing a production‑ready Cashflow Intelligence API built on Xano. The API sits on top of raw invoice data and transforms it into clear financial signals. It aggregates receivables, analyzes payment behavior, identifies high‑risk customers, and generates plain‑language insights that explain not just what is happening, but why.
Core Problems Solved
- Lack of visibility – Businesses struggle to understand how much of their receivables are genuinely collectible versus overdue and risky.
- Delayed risk detection – High‑risk customers are often identified too late, after invoices become severely overdue.
- Data without guidance – Numeric reports alone don’t tell teams what actions to prioritize.
API Capabilities
- Compute receivables aging and overdue exposure.
- Forecast near‑term cash inflows based on real outstanding balances.
- Rank customers by payment risk using behavioral signals.
- Produce AI‑generated explanations and recommendations that translate financial data into operational guidance.
Built entirely in Xano, this backend emphasizes correctness, clarity, and real‑world usability. It handles edge cases (such as missing data), avoids misleading parameters, and exposes a clean API contract suitable for dashboards, finance tools, or integrations. The result is a backend service that turns fragmented invoice data into actionable cashflow intelligence, helping businesses focus their efforts where it matters most.
API Documentation
Base URL
https://xbty-lwqs-omi0.m2.xano.io/api:HiJHfYhN
Authentication
All endpoints require an API key. Create an account via the /signup endpoint to obtain a key.
{
"business_name": "example name"
}
Example API key: ec49f7f0-089b-47f8-9f74-b81e6e474fba
Endpoints
POST /insert_invoice_data
Insert a new invoice record.
Request
curl -X POST 'https://xbty-lwqs-omi0.m2.xano.io/api:HiJHfYhN/insert_invoice_data' \
-H 'Content-Type: application/json' \
-H 'x-api-key: 10ebbb4b-a128-479b-b7b9-550d79bcf7cd' \
--data '{
"invoice_amount": 250,
"due_date": "2025-12-23",
"invoice_date": "2025-12-13",
"status": "unpaid",
"paid_date": null,
"customer_name": "Example_name",
"Currency": "dollars",
"invoice_number": "1"
}'
Response
{
"message": "Invoice created successfully",
"invoice": {
"id": 411,
"created_at": 1765656533022,
"invoice_date": "2025-12-13",
"customer_name": "Example_name",
"business_id": 6,
"due_date": "2025-12-23",
"amount": 250,
"status": "unpaid",
"paid_date": null,
"currency": "dollars",
"invoice_number": 1
}
}
GET /receivables_analytics
Analyze receivables for a business, returning DSO, aging buckets, and overdue percentage.
Request
curl -X GET 'https://xbty-lwqs-omi0.m2.xano.io/api:HiJHfYhN/receivables_analytics' \
-H 'Content-Type: application/json' \
-H 'x-api-key: ec49f7f0-089b-47f8-9f74-b81e6e474fba'
Response
{
"response": {
"days_sales_outstanding": 167.75147928994087,
"ageing": {
"0_30": 78.2,
"31_60": 183.25,
"61_90": 0,
"90_plus": 0
},
"overdue": 70.08988334289538
}
}
POST /cashflow_forecast
Forecast cash inflows based on current invoice data.
Request
curl -X POST 'https://xbty-lwqs-omi0.m2.xano.io/api:HiJHfYhN/cashflow_forecast' \
-H 'Content-Type: application/json' \
-H 'x-api-key: 89d9f509-573e-4ff8-94c7-2457832483ca'
Response
{
"forecast": {
"expected_inflows": {
"0_30_days": 234.37,
"31_60_days": 0,
"61_90_days": 0
},
"assumptions": {
"average_delay_days": 26
}
}
}
POST /calculate_risk_score
Perform a risk analysis for a specific customer. Set ai_notes to 1 to receive an AI‑generated plain‑language note (powered by Google Gemini).
Request
curl -X POST 'https://xbty-lwqs-omi0.m2.xano.io/api:HiJHfYhN/calculate_risk_score' \
-H 'Content-Type: application/json' \
-H 'x-api-key: 89d9f509-573e-4ff8-94c7-2457832483ca' \
--data '{
"ai_notes": 1,
"customer_name": "Judith Morales"
}'
Response
{
"risk_data": {
"customer_name": "Judith Morales",
"score": 31,
"risk_level": "High",
"late_payment_probability": 1
},
"ai_note": "Despite a low percentage of late invoices and no significant long‑term overdues, the \"High\" risk level is primarily driven by the substantial average payment delay of 49 days. This indicates consistent cash‑flow inefficiencies or slow internal payment processes for the customer, impacting your working capital. We recommend shortening payment terms or requiring partial upfront payments to mitigate exposure and improve cash conversion."
}
POST /business_dashboard
Combine all analytics (receivables, forecast, risk) and return the top 5 most risky customers plus an AI summary of the business’s cashflow health.
Request
curl -X POST 'https://xbty-lwqs-omi0.m2.xano.io/api:HiJHfYhN/business_dashboard' \
-H 'Content-Type: application/json' \
-H 'x-api-key: ec49f7f0-089b-47f8-9f74-b81e6e474fba'
Response
{
"stats": {
"dso": 167.75147928994087,
"overdue_percent": 70.08988334289538,
"total_ar_0_30": 78.2,
"total_ar_31_60": 183.25,
"total_ar_61_90": 0,
"total_ar_90_plus": 0,
"forecast_0_30": 261.45,
"forecast_31_60": 0,
"forecast_61_90": 0
},
"risky_customers": {
"itemsReceived": 5,
"items": [
{
"customer_name": "Sue Grant",
"score": 20,
"risk_level": "High",
"late_payment_probability": 1
},
{
"customer_name": "Philip Herrera",
"score": 23,
"risk_level": "High",
"late_payment_probability": 1
},
{
"customer_name": "Elsie Dunn",
"score": 56,
"risk_level": "Medium",
"late_payment_probability": 1
},
{
"customer_name": "Katie Weaver",
"score": 100,
"risk_level": "Low",
"late_payment_probability": 0
},
{
"customer_name": "Terry Ortiz",
"score": 100,
"risk_level": "Low",
"late_payment_probability": 0
}
]
},
"summary": "Your accounts receivable health is concerning. Your Days Sales Outstanding (DSO) is very high at 168 days, indicating very slow collections. An alarming 70% of your current receivables are overdue, with a significant amount ($183.25) already 31‑60 days past due. While you forecast $261.45 in cash inflows for the next 30 days, there are no significant inflows projected beyond that for the 31‑90 day period. This gap is critical, especially considering the large existing overdue balance from 31‑60 days. High‑risk customers like Sue Grant, Philip Herrera, and Elsie Dunn are very likely to cause payment delays, directly impacting cash conversion."
}