# Calculate the tax discrepancy

`GET https://api.fiscalisto.com/v1/tax_discrepancy`

Like «Discrepancia fiscal» (personas físicas, art. 91 LISR): expenses with CFDIs in their name and deposits into their accounts for the year, minus transfers between their accounts, loans and refunds, against the declared income; what's left is what SAT would presume is income. An issuer that's a persona moral answers parameter_invalid. It doesn't use stamps.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `issuer` | query |  | The issuer (iss_…). It can be left out if the key or the account has only one. |
| `year` | query |  | The fiscal year (by default, last year). |
| `declared_income` | query |  | The income from your annual return, if you have income Fiscalisto doesn't see (rents, interest, another employer): it replaces the income it calculates. |

## With the TypeScript SDK

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

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

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

## With the Python SDK

```python
from fiscalisto import Fiscalisto

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

tax_discrepancy = fiscalisto.tax_discrepancy.get()
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

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

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

## With the .NET SDK

```csharp
using Fiscalisto;

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

var taxDiscrepancy = await fiscalisto.TaxDiscrepancy.GetAsync();
```

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

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

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;

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

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

## Response 200

OK.

A `TaxDiscrepancy` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"tax_discrepancy"` | yes | Always tax_discrepancy. |
| `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_…), a persona física. |
| `tax_id` | string | yes | Their RFC (13 characters). |
| `year` | integer | yes | The fiscal year. (from -9007199254740991 to 9007199254740991) |
| `spending` | number | yes | Expenses with CFDIs in their name (received, without canceled ones, minus credit notes). |
| `deposits` | number | yes | Deposits into their accounts (from the bank statements in Conciliación). |
| `own_transfers` | number | yes | Transfers between their accounts, which the law leaves out (art. 91 LISR). |
| `loans` | number | yes | Loans they classified. |
| `refunds` | number | yes | Refunds they classified. |
| `outflows` | number | yes | Outlays: expenses plus deposits, minus transfers. |
| `declared_income` | number | yes | The declared income that is subtracted. |
| `declared_income_source` | `tax_returns`, `payroll`, `declared_income`, `none` | yes | Where it comes from: tax_returns (their tax returns), payroll (their payroll receipts), declared_income (the one you sent) or none. |
| `discrepancy` | number | yes | Outlays minus loans, refunds and declared income, if positive: what the SAT would presume is income. |
| `unclassified_deposits` | number | yes | Unclassified deposits in Conciliación («Por aclarar»): each one explained lowers the discrepancy. |
| `loans_to_report` | boolean | yes | Whether their loans exceed $600,000 in the year: they only count if reported on their annual return (art. 90 LISR). |
| `bank_statements` | boolean | yes | Whether there are bank statements for the year; without them only expenses with CFDIs count. |
| `months` | array of object | yes | The calculation month by month. |
| `months[].month` | string | yes | The month (YYYY-MM). |
| `months[].spending` | number | yes | Their expenses with CFDIs in their name. |
| `months[].deposits` | number | yes | The deposits into their accounts. |
| `months[].own_transfers` | number | yes | The transfers between their accounts. |
| `months[].loans` | number | yes | The loans they classified. |
| `months[].declared_income` | number | yes | The month's declared income. |

```json
{
  "object": "tax_discrepancy",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "tax_id": "MASO451221PM4",
  "year": 2025,
  "spending": 210000,
  "deposits": 390000,
  "own_transfers": 120000,
  "loans": 0,
  "refunds": 0,
  "outflows": 480000,
  "declared_income": 480000,
  "declared_income_source": "tax_returns",
  "discrepancy": 0,
  "unclassified_deposits": 60000,
  "loans_to_report": false,
  "bank_statements": true,
  "months": [
    {
      "month": "2025-01",
      "spending": 17500,
      "deposits": 32500,
      "own_transfers": 10000,
      "loans": 0,
      "declared_income": 40000
    }
  ]
}
```

## 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.
