# Treasury Liquidity Forecast API

> Treasury Liquidity Forecast API is a paid API for AI agents from portfolio-risk-analyzer-g9ao.onrender.com, paid per call via x402, $0.5/call, status unknown (last checked 2026-11-30).

Projects daily cash balances over a configurable horizon, identifies minimum cash points and buffer breaches, and optionally computes DSO/DPO/DIO working capital metrics.

## Facts

- Endpoint: POST https://portfolio-risk-analyzer-g9ao.onrender.com/liquidity?utm_source=zero.xyz
- Price: $0.5/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/treasury-liquidity-forecast-api-1d99de0d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_I8HPDM5YjUigZe6hk0L8t

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability treasury-liquidity-forecast-api-1d99de0d -d '<json body>'
```

Example prompt: 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.

## When to prefer this

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).

## Known failure modes

- 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

## How this service works

Treasury Risk Analyzer — Deterministic liquidity forecast: daily cash projection, minimum cash and date, buffer breach, liquidity status, optional DSO/DPO/DIO.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "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
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/treasury-liquidity-forecast-api-1d99de0d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from portfolio-risk-analyzer-g9ao.onrender.com](https://www.zero.xyz/host/portfolio-risk-analyzer-g9ao.onrender.com/llms.txt)
