# Comparar los estados financieros con otro mes

`GET https://api.fiscalisto.com/v1/accounting/comparative_statements`

El estado de resultados (del mes y de enero al mes) y el balance general junto a los del mismo mes del año anterior (compare_to=previous_year, por omisión) o del mes anterior (previous_month), con la variación y su porcentaje por grupo de cuentas. Como Estados financieros › Comparativo en la app.

## Parámetros

| Nombre | Dónde | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `month` | consulta | sí | El mes (AAAA-MM). |
| `compare_to` | consulta |  | previous_year (el mismo mes del año anterior, por omisión) o previous_month. |
| `issuer` | consulta |  | El emisor (iss_…). Puede omitirse si la llave o la cuenta tienen uno solo. |

## Con el SDK de TypeScript

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

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

const comparativeStatements = await fiscalisto.accounting.comparativeStatements({ month: "2026-10" });
```

## Con el SDK de Python

```python
from fiscalisto import Fiscalisto

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

comparative_statements = fiscalisto.accounting.comparative_statements({"month": "2026-10"})
```

## Con el SDK de PHP

```php
<?php

use Fiscalisto\Fiscalisto;

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

$comparativeStatements = $fiscalisto->accounting->comparativeStatements(['month' => '2026-10']);
```

## Con el SDK de .NET

```csharp
using Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var comparativeStatements = await fiscalisto.Accounting.ComparativeStatementsAsync(new GetComparativeStatementsParams { Month = "2026-10" });
```

## Con el SDK de Go

```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()

	comparativeStatements, err := client.Accounting.ComparativeStatements(ctx, &fiscalisto.GetComparativeStatementsParams{Month: "2026-10"})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *comparativeStatements)
}
```

## Con el SDK de Java

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.GetComparativeStatementsParams;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var comparativeStatements = fiscalisto.accounting().comparativeStatements(new GetComparativeStatementsParams().setMonth("2026-10"));
System.out.println(comparativeStatements);
```

## Respuesta 200

Correcto.

Un objeto `ComparativeStatements`:

| Campo | Tipo | Siempre viene | Descripción |
| --- | --- | --- | --- |
| `object` | `"comparative_statements"` | sí | Qué tipo de objeto es («invoice», «customer»…). |
| `livemode` | boolean | sí | true en producción (llaves fk_live_), false en pruebas (fk_test_). Lo de pruebas no vale ante el SAT. |
| `issuer` | string | sí | El emisor. |
| `month` | string | sí | El mes (AAAA-MM). |
| `compared_to` | string | sí | El mes con que se compara (AAAA-MM). |
| `income_statement` | objeto | sí | El estado de resultados comparativo. |
| `income_statement.month` | objeto | sí | Del mes contra el mes comparado. |
| `income_statement.month.sections` | arreglo de objeto | sí | Cada sección del estado de resultados. Costos y gastos en positivo: un aumento es más gasto. |
| `income_statement.month.sections[].key` | `ingresos`, `costos`, `gastos`, `financiamiento`, `otros` | sí | La sección. |
| `income_statement.month.sections[].name` | string | sí | Su nombre. |
| `income_statement.month.sections[].lines` | arreglo de objeto | sí | Cada grupo de cuentas. |
| `income_statement.month.sections[].lines[].grouping_code` | string | sí | El código agrupador (primer nivel). |
| `income_statement.month.sections[].lines[].name` | string | sí | Su nombre. |
| `income_statement.month.sections[].lines[].current` | number | sí | El importe del periodo. |
| `income_statement.month.sections[].lines[].previous` | number | sí | El del periodo con que se compara. |
| `income_statement.month.sections[].lines[].change` | number | sí | current − previous. |
| `income_statement.month.sections[].lines[].change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |
| `income_statement.month.sections[].total` | objeto | sí | El total de la sección. |
| `income_statement.month.sections[].total.current` | number | sí | El importe del periodo. |
| `income_statement.month.sections[].total.previous` | number | sí | El del periodo con que se compara. |
| `income_statement.month.sections[].total.change` | number | sí | current − previous. |
| `income_statement.month.sections[].total.change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |
| `income_statement.month.income_before_taxes` | objeto | sí | La utilidad antes de impuestos. |
| `income_statement.month.income_before_taxes.current` | number | sí | El importe del periodo. |
| `income_statement.month.income_before_taxes.previous` | number | sí | El del periodo con que se compara. |
| `income_statement.month.income_before_taxes.change` | number | sí | current − previous. |
| `income_statement.month.income_before_taxes.change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |
| `income_statement.year_to_date` | objeto | sí | De enero al mes contra enero al mes comparado. |
| `income_statement.year_to_date.sections` | arreglo de objeto | sí | Cada sección del estado de resultados. Costos y gastos en positivo: un aumento es más gasto. |
| `income_statement.year_to_date.sections[].key` | `ingresos`, `costos`, `gastos`, `financiamiento`, `otros` | sí | La sección. |
| `income_statement.year_to_date.sections[].name` | string | sí | Su nombre. |
| `income_statement.year_to_date.sections[].lines` | arreglo de objeto | sí | Cada grupo de cuentas. |
| `income_statement.year_to_date.sections[].lines[].grouping_code` | string | sí | El código agrupador (primer nivel). |
| `income_statement.year_to_date.sections[].lines[].name` | string | sí | Su nombre. |
| `income_statement.year_to_date.sections[].lines[].current` | number | sí | El importe del periodo. |
| `income_statement.year_to_date.sections[].lines[].previous` | number | sí | El del periodo con que se compara. |
| `income_statement.year_to_date.sections[].lines[].change` | number | sí | current − previous. |
| `income_statement.year_to_date.sections[].lines[].change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |
| `income_statement.year_to_date.sections[].total` | objeto | sí | El total de la sección. |
| `income_statement.year_to_date.sections[].total.current` | number | sí | El importe del periodo. |
| `income_statement.year_to_date.sections[].total.previous` | number | sí | El del periodo con que se compara. |
| `income_statement.year_to_date.sections[].total.change` | number | sí | current − previous. |
| `income_statement.year_to_date.sections[].total.change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |
| `income_statement.year_to_date.income_before_taxes` | objeto | sí | La utilidad antes de impuestos. |
| `income_statement.year_to_date.income_before_taxes.current` | number | sí | El importe del periodo. |
| `income_statement.year_to_date.income_before_taxes.previous` | number | sí | El del periodo con que se compara. |
| `income_statement.year_to_date.income_before_taxes.change` | number | sí | current − previous. |
| `income_statement.year_to_date.income_before_taxes.change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |
| `balance_sheet` | arreglo de objeto | sí | El balance general al cierre de cada mes. |
| `balance_sheet[].key` | `assets`, `liabilities`, `equity` | sí | La sección. |
| `balance_sheet[].name` | string | sí | Su nombre. |
| `balance_sheet[].lines` | arreglo de objeto | sí | Cada grupo de cuentas. |
| `balance_sheet[].lines[].grouping_code` | string | sí | El código agrupador (primer nivel). |
| `balance_sheet[].lines[].name` | string | sí | Su nombre. |
| `balance_sheet[].lines[].current` | number | sí | El importe del periodo. |
| `balance_sheet[].lines[].previous` | number | sí | El del periodo con que se compara. |
| `balance_sheet[].lines[].change` | number | sí | current − previous. |
| `balance_sheet[].lines[].change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |
| `balance_sheet[].total` | objeto | sí | El total de la sección. |
| `balance_sheet[].total.current` | number | sí | El importe del periodo. |
| `balance_sheet[].total.previous` | number | sí | El del periodo con que se compara. |
| `balance_sheet[].total.change` | number | sí | current − previous. |
| `balance_sheet[].total.change_percent` | number o null | sí | change entre previous, en porcentaje (null cuando previous es 0). |

```json
{
  "object": "comparative_statements",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "month": "2026-02",
  "compared_to": "2026-01",
  "income_statement": {
    "month": {
      "sections": [
        {
          "key": "ingresos",
          "name": "Ingresos",
          "lines": [
            {
              "grouping_code": "401",
              "name": "Ingresos",
              "current": 15000,
              "previous": 0,
              "change": 15000,
              "change_percent": null
            }
          ],
          "total": {
            "current": 15000,
            "previous": 0,
            "change": 15000,
            "change_percent": null
          }
        },
        {
          "key": "costos",
          "name": "Costo de ventas",
          "lines": [],
          "total": {
            "current": 0,
            "previous": 0,
            "change": 0,
            "change_percent": null
          }
        },
        {
          "key": "gastos",
          "name": "Gastos de operación",
          "lines": [
            {
              "grouping_code": "601",
              "name": "Gastos generales",
              "current": 2000,
              "previous": 0,
              "change": 2000,
              "change_percent": null
            },
            {
              "grouping_code": "613",
              "name": "Depreciación contable",
              "current": 1000,
              "previous": 0,
              "change": 1000,
              "change_percent": null
            }
          ],
          "total": {
            "current": 3000,
            "previous": 0,
            "change": 3000,
            "change_percent": null
          }
        },
        {
          "key": "financiamiento",
          "name": "Resultado integral de financiamiento",
          "lines": [],
          "total": {
            "current": 0,
            "previous": 0,
            "change": 0,
            "change_percent": null
          }
        },
        {
          "key": "otros",
          "name": "Otros ingresos y gastos",
          "lines": [],
          "total": {
            "current": 0,
            "previous": 0,
            "change": 0,
            "change_percent": null
          }
        }
      ],
      "income_before_taxes": {
        "current": 12000,
        "previous": 0,
        "change": 12000,
        "change_percent": null
      }
    },
    "year_to_date": {
      "sections": [
        {
          "key": "ingresos",
          "name": "Ingresos",
          "lines": [
            {
              "grouping_code": "401",
              "name": "Ingresos",
              "current": 15000,
              "previous": 0,
              "change": 15000,
              "change_percent": null
            }
          ],
          "total": {
            "current": 15000,
            "previous": 0,
            "change": 15000,
            "change_percent": null
          }
        },
        {
          "key": "costos",
          "name": "Costo de ventas",
          "lines": [],
          "total": {
            "current": 0,
            "previous": 0,
            "change": 0,
            "change_percent": null
          }
        },
        {
          "key": "gastos",
          "name": "Gastos de operación",
          "lines": [
            {
              "grouping_code": "601",
              "name": "Gastos generales",
              "current": 2000,
              "previous": 0,
              "change": 2000,
              "change_percent": null
            },
            {
              "grouping_code": "613",
              "name": "Depreciación contable",
              "current": 1000,
              "previous": 0,
              "change": 1000,
              "change_percent": null
            }
          ],
          "total": {
            "current": 3000,
            "previous": 0,
            "change": 3000,
            "change_percent": null
          }
        },
        {
          "key": "financiamiento",
          "name": "Resultado integral de financiamiento",
          "lines": [],
          "total": {
            "current": 0,
            "previous": 0,
            "change": 0,
            "change_percent": null
          }
        },
        {
          "key": "otros",
          "name": "Otros ingresos y gastos",
          "lines": [],
          "total": {
            "current": 0,
            "previous": 0,
            "change": 0,
            "change_percent": null
          }
        }
      ],
      "income_before_taxes": {
        "current": 12000,
        "previous": 0,
        "change": 12000,
        "change_percent": null
      }
    }
  },
  "balance_sheet": [
    {
      "key": "assets",
      "name": "Activo",
      "lines": [
        {
          "grouping_code": "102",
          "name": "Bancos",
          "current": 81600,
          "previous": 100000,
          "change": -18400,
          "change_percent": -18.4
        },
        {
          "grouping_code": "105",
          "name": "Clientes",
          "current": 5800,
          "previous": 0,
          "change": 5800,
          "change_percent": null
        },
        {
          "grouping_code": "151",
          "name": "Terrenos",
          "current": 50000,
          "previous": 0,
          "change": 50000,
          "change_percent": null
        },
        {
          "grouping_code": "155",
          "name": "Mobiliario y equipo de oficina",
          "current": 20000,
          "previous": 0,
          "change": 20000,
          "change_percent": null
        },
        {
          "grouping_code": "171",
          "name": "Depreciación acumulada de activos fijos",
          "current": -1000,
          "previous": 0,
          "change": -1000,
          "change_percent": null
        }
      ],
      "total": {
        "current": 156400,
        "previous": 100000,
        "change": 56400,
        "change_percent": 56.4
      }
    },
    {
      "key": "liabilities",
      "name": "Pasivo",
      "lines": [
        {
          "grouping_code": "202",
          "name": "Cuentas por pagar a corto plazo",
          "current": 30000,
          "previous": 0,
          "change": 30000,
          "change_percent": null
        },
        {
          "grouping_code": "205",
          "name": "Acreedores diversos a corto plazo",
          "current": 2000,
          "previous": 0,
          "change": 2000,
          "change_percent": null
        },
        {
          "grouping_code": "208",
          "name": "Impuestos trasladados cobrados",
          "current": 1600,
          "previous": 0,
          "change": 1600,
          "change_percent": null
        },
        {
          "grouping_code": "209",
          "name": "Impuestos trasladados no cobrados",
          "current": 800,
          "previous": 0,
          "change": 800,
          "change_percent": null
        }
      ],
      "total": {
        "current": 34400,
        "previous": 0,
        "change": 34400,
        "change_percent": null
      }
    },
    {
      "key": "equity",
      "name": "Capital contable",
      "lines": [
        {
          "grouping_code": "301",
          "name": "Capital social",
          "current": 110000,
          "previous": 100000,
          "change": 10000,
          "change_percent": 10
        },
        {
          "grouping_code": "305",
          "name": "Resultado del ejercicio",
          "current": 12000,
          "previous": 0,
          "change": 12000,
          "change_percent": null
        }
      ],
      "total": {
        "current": 122000,
        "previous": 100000,
        "change": 22000,
        "change_percent": 22
      }
    }
  ]
}
```

## Errores

- `feature_not_in_plan` (403): En producción, inventario avanzado, portal de proveedores, pedidos de venta y comprobación de gastos siguen el plan de la empresa, como en la app: vienen con Operaciones (se agrega a cualquier plan de pago; incluida en Corporativo). La contabilidad (/v1/accounting/…, salvo DIOT, cross_checks, vat_refund y fixed_assets) viene con Contabilidad (se agrega a Independiente, Emprendedor o Negocio; incluida en Despacho y Corporativo): sin ella, cambiar los libros responde este error, y leerlos solo funciona hasta el último mes en que la tuvo. En modo de pruebas están todos.
- `issuer_archived` (400): El emisor está archivado: ya no timbra. Sus comprobantes se pueden consultar y cancelar.
- `issuer_linked_empresa` (403): El emisor es una empresa de la app conectada a la cuenta (source empresa): con la API solo se usan su Portal de proveedores y, si alguien que puede los encendió, sus pagos a proveedores; o quien la conectó (o encendió sus pagos) ya no tiene en esa empresa el permiso que la ruta pide.
- `issuer_missing` (404): No existe ese emisor en la cuenta (o es del otro modo).
- `issuer_not_allowed` (403): La llave no puede usar ese emisor.
- `issuer_required` (400): La cuenta tiene varios emisores y la solicitud no dice cuál: mande `issuer` (iss_…).
- `livemode_mismatch` (400): El objeto es del otro modo: una llave fk_test_ solo ve lo de pruebas y una fk_live_ lo de producción.

Y los de cualquier llamada (llave, campos, límites): https://fiscalisto.com/docs/api/errores.md.
