1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "cashModel": {
12 "company": "Example Technology Inc.",
13 "currency": "USD",
14 "startDate": "2026-09-07",
15 "openingCash": 2400000,
16 "availableCreditLine": 750000,
17 "collections": [
18 {
19 "customer": "Customer A (monthly invoice)",
20 "weeks": {
21 "2": 620000,
22 "6": 620000,
23 "11": 620000
24 }
25 },
26 {
27 "customer": "Customer B (project payment)",
28 "weeks": {
29 "8": 900000
30 }
31 },
32 {
33 "customer": "Other customers (every week)",
34 "weekly": 300000
35 }
36 ],
37 "otherInflows": [
38 {
39 "item": "Grant payment",
40 "week": 9,
41 "amount": 250000
42 }
43 ],
44 "expenses": [
45 {
46 "item": "Payroll and social security",
47 "amount": 1150000,
48 "frequency": "monthly",
49 "paymentDay": 5
50 },
51 {
52 "item": "Rent",
53 "amount": 180000,
54 "frequency": "monthly",
55 "paymentDay": 1
56 },
57 {
58 "item": "SaaS and infrastructure",
59 "amount": 95000,
60 "frequency": "monthly",
61 "paymentDay": 15
62 },
63 {
64 "item": "Marketing",
65 "amount": 45000,
66 "frequency": "weekly"
67 },
68 {
69 "item": "Taxes and withholding",
70 "amount": 320000,
71 "frequency": "monthly",
72 "paymentDay": 26
73 },
74 {
75 "item": "Loan instalment",
76 "amount": 210000,
77 "frequency": "monthly",
78 "paymentDay": 20
79 },
80 {
81 "item": "Supplier payments (share of collections)",
82 "rate": 0.22,
83 "frequency": "variable"
84 },
85 {
86 "item": "Annual insurance premium",
87 "amount": 90000,
88 "frequency": "one-off",
89 "week": 7
90 }
91 ],
92 "scenarios": {
93 "base": {
94 "collectionMultiplier": 1,
95 "expenseMultiplier": 1,
96 "collectionDelayWeeks": 0
97 },
98 "best": {
99 "collectionMultiplier": 1.1,
100 "expenseMultiplier": 0.97,
101 "collectionDelayWeeks": 0
102 },
103 "worst": {
104 "collectionMultiplier": 0.8,
105 "expenseMultiplier": 1.05,
106 "collectionDelayWeeks": 2
107 }
108 },
109 "thresholdWeeks": 4,
110 "pastMonthlyNetCash": [
111 -310000,
112 -280000,
113 -350000
114 ],
115 "actuals": {
116 "1": {
117 "inflow": 280000,
118 "outflow": 125000
119 }
120 }
121 }
122};
123
124
125const run = await client.actor("bloom-consulting/cash-runway-13-week").call(input);
126
127
128console.log('Results from dataset');
129console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
130const { items } = await client.dataset(run.defaultDatasetId).listItems();
131items.forEach((item) => {
132 console.dir(item);
133});
134
135