# Cash flow forecast

> An issuer's next 13 weeks: what comes in and goes out from its invoices, payroll and taxes, with warnings and scenarios. Give it today's balance and what no invoice says.

Fiscalisto builds the cash flow forecast from what it already has for the issuer, like **Flujo de efectivo** in the app. It's an estimate: nothing changes on its own, not an invoice and not a payment. What you send only changes the forecast.

| Line (`type`) | Where it comes from |
| --- | --- |
| `receivable` | What your customers owe you, on the day each one usually pays (from their payment complements, like `GET /v1/customers/{id}/payment_behavior`) or, with no history, with their credit days. |
| `payable` | Your suppliers' unpaid invoices: the day you scheduled in the supplier portal, their due date or their credit days. |
| `payroll` | Payroll: the average of the latest ordinary receipts of each periodicity, on its next payday. |
| `taxes` | The pending monthly returns: what you paid in the latest ones or, if there are none, the IVA and ISR calculated from your CFDI. |
| `recurring_invoice` | What your active recurring invoices will bill. |
| `planned_inflow`, `planned_outflow` | What you added: a rent, a loan, a cash sale. |

What's more than 90 days late doesn't count (`left_out: "doubtful"`) unless you ask for it.

## See the 13 weeks

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/cash_forecast \
  -H "Authorization: Bearer $FISCALISTO_API_KEY"
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const cashForecast = await fiscalisto.cashForecast.get();
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

cash_forecast = fiscalisto.cash_forecast.get()
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$cashForecast = $fiscalisto->cashForecast->get();
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	cashForecast, err := client.CashForecast.Get(ctx, nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *cashForecast)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = fiscalisto.cashForecast().get();
System.out.println(cashForecast);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = await fiscalisto.CashForecast.GetAsync();
```

It answers the weeks (week 1 runs from today to Sunday) with their starting and ending balance, what comes in and goes out of each type in `by_type`, each line in `lines` with how it was estimated (`basis`) and how sure it is (`confidence`), and `warnings`:

| Warning (`type`) | When |
| --- | --- |
| `no_starting_balance` | You haven't given today's balance: the forecast starts from 0. |
| `stale_starting_balance` | The balance you gave is more than 7 days old. |
| `shortfall` | A week ends below `minimum_balance` (or 0); `shortfall` says how much would be missing. |
| `overdue_receivables` | A quarter or more of what you're owed is already late. |
| `customer_concentration` | A single customer is 40 % or more of what comes in. |
| `doubtful_left_out` | What's more than 90 days late was left out. |

Each warning brings in `detail` what you can do. You decide.

## What if…?

The parameters build a scenario without saving anything: `customers_pay_days_later` and `pay_suppliers_days_later` (0 to 120 days), `recurring_sales_change` (−100 to 100, percent), `include_recurring=false` and `include_doubtful=true`.

```bash tab="cURL"
curl -G https://api.fiscalisto.com/v1/cash_forecast \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -d customers_pay_days_later=15 \
  -d recurring_sales_change=-10
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const cashForecast = await fiscalisto.cashForecast.get({
  customers_pay_days_later: 15,
  recurring_sales_change: "-10",
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

cash_forecast = fiscalisto.cash_forecast.get({
    "customers_pay_days_later": 15,
    "recurring_sales_change": "-10",
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$cashForecast = $fiscalisto->cashForecast->get([
    'customers_pay_days_later' => 15,
    'recurring_sales_change' => '-10',
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	cashForecast, err := client.CashForecast.Get(ctx, &fiscalisto.GetCashForecastParams{
		CustomersPayDaysLater: fiscalisto.Int64(15),
		RecurringSalesChange:  fiscalisto.Int64(-10),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *cashForecast)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.GetCashForecastParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = fiscalisto.cashForecast().get(new GetCashForecastParams()
        .setCustomersPayDaysLater(15)
        .setRecurringSalesChange(-10));
System.out.println(cashForecast);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = await fiscalisto.CashForecast.GetAsync(new GetCashForecastParams
{
    CustomersPayDaysLater = 15,
    RecurringSalesChange = -10,
});
```

The answer says in `scenario` what it was calculated with.

## Today's balance

The bank doesn't tell Fiscalisto how much you have, so the forecast starts from the balance you give. `suggested_starting_balance` brings the one from your latest bank statements in Conciliación, only as a suggestion. With `minimum_balance`, each week that ends below it brings a warning.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/cash_forecast \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "starting_balance": { "amount": 185000, "date": "2026-11-16" },
    "minimum_balance": 50000
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const cashForecast = await fiscalisto.cashForecast.update({
  starting_balance: { amount: 185000, date: "2026-11-16" },
  minimum_balance: 50000,
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

cash_forecast = fiscalisto.cash_forecast.update({
    "starting_balance": {"amount": 185000, "date": "2026-11-16"},
    "minimum_balance": 50000,
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$cashForecast = $fiscalisto->cashForecast->update([
    'starting_balance' => ['amount' => 185000, 'date' => '2026-11-16'],
    'minimum_balance' => 50000,
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	cashForecast, err := client.CashForecast.Update(ctx, &fiscalisto.UpdateCashForecastParams{
		StartingBalance: &fiscalisto.UpdateCashForecastParamsStartingBalance{
			Amount: 185000,
			Date:   fiscalisto.String("2026-11-16"),
		},
		MinimumBalance: fiscalisto.Float64(50000),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *cashForecast)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.UpdateCashForecastParams;
import com.fiscalisto.model.UpdateCashForecastParamsStartingBalance;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = fiscalisto.cashForecast().update(new UpdateCashForecastParams()
        .setStartingBalance(new UpdateCashForecastParamsStartingBalance()
                .setAmount(185000)
                .setDate("2026-11-16"))
        .setMinimumBalance(50000));
System.out.println(cashForecast);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = await fiscalisto.CashForecast.UpdateAsync(new UpdateCashForecastParams
{
    StartingBalance = new() { Amount = 185000, Date = "2026-11-16" },
    MinimumBalance = 50000,
});
```

Only what you send changes; `starting_balance: null` removes it. It answers the forecast with the new balance.

## What no invoice says

A planned item is something you expect to pay or collect with no CFDI: the rent, a loan installment, a cash sale. It goes once (`once`) or every week, two weeks or month, until `until`.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/cash_forecast/planned_items \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Renta de la bodega",
    "direction": "outflow",
    "amount": 28000,
    "date": "2026-12-01",
    "frequency": "monthly"
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const cashForecastItem = await fiscalisto.cashForecast.createItem({
  description: "Renta de la bodega",
  direction: "outflow",
  amount: 28000,
  date: "2026-12-01",
  frequency: "monthly",
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

cash_forecast_item = fiscalisto.cash_forecast.create_item({
    "description": "Renta de la bodega",
    "direction": "outflow",
    "amount": 28000,
    "date": "2026-12-01",
    "frequency": "monthly",
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$cashForecastItem = $fiscalisto->cashForecast->createItem([
    'description' => 'Renta de la bodega',
    'direction' => 'outflow',
    'amount' => 28000,
    'date' => '2026-12-01',
    'frequency' => 'monthly',
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	cashForecastItem, err := client.CashForecast.CreateItem(ctx, &fiscalisto.CreateCashForecastItemParams{
		Description: "Renta de la bodega",
		Direction:   "outflow",
		Amount:      28000,
		Date:        "2026-12-01",
		Frequency:   fiscalisto.String("monthly"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(cashForecastItem.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.CreateCashForecastItemParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecastItem = fiscalisto.cashForecast().createItem(new CreateCashForecastItemParams()
        .setDescription("Renta de la bodega")
        .setDirection("outflow")
        .setAmount(28000)
        .setDate("2026-12-01")
        .setFrequency("monthly"));
System.out.println(cashForecastItem.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecastItem = await fiscalisto.CashForecast.CreateItemAsync(new CreateCashForecastItemParams
{
    Description = "Renta de la bodega",
    Direction = "outflow",
    Amount = 28000,
    Date = "2026-12-01",
    Frequency = "monthly",
});
```

It answers the item (`cfi_…`). `POST /v1/cash_forecast/planned_items/{id}` changes it and `DELETE` deletes it. Up to 200 per issuer.

## Change a line

A customer told you they'll pay later, or an invoice was already paid outside: send the line (`lines[].line`) with another `date`, another `amount` or `excluded: true`, and a `note` that whoever opens the week in the app will see.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/cash_forecast/adjustments \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "line": "cobro:ICV060329BY0:2026-10-15:ppd",
    "date": "2026-12-04",
    "note": "Nos avisó que paga en diciembre."
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const cashForecast = await fiscalisto.cashForecast.adjust({
  line: "cobro:ICV060329BY0:2026-10-15:ppd",
  date: "2026-12-04",
  note: "Nos avisó que paga en diciembre.",
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

cash_forecast = fiscalisto.cash_forecast.adjust({
    "line": "cobro:ICV060329BY0:2026-10-15:ppd",
    "date": "2026-12-04",
    "note": "Nos avisó que paga en diciembre.",
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$cashForecast = $fiscalisto->cashForecast->adjust([
    'line' => 'cobro:ICV060329BY0:2026-10-15:ppd',
    'date' => '2026-12-04',
    'note' => 'Nos avisó que paga en diciembre.',
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	cashForecast, err := client.CashForecast.Adjust(ctx, &fiscalisto.AdjustCashForecastParams{
		Line: "cobro:ICV060329BY0:2026-10-15:ppd",
		Date: fiscalisto.String("2026-12-04"),
		Note: fiscalisto.String("Nos avisó que paga en diciembre."),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *cashForecast)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.AdjustCashForecastParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = fiscalisto.cashForecast().adjust(new AdjustCashForecastParams()
        .setLine("cobro:ICV060329BY0:2026-10-15:ppd")
        .setDate("2026-12-04")
        .setNote("Nos avisó que paga en diciembre."));
System.out.println(cashForecast);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var cashForecast = await fiscalisto.CashForecast.AdjustAsync(new AdjustCashForecastParams
{
    Line = "cobro:ICV060329BY0:2026-10-15:ppd",
    Date = "2026-12-04",
    Note = "Nos avisó que paga en diciembre.",
});
```

`reset: true` brings it back to the estimate. It only changes the forecast, never the invoice. If the line changes (a payment arrives and the invoice is no longer owed), the change stops applying.

## With several RFCs

With an issuer that is its empresa's only RFC, the balance, the planned items and the changes are the same ones the app shows in **Flujo de efectivo**. If the empresa has several RFCs, each API issuer has its own, and the app adds up all the RFCs.
