# Give today's balance

`POST https://api.fiscalisto.com/v1/cash_forecast`

Today's balance in your bank accounts (where the cash flow starts from) and the least you want to have. Only what you send changes. Answers with the cash flow with the new balance.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | header |  | Optional (the SDKs send it on their own). If the response is lost, repeat the request with the same value within 24 hours: it answers the same, with idempotent-replayed: true, and doesn't do it twice (it doesn't create, send emails or charge). |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `issuer` | string |  | Issuer (iss_…). If the key has a single issuer or the account has only one, it can be left out. |
| `starting_balance` | object or null |  | Today's balance in your bank accounts; null removes it. |
| `starting_balance.amount` | number | yes | What you have in the bank, in pesos. (from -1000000000000 to 1000000000000) |
| `starting_balance.date` | string |  | The day of that balance (YYYY-MM-DD); today if not given. |
| `minimum_balance` | number |  | The least you want to have: each week below it brings an alert. 0 for none. (from 0 to 1000000000000) |

Example:

```json
{
  "starting_balance": {
    "amount": 185000,
    "date": "2026-11-16"
  },
  "minimum_balance": 50000
}
```

## With the TypeScript SDK

```ts
import { Fiscalisto } from "fiscalisto";

// La llave viene de FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

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

## With the Python SDK

```python
from fiscalisto import Fiscalisto

# La llave viene de FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

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

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

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

## With the .NET SDK

```csharp
using Fiscalisto;

// La llave viene de 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,
}, new RequestOptions { IdempotencyKey = "pedido-A-1042" });
```

## With the Go SDK

```go
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// La llave viene de 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),
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *cashForecast)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.UpdateCashForecastParams;
import com.fiscalisto.model.UpdateCashForecastParamsStartingBalance;

// La llave viene de 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), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(cashForecast);
```

## Response 200

OK.

A `CashForecast` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"cash_forecast"` | yes | Always cash_forecast. |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `issuer` | string | yes | The issuer (iss_…). |
| `today` | string | yes | Today in Mexico City (YYYY-MM-DD): the start. |
| `end` | string | yes | The last day of week 13. |
| `currency` | `"MXN"` | yes | Everything in pesos: anything in another currency, at its exchange rate. |
| `starting_balance` | object or null | yes | Today's balance you gave; null if you haven't given it (the forecast starts from 0). |
| `starting_balance.amount` | number | yes | What you had in the bank, in pesos. |
| `starting_balance.date` | string | yes | That balance's day. |
| `minimum_balance` | number | yes | The least you want to have; each week below it carries a warning. 0 if you didn't give it. |
| `suggested_starting_balance` | object or null | yes | The balance of your latest statements in Conciliación (60 days), only as a suggestion; null without them. |
| `suggested_starting_balance.amount` | number | yes | The sum of the balances, in pesos. |
| `suggested_starting_balance.date` | string | yes | The day of the most recent statement. |
| `scenario` | object | yes | The scenario it was calculated with: the one in the query parameters. |
| `scenario.customers_pay_days_later` | integer | yes | Days collections were shifted (0 as usual). (from -9007199254740991 to 9007199254740991) |
| `scenario.pay_suppliers_days_later` | integer | yes | Days supplier payments were shifted. (from -9007199254740991 to 9007199254740991) |
| `scenario.include_doubtful` | boolean | yes | Whether it counts what is more than 90 days late. |
| `scenario.include_recurring` | boolean | yes | Whether it counts recurring invoices not yet issued. |
| `scenario.recurring_sales_change` | integer | yes | Percent recurring invoices changed (−20 to +10…). (from -9007199254740991 to 9007199254740991) |
| `totals` | object | yes | The 13 weeks together. |
| `totals.inflows` | number | yes | What comes in over the 13 weeks. |
| `totals.outflows` | number | yes | What goes out over the 13 weeks. |
| `totals.ending_balance` | number | yes | The balance at the end of week 13. |
| `totals.lowest_balance` | number | yes | The lowest balance at a week's close. |
| `totals.lowest_week` | integer | yes | The week of that balance (1 to 13). (from -9007199254740991 to 9007199254740991) |
| `totals.weeks_below_minimum` | integer | yes | How many weeks close below minimum_balance (or 0). (from -9007199254740991 to 9007199254740991) |
| `totals.doubtful_left_out` | number | yes | What was left out for being more than 90 days late. |
| `weeks` | array of object | yes | The 13 weeks, in order. |
| `weeks[].week` | integer | yes | 1 to 13; week 1 runs from today to Sunday. (from -9007199254740991 to 9007199254740991) |
| `weeks[].start` | string | yes | The first day (YYYY-MM-DD). |
| `weeks[].end` | string | yes | The last day, a Sunday. |
| `weeks[].starting_balance` | number | yes | The balance at the start of the week. |
| `weeks[].inflows` | number | yes | What comes in. |
| `weeks[].outflows` | number | yes | What goes out. |
| `weeks[].ending_balance` | number | yes | The balance at the week's close. |
| `weeks[].by_type` | object | yes | The amount for each line type (lines[].type) that week, in pesos. |
| `lines` | array of object | yes | Each thing that comes in or goes out, from which the weeks are added up. |
| `lines[].line` | string | yes | The line, to change it with POST /v1/cash_forecast/adjustments. |
| `lines[].type` | `receivable`, `recurring_invoice`, `planned_inflow`, `payable`, `payroll`, `taxes`, `planned_outflow` | yes | receivable: what your customers owe you; recurring_invoice: what your recurring invoices will bill; planned_inflow / planned_outflow: a planned movement you added; payable: what you owe suppliers; payroll: payroll; taxes: monthly tax returns. |
| `lines[].direction` | `inflow`, `outflow` | yes | inflow comes in; outflow goes out. |
| `lines[].date` | string | yes | The day it is counted on, with changes and scenario. |
| `lines[].estimated_date` | string | yes | The day that was estimated. |
| `lines[].week` | integer or null | yes | The week it falls in; null if it was left out (left_out). |
| `lines[].amount` | number | yes | What is counted, in pesos. |
| `lines[].estimated_amount` | number | yes | What was estimated, in pesos. |
| `lines[].description` | string | yes | What it is, as in the app. |
| `lines[].tax_id` | string or null | yes | The RFC of the customer or supplier, or null. |
| `lines[].invoices` | integer or null | yes | How many invoices it adds up, or null. |
| `lines[].due_date` | string or null | yes | When it was due, or null. |
| `lines[].days_overdue` | integer or null | yes | Days late if the expected day has passed, or null. |
| `lines[].basis` | string | yes | How it was estimated, in words. |
| `lines[].confidence` | `high`, `medium`, `low` | yes | high: a known amount and day; medium: an average; low: late or without history. |
| `lines[].left_out` | `excluded`, `doubtful`, `scenario`, `after_horizon` or null | yes | Why it doesn't count: excluded you removed it; doubtful more than 90 days late; scenario the scenario removed it; after_horizon falls after week 13. null if it counts. |
| `lines[].adjusted` | boolean | yes | true if you changed its day or amount, or removed it. |
| `lines[].planned_item` | string or null | yes | The planned movement (cfi_…) it comes from, or null. |
| `warnings` | array of object | yes | Warnings with what you can do; you decide. |
| `warnings[].type` | `no_starting_balance`, `stale_starting_balance`, `shortfall`, `overdue_receivables`, `customer_concentration`, `doubtful_left_out` | yes | no_starting_balance: today's balance is missing; stale_starting_balance: it is more than 7 days old; shortfall: a week closes below the minimum; overdue_receivables: a lot of what is to be collected is late; customer_concentration: one customer is 40 % or more of what comes in; doubtful_left_out: what is more than 90 days late was left out. |
| `warnings[].severity` | `critical`, `warning`, `info` | yes | How urgent it is. |
| `warnings[].title` | string | yes | The warning, in words. |
| `warnings[].detail` | string | yes | What you can do; nothing changes on its own. |
| `warnings[].week` | integer or null | yes | The week, or null. |
| `warnings[].shortfall` | number or null | yes | What would be short, in pesos, or null. |
| `planned_items` | array of object | yes | Your planned movements. |
| `planned_items[].id` | string | yes | The planned movement (cfi_…). |
| `planned_items[].object` | `"cash_forecast_item"` | yes | Always cash_forecast_item. |
| `planned_items[].livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `planned_items[].issuer` | string | yes | The issuer (iss_…). |
| `planned_items[].description` | string | yes | What it is: «Renta», «Crédito del banco». |
| `planned_items[].direction` | `inflow`, `outflow` | yes | inflow money comes in; outflow goes out. |
| `planned_items[].amount` | number | yes | How much, in pesos. |
| `planned_items[].date` | string | yes | The day (YYYY-MM-DD), or the first time if it repeats. |
| `planned_items[].frequency` | `once`, `weekly`, `biweekly`, `monthly` | yes | once one time; weekly every week; biweekly every two; monthly every month. |
| `planned_items[].until` | string or null | yes | The last day it repeats; null with no end. |
| `notes` | array of string | yes | What couldn't be estimated and why. |

```json
{
  "object": "cash_forecast",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "today": "2026-11-16",
  "end": "2027-02-14",
  "currency": "MXN",
  "starting_balance": {
    "amount": 185000,
    "date": "2026-11-16"
  },
  "minimum_balance": 50000,
  "suggested_starting_balance": {
    "amount": 183420.5,
    "date": "2026-11-14"
  },
  "scenario": {
    "customers_pay_days_later": 0,
    "pay_suppliers_days_later": 0,
    "include_doubtful": false,
    "include_recurring": true,
    "recurring_sales_change": 0
  },
  "totals": {
    "inflows": 612400,
    "outflows": 655900,
    "ending_balance": 141500,
    "lowest_balance": 38200,
    "lowest_week": 3,
    "weeks_below_minimum": 1,
    "doubtful_left_out": 12760
  },
  "weeks": [
    {
      "week": 1,
      "start": "2026-11-16",
      "end": "2026-11-22",
      "starting_balance": 185000,
      "inflows": 34800,
      "outflows": 0,
      "ending_balance": 219800,
      "by_type": {
        "receivable": 34800
      }
    },
    {
      "week": 2,
      "start": "2026-11-23",
      "end": "2026-11-29",
      "starting_balance": 219800,
      "inflows": 0,
      "outflows": 121400,
      "ending_balance": 98400,
      "by_type": {
        "payable": 46400,
        "payroll": 75000
      }
    }
  ],
  "lines": [
    {
      "line": "cobro:ICV060329BY0:2026-10-15:ppd",
      "type": "receivable",
      "direction": "inflow",
      "date": "2026-11-20",
      "estimated_date": "2026-11-20",
      "week": 1,
      "amount": 34800,
      "estimated_amount": 34800,
      "description": "INMOBILIARIA CVA",
      "tax_id": "ICV060329BY0",
      "invoices": 2,
      "due_date": "2026-11-14",
      "days_overdue": null,
      "basis": "Suele pagar en 36 días; la factura es del 15 de octubre.",
      "confidence": "medium",
      "left_out": null,
      "adjusted": false,
      "planned_item": null
    }
  ],
  "warnings": [
    {
      "type": "shortfall",
      "severity": "warning",
      "title": "La semana 3 cerraría con $38,200, debajo de su mínimo de $50,000",
      "detail": "Le faltarían $11,800. Puede cobrar antes lo atrasado o mover un pago a proveedor.",
      "week": 3,
      "shortfall": 11800
    }
  ],
  "planned_items": [
    {
      "id": "cfi_OufpKqnrvx9p7Hq2",
      "object": "cash_forecast_item",
      "livemode": false,
      "issuer": "iss_OufpKqnrvx9p",
      "description": "Renta de la bodega",
      "direction": "outflow",
      "amount": 28000,
      "date": "2026-12-01",
      "frequency": "monthly",
      "until": null
    }
  ],
  "notes": []
}
```

## Errors

- `feature_not_in_plan` (403): Live, this part of the API (inventario, portal de proveedores, pedidos, comprobación de gastos) follows the empresa's plan, as in the app: it comes with Operaciones (added to any paid plan; included in Corporativo). The books (the /v1/accounting routes except DIOT, cross checks, IVA refunds and fixed assets) come with Contabilidad (added to Independiente, Emprendedor or Negocio; included in Despacho and Corporativo): without it, changing the books answers this error, and reading them works only up to the last month it had it. Add either in Ajustes › Plan y pagos; test mode has everything.
- `issuer_archived` (400): The issuer is archived and no longer stamps. Its documents can still be read and canceled.
- `issuer_linked_empresa` (403): That issuer is an empresa of the app connected to your account: through the API it only offers its Portal de proveedores (/v1/portal_suppliers and /v1/supplier_invoices) and, once someone who may pay suppliers and change Configurar pagos turned them on, its supplier payouts (/v1/payouts and /v1/payroll_payouts). It also stops when whoever connected it (or turned its payouts on) no longer has that permission in the empresa: message_es says which. Do everything else in the app.
- `issuer_missing` (404): There is no such issuer in the account (or it belongs to the other mode).
- `issuer_not_allowed` (403): This key can't use that issuer.
- `issuer_required` (400): The account has several issuers and the request doesn't say which: send `issuer` (iss_…).
- `livemode_mismatch` (400): The object belongs to the other mode: an fk_test_ key only sees test data and an fk_live_ key only live data.

Plus those of any call (key, fields, limits): https://fiscalisto.com/en/docs/api/errores.md.
