# Vacation balance before Fiscalisto

`POST https://api.fiscalisto.com/v1/employees/{id}/vacations`

Saves what the employee had on a day according to your records: the days they had left from completed years and those already taken from the current year. Receipts stamped before that day aren't counted. opening_date null removes it.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | The object's id. |
| `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 |
| --- | --- | --- | --- |
| `opening_date` | string or null | yes | The day of the balance, according to your records from before Fiscalisto; null removes it. Receipts stamped before that day aren't counted. |
| `opening_pending_days` | number |  | The days they had left that day from completed years of service. (from 0 to 400) |
| `opening_taken_days` | number |  | The days of the current year of service they had already taken that day. (from 0 to 60) |

Example:

```json
{
  "opening_date": "2025-01-15",
  "opening_pending_days": 0,
  "opening_taken_days": 0
}
```

## With the TypeScript SDK

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

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

const employeeVacations = await fiscalisto.employees.updateVacations("id", {
  opening_date: "2025-01-15",
  opening_pending_days: 0,
  opening_taken_days: 0,
}, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

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

employee_vacations = fiscalisto.employees.update_vacations("id", {
    "opening_date": "2025-01-15",
    "opening_pending_days": 0,
    "opening_taken_days": 0,
}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

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

$employeeVacations = $fiscalisto->employees->updateVacations('id', [
    'opening_date' => '2025-01-15',
    'opening_pending_days' => 0,
    'opening_taken_days' => 0,
], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

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

var employeeVacations = await fiscalisto.Employees.UpdateVacationsAsync("id", new UpdateEmployeeVacationsParams
{
    OpeningDate = "2025-01-15",
    OpeningPendingDays = 0,
    OpeningTakenDays = 0,
}, 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()

	employeeVacations, err := client.Employees.UpdateVacations(ctx, "id", &fiscalisto.UpdateEmployeeVacationsParams{
		OpeningDate:        fiscalisto.String("2025-01-15"),
		OpeningPendingDays: fiscalisto.Float64(0),
		OpeningTakenDays:   fiscalisto.Float64(0),
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *employeeVacations)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.UpdateEmployeeVacationsParams;

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

var employeeVacations = fiscalisto.employees().updateVacations("id", new UpdateEmployeeVacationsParams()
        .setOpeningDate("2025-01-15")
        .setOpeningPendingDays(0)
        .setOpeningTakenDays(0), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(employeeVacations);
```

## Response 200

OK.

A `EmployeeVacations` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"employee_vacations"` | 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. |
| `employee` | string | yes | The employee (emp_…). |
| `as_of` | string | yes | The balance date. |
| `pending_days` | number | yes | The days from completed years of service they have left that haven't lapsed: the ones the final settlement pays. |
| `current_year` | object | yes | The current year of service. |
| `current_year.year` | integer | yes | Its number: 1 for the first year of service. (from -9007199254740991 to 9007199254740991) |
| `current_year.completes_on` | string | yes | Their anniversary. |
| `current_year.days` | number | yes | The days they are entitled to when they complete it. |
| `current_year.taken_in_advance` | number | yes | The ones they already took in advance. |
| `current_year.accrued_days` | number | yes | Their proportional part as of the balance date, minus what was taken in advance. |
| `years` | array of object | yes | Each completed year of service, from oldest to newest. |
| `years[].year` | integer | yes | The year of service; 0 is the balance from before Fiscalisto. (from -9007199254740991 to 9007199254740991) |
| `years[].owed_from` | string | yes | The anniversary that completes it. |
| `years[].days` | number | yes | The days they are entitled to (article 76). |
| `years[].taken_days` | number | yes | The ones already taken. |
| `years[].remaining_days` | number | yes | The ones left. |
| `years[].grant_by` | string | yes | The last day to give them (article 81). |
| `years[].prescribes_on` | string | yes | The day they lapse (article 516). |
| `years[].status` | `taken`, `pending`, `late`, `prescribed` | yes | taken, enjoyed; pending, still to enjoy; late, the deadline to give them passed and they haven't lapsed; prescribed, lapsed. |
| `opening` | object or null | yes | The balance from before Fiscalisto, or null. |
| `opening.date` | string | yes | The opening balance date. |
| `opening.pending_days` | number | yes | Those from completed years. |
| `opening.taken_days` | number | yes | Those taken in the current year. |
| `taken` | array of object | yes | The vacation days on their stamped receipts. |
| `taken[].date` | string | yes | The end of the receipt's period. |
| `taken[].days` | number | yes | The vacation days it paid. |

```json
{
  "object": "employee_vacations",
  "livemode": false,
  "employee": "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
  "as_of": "2026-11-20",
  "pending_days": 9,
  "current_year": {
    "year": 4,
    "completes_on": "2027-01-10",
    "days": 18,
    "taken_in_advance": 0,
    "accrued_days": 15.53
  },
  "years": [
    {
      "year": 1,
      "owed_from": "2024-01-10",
      "days": 12,
      "taken_days": 12,
      "remaining_days": 0,
      "grant_by": "2024-07-09",
      "prescribes_on": "2025-07-10",
      "status": "taken"
    },
    {
      "year": 2,
      "owed_from": "2025-01-10",
      "days": 14,
      "taken_days": 14,
      "remaining_days": 0,
      "grant_by": "2025-07-09",
      "prescribes_on": "2026-07-10",
      "status": "taken"
    },
    {
      "year": 3,
      "owed_from": "2026-01-10",
      "days": 16,
      "taken_days": 7,
      "remaining_days": 9,
      "grant_by": "2026-07-09",
      "prescribes_on": "2027-07-10",
      "status": "late"
    }
  ],
  "opening": null,
  "taken": [
    {
      "date": "2024-04-15",
      "days": 12
    },
    {
      "date": "2025-04-15",
      "days": 14
    },
    {
      "date": "2026-03-31",
      "days": 7
    }
  ]
}
```

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