Generate cash flow forecast
/partners/reports/cash-flow-forecastForecasts the workspace's cash for the next 13 weeks, with optional what-if scenarios.
Starting cash is the bank and cash balance the dashboard shows. Each week carries `openingBalance`, `inflows` and `outflows` (totals by source), `closingBalance`, and `forecastLines` — the individual items, each with `isEstimate`. The report also returns `lowestBalance`, `atRisk`, `beyondHorizon`, and `assumptions`, which say what is left out. Send an empty body for the base forecast. With a `scenario`, `scenarioForecast` holds the forecast with the scenario applied; re-run with a different scenario rather than adjusting figures yourself. No query parameters are accepted, and the body is strict: an unknown key is a 400.
Request body
scenarioobjectWhat-if changes to apply on top of the base forecast. Send any of the three lists.
customerPaymentDelaysarrayMove a customer's expected payments later (or earlier). At most 100.
customerUuiduuidrequiredCustomer UUID.
delayDaysintegerrequiredDays to move the customer's payments, -365 to 365.
billPaymentDelaysarrayPay a bill on a different date. At most 100.
billUuiduuidrequiredBill UUID.
newPaymentDatedaterequiredYYYY-MM-DD payment date.
adjustmentsarrayExtra cash in or out that the books do not hold yet, e.g. a loan or a new hire. At most 50.
descriptionstringrequiredLabel, 1–200 characters.
amountstringrequiredPositive decimal string with at most two places, e.g. `"6000.00"`.
directionenumrequiredCash in or cash out.
One of: inflow, outflow
startDatedaterequiredYYYY-MM-DD date of the first occurrence.
cadenceenumrequiredHow often it repeats.
One of: once, weekly, monthly
Responses
200The forecast. Amounts are decimal strings in `currency`. `scenarioForecast` has the same shape as `forecast`, and is null when no scenario was sent. `weeks` holds 13 entries; one is shown here.400The body has an unknown key, or a scenario value is invalid.401Missing or invalid HMAC signature, expired timestamp, or invalid Bearer token. Troubleshoot403The credential does not have access to this workspace or resource. Troubleshoot429Rate limit exceeded (100 requests per minute per user of each app, or 10,000 per minute per app). Retry after the Retry-After header. Troubleshoothttps://api.getcount.com/partners/reports/cash-flow-forecastimport crypto from 'node:crypto';
const BASE_URL = 'https://api.getcount.com';
const CLIENT_ID = process.env.COUNT_CLIENT_ID;
const CLIENT_SECRET = process.env.COUNT_CLIENT_SECRET;
const ACCESS_TOKEN = process.env.COUNT_ACCESS_TOKEN;
const method = 'POST';
const signingPath = '/reports/cash-flow-forecast';
const timestamp = Math.floor(Date.now() / 1000).toString();
const body = {
"scenario": {
"customerPaymentDelays": [
{
"customerUuid": "dfa3219e-6af8-4c53-997a-037534f63a35",
"delayDays": 30
}
],
"adjustments": [
{
"description": "New hire salary",
"amount": "6000.00",
"direction": "outflow",
"startDate": "2026-04-01",
"cadence": "monthly"
}
]
}
};
const bodyString = JSON.stringify(body);
const bodyHash = crypto.createHash('sha256').update(bodyString).digest('hex');
const baseString = `${method}:${signingPath}:${timestamp}:${bodyHash}`;
const signature = crypto.createHmac('sha256', CLIENT_SECRET).update(baseString).digest('hex');
const response = await fetch(`${BASE_URL}/partners/reports/cash-flow-forecast`, {
method,
headers: {
'x-client-id': CLIENT_ID,
'x-timestamp': timestamp,
'x-signature': signature,
'Content-Type': 'application/json',
Authorization: `Bearer ${ACCESS_TOKEN}`,
},
body: bodyString,
});
console.log(await response.json());{
"status": "success",
"message": "Success on generating cash flow forecast",
"data": {
"currency": "USD",
"asOf": "2026-03-02",
"exchangeRateDate": "2026-03-02",
"startingCash": {
"amount": "48250.00"
},
"forecast": {
"weeks": [
{
"weekStart": "2026-03-02",
"weekEnd": "2026-03-08",
"openingBalance": "48250.00",
"inflows": {
"invoices": "1250.00",
"recurringInvoices": "0.00",
"gst": "0.00",
"adjustments": "0.00",
"total": "1250.00"
},
"outflows": {
"bills": "2500.00",
"recurringSpend": "180.00",
"payroll": "0.00",
"gst": "0.00",
"adjustments": "0.00",
"total": "2680.00"
},
"closingBalance": "46820.00",
"forecastLines": [
{
"type": "invoice",
"direction": "inflow",
"date": "2026-03-05",
"amount": "1250.00",
"description": "Acme Corporation — INV-1042",
"reference": "f6a7b8c9-d0e1-2345-fabc-456789012345",
"isEstimate": false
}
]
}
],
"lowestBalance": {
"weekStart": "2026-03-02",
"amount": "46820.00"
},
"atRisk": {
"amount": "0.00",
"invoices": []
},
"beyondHorizon": {
"inflows": "0.00",
"outflows": "0.00"
}
},
"scenarioForecast": null,
"assumptions": [
{
"code": "credit_cards_excluded",
"message": "Starting cash counts bank and cash accounts only; credit card balances are not included."
}
]
}
}