# Apply the annual adjustment

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

action apply: each employee's difference goes on their next ordinary receipts paid from January 1 of the following year: owed as Deducción 101 (up to their net; the rest, on the next one), in their favor as OtroPago 004 with CompensacionSaldosAFavor. Repeating it does nothing. undo removes it while no stamped receipt carries it. files_own_return and no_own_return mark whether the employee will file their own annual return.

## 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 |  | The issuer (iss_…); by default, the account's only one. |
| `year` | integer | yes | The fiscal year: 2026. (from 2023 to 2100) |
| `action` | `apply`, `undo`, `files_own_return`, `no_own_return` | yes | apply: applies the difference on their next receipts (from January of the following year). undo: removes it if no stamped receipt carries it. files_own_return: they gave written notice they'll file their annual return (article 97, c): it isn't calculated for them. no_own_return: undoes it. |
| `employees` | array of string | yes | The employees (emp_…). (up to 5000) |

Example:

```json
{
  "year": 2026,
  "action": "apply",
  "employees": [
    "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV"
  ]
}
```

## With the TypeScript SDK

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

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

const annualAdjustment = await fiscalisto.annualAdjustments.update({
  year: 2026,
  action: "apply",
  employees: ["emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV"],
}, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

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

annual_adjustment = fiscalisto.annual_adjustments.update({
    "year": 2026,
    "action": "apply",
    "employees": ["emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV"],
}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

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

$annualAdjustment = $fiscalisto->annualAdjustments->update([
    'year' => 2026,
    'action' => 'apply',
    'employees' => ['emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV'],
], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

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

var annualAdjustment = await fiscalisto.AnnualAdjustments.UpdateAsync(new UpdateAnnualAdjustmentParams
{
    Year = 2026,
    Action = "apply",
    Employees = new() { "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV" },
}, 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()

	annualAdjustment, err := client.AnnualAdjustments.Update(ctx, &fiscalisto.UpdateAnnualAdjustmentParams{
		Year:      2026,
		Action:    "apply",
		Employees: []string{"emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV"},
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *annualAdjustment)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.UpdateAnnualAdjustmentParams;
import java.util.List;

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

var annualAdjustment = fiscalisto.annualAdjustments().update(new UpdateAnnualAdjustmentParams()
        .setYear(2026)
        .setAction("apply")
        .setEmployees(List.of("emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV")), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(annualAdjustment);
```

## Response 200

OK.

A `AnnualAdjustment` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"annual_adjustment"` | yes | What kind of object it is («invoice», «customer»…). |
| `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_…). |
| `year` | integer | yes | The fiscal year. (from -9007199254740991 to 9007199254740991) |
| `applies_from` | string | yes | From when receipts carry it: January 1 of the next year. |
| `last_payment_date` | string or null | yes | The pay date of the year's last stamped receipt. |
| `employees` | array of object | yes | Each employee who worked in the year. |
| `employees[].employee` | string | yes | The employee (emp_…). |
| `employees[].employee_number` | string | yes | Their employee number. |
| `employees[].employee_name` | string | yes | Its name. |
| `employees[].income` | number | yes | Everything their receipts for the year paid them, taxable and exempt: if it exceeds $400,000 they file their own tax return. |
| `employees[].taxable_income` | number | yes | The year's taxable amount. |
| `employees[].annual_tax` | number | yes | The year's ISR: the article 152 table on taxable_income. |
| `employees[].employment_subsidy` | number | yes | The employment subsidy they were entitled to in the year. |
| `employees[].tax_due` | number | yes | annual_tax minus employment_subsidy, never negative. |
| `employees[].tax_withheld` | number | yes | The ISR their receipts for the year withheld. |
| `employees[].balance` | number | yes | tax_due minus tax_withheld: positive owed, negative in their favor. |
| `employees[].excluded` | `started`, `left`, `income`, `files_own`, `minimum` or null | yes | Why it isn't calculated for them (article 97): started, joined after January 1; left, left before December 1; income, earned more than $400,000; files_own, files their own return; minimum, earns the minimum wage and their balance owed isn't deducted (Constitution art. 123-A-VIII, LFT 97). |
| `employees[].files_own_return` | boolean | yes | Whether they gave written notice that they will file their annual return. |
| `employees[].missing_months` | array of integer | yes | Months without a stamped receipt: one from another system is missing. |
| `employees[].applied_amount` | number or null | yes | The difference applied (positive owed, negative in their favor), or null. |
| `employees[].remaining` | number or null | yes | The part of applied_amount no stamped receipt carries yet. |

```json
{
  "object": "annual_adjustment",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "year": 2026,
  "applies_from": "2027-01-01",
  "last_payment_date": "2026-12-31",
  "employees": [
    {
      "employee": "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
      "employee_number": "9",
      "employee_name": "MARIA OLIVIA MARTINEZ SAGAZ",
      "income": 158640,
      "taxable_income": 151120.7,
      "annual_tax": 12134,
      "employment_subsidy": 0,
      "tax_due": 12134,
      "tax_withheld": 11502.36,
      "balance": 631.64,
      "excluded": null,
      "files_own_return": false,
      "missing_months": [],
      "applied_amount": 631.64,
      "remaining": 631.64
    }
  ]
}
```

## 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.
- `resource_missing` (404): There's no object with that id (or it belongs to another issuer or the other mode).

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