{"uid":"cap_I8HPDM5YjUigZe6hk0L8t","slug":"treasury-liquidity-forecast-api-1d99de0d","name":"Treasury Liquidity Forecast API","description":"Treasury Risk Analyzer — Deterministic liquidity forecast: daily cash projection, minimum cash and date, buffer breach, liquidity status, optional DSO/DPO/DIO.","url":"https://portfolio-risk-analyzer-g9ao.onrender.com/liquidity?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"cashFlows":{"type":"array","items":{"type":"object","required":["date","amount"],"properties":{"date":{"type":"string","format":"date"},"amount":{"type":"number"},"category":{"type":"string","maxLength":50},"description":{"type":"string","maxLength":200}}}},"startDate":{"type":"string","format":"date"},"horizonDays":{"type":"integer","maximum":3650,"minimum":1},"openingCash":{"type":"number"},"baseCurrency":{"type":"string","default":"USD"},"workingCapital":{"type":"object","required":["accountsReceivable","accountsPayable","periodCreditSales","periodCOGS","periodDays"],"properties":{"inventory":{"type":"number","minimum":0},"periodCOGS":{"type":"number","minimum":0},"periodDays":{"type":"number","maximum":3650,"exclusiveMinimum":0},"accountsPayable":{"type":"number","minimum":0},"periodCreditSales":{"type":"number","minimum":0},"accountsReceivable":{"type":"number","minimum":0}}},"minimumCashBuffer":{"type":"number","minimum":0}}},"responseSchema":{"type":"json","example":{"status":"success","forecast":{"peak_date":"2026-09-14","shortfall":200000,"start_date":"2026-09-14","horizon_days":30,"minimum_date":"2026-09-27","opening_cash":800000,"buffer_breach":true,"required_buffer":500000,"projected_cash_peak":800000,"minimum_cash_position":300000},"warnings":[],"timestamp":"2026-11-05T06:08:41.990Z","projection":[{"date":"2026-09-14","cashBalance":800000}],"analysis_id":"4740e7bb-d458-437e-b03d-8ac0915972b3","base_currency":"USD","liquidity_status":"WARNING","recommended_action":"Raise liquidity before 2026-09-27 to maintain the required buffer.","risk_classification":{"level":"MEDIUM","score":47}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.5","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.5/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_mBYw2KKSho-dN_zeGc2RI","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.5","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Projects daily cash balances over a configurable horizon, identifies minimum cash points and buffer breaches, and optionally computes DSO/DPO/DIO working capital metrics.","exampleAgentPrompt":"Run a 90-day liquidity forecast starting 2024-07-01 with an opening cash balance of $500,000, a minimum cash buffer of $50,000, and these scheduled cash flows: +$120,000 on July 5, -$80,000 on July 15, +$200,000 on August 1, -$150,000 on August 20 — also include working capital metrics using $300,000 in accounts receivable, $180,000 in accounts payable, $90,000 inventory, $1.2M credit sales, $800,000 COGS over 90 days.","exampleUseCases":[{"title":"Quarterly cash runway stress test","prompt":"I need a 180-day cash flow projection starting January 1 with $750,000 opening cash and a $100,000 minimum buffer. Here are our expected cash flows: payroll of -$95,000 on the 1st and 15th of each month, rent of -$18,000 on the 1st, and customer receipts of +$130,000 on the 10th and +$110,000 on the 25th of each month. Tell me the lowest cash point and whether we ever breach the buffer."},{"title":"Working capital metrics for CFO report","prompt":"Compute our DSO, DPO, and DIO for last quarter: we have $420,000 in accounts receivable, $210,000 in accounts payable, $95,000 in inventory, $1.8M in credit sales, $1.1M in COGS over 90 days. Project cash from April 1 for 90 days with $300,000 opening cash."},{"title":"Month-end buffer breach check","prompt":"We need to know if our cash will drop below our $25,000 safety buffer at any point this month. Opening balance is $80,000 as of September 1. Expected outflows: -$30,000 on Sep 5 for supplier invoices, -$20,000 on Sep 18 for payroll. Inflows: +$15,000 on Sep 10, +$40,000 on Sep 22. Run the forecast over 30 days and flag any breach dates."}],"resultDescription":"Returns a deterministic daily cash projection array showing the projected balance for each day of the horizon, the date and amount of the minimum cash point, a boolean buffer breach indicator with breach dates if applicable, an overall liquidity status (e.g. healthy/at-risk/breached), and optionally DSO, DPO, and DIO ratios when working capital inputs are supplied.","failureModes":["Missing required cash flow items (date or amount) return 400 validation error","horizonDays exceeding 3650 returns 400 out-of-range error","Invalid date formats in cashFlows or startDate return parsing errors","workingCapital object provided but missing required fields (accountsReceivable, accountsPayable, etc.) returns 400","Payment not received (402) if x402 USDC payment header is missing or insufficient","Cold-start latency on Render free tier may cause first-request timeout","Negative or zero periodDays in workingCapital returns exclusiveMinimum validation error"],"whenToPreferThis":"Choose this endpoint when you need a deterministic, rule-based daily cash projection rather than a probabilistic or ML-based forecast. It is ideal for treasury teams wanting to identify specific buffer breach dates, compute exact minimum cash points, and optionally layer in working capital KPIs (DSO/DPO/DIO) in a single call. Prefer it over generic spreadsheet models when you need a programmatic, automatable liquidity check that integrates with other Treasury Risk Analyzer sibling endpoints (FX exposure, payment feasibility).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-30T12:33:12.740Z","isFirstParty":false,"canonicalSlug":"treasury-liquidity-forecast-api-1d99de0d"}