# Calendario laboral España: festivos y días hábiles (`angel.carreira/calendario-laboral-espana`) Actor

Festivos nacionales y autonómicos de España según el BOE y cálculo de días hábiles: comprobar fechas, sumar y contar días hábiles por comunidad autónoma.

- **URL**: https://apify.com/angel.carreira/calendario-laboral-espana.md
- **Developed by:** [Ángel Carreira](https://apify.com/angel.carreira) (community)
- **Categories:** Business, Automation
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Spain business days and public holidays calendar (BOE)

Query Spanish national and regional public holidays published in the BOE, check whether a date is a business day, add business days to a date or count them in an interval.

There is no separate web version: run this Actor on Apify.

### Who it is for

- Payroll, HR and finance teams that calculate payment dates, payroll runs or deadlines in Spain.
- Legal, administrative and operations teams that need to count business days under Spanish rules.
- Developers building scheduling, invoicing, logistics or delivery-estimate flows that must skip weekends and public holidays.

### What it does/checks

- **`festivos`**: lists the public holidays of a year. With a community code, it returns the national holidays plus that community's own holidays; without one, it returns every holiday published for the year, with the `ambito` field telling you whether it is national or regional.
- **`esHabil`**: says whether a given date is a business day. By default, Saturday and Sunday are not business days; `sabadoHabil` makes Saturday count unless it is a holiday.
- **`sumarDiasHabiles`**: adds (or subtracts, with a negative `n`) business days to a date. `n = 0` returns the same date.
- **`contarDiasHabiles`**: counts business days in an interval using the **(desde, hasta]** criterion: the start date is excluded and the end date is included. Reversing the dates returns the negative count under the mirrored `[hasta, desde)` criterion.
- Data comes from the BOE resolutions for **2026** (`BOE-A-2025-21667`) and **2027** (`BOE-A-2026-21254`), verified on 2026-10-27.
- Communities are identified with their **ISO 3166-2:ES** code (`ES-MD`, `ES-CT`, `ES-AN`…), covering the 17 autonomous communities and the two autonomous cities.
- Every item includes the **BOE source** and a fixed **warning about local holidays**, even when the query fails.
- A bad query (unknown year, invalid date, unknown community) becomes an **`error` in that item**; the rest of the batch continues.

**Important:** the calendar does **not** include local holidays (up to two per municipality) or holidays agreed in collective agreements. For day checks, omitting `comunidad` applies only national holidays.

### Input

A single query uses the root fields; a batch uses the `consultas` array. If both are present, the batch wins and the single-query fields are ignored.

Single query:

```json
{
  "operacion": "festivos",
  "anio": 2027,
  "comunidad": "ES-MD"
}
```

Mixed batch:

```json
{
  "consultas": [
    { "operacion": "esHabil", "fecha": "2027-01-04" },
    { "operacion": "sumarDiasHabiles", "fecha": "2026-12-31", "n": 1 },
    { "operacion": "contarDiasHabiles", "desde": "2026-12-31", "hasta": "2027-01-04" },
    { "operacion": "festivos", "anio": 2028 }
  ]
}
```

| Field | Type | Operations | Description |
|---|---|---|---|
| `operacion` | string | all | `festivos`, `esHabil`, `sumarDiasHabiles` or `contarDiasHabiles`. |
| `anio` | integer | `festivos` | Calendar year. Only 2026 and 2027 have data. |
| `comunidad` | string | all | ISO 3166-2:ES code. Optional. |
| `fecha` | string | `esHabil`, `sumarDiasHabiles` | Civil date as `AAAA-MM-DD`. |
| `n` | integer | `sumarDiasHabiles` | Business days to add; negative to subtract. |
| `desde` | string | `contarDiasHabiles` | Start of the interval, excluded, as `AAAA-MM-DD`. |
| `hasta` | string | `contarDiasHabiles` | End of the interval, included, as `AAAA-MM-DD`. |
| `sabadoHabil` | boolean | `esHabil`, `sumarDiasHabiles`, `contarDiasHabiles` | If `true`, Saturday counts as a business day unless it is a holiday. |
| `consultas` | array | batch | Up to 1000 queries, each with the fields above. Each query can use a different operation. |

The last query of the batch example returns a clear error because 2028 is not published yet; the other three resolve and the run finishes successfully.

### Output

One dataset item per query, with a **Resumen** view.

```json
[
  {
    "operacion": "festivos",
    "parametros": { "anio": 2027, "comunidad": "ES-MD" },
    "resultado": [
      { "fecha": "2027-01-01", "nombre": "Año Nuevo", "ambito": "nacional", "tipo": "nacional_no_sustituible" },
      { "fecha": "2027-03-19", "nombre": "San José", "ambito": ["ES-GA", "ES-MD", "ES-MC", "ES-NC", "ES-VC"], "tipo": "nacional_sustituible" }
    ],
    "aviso": "Este calendario no incluye las fiestas locales (hasta dos por municipio): consúltalas en el boletín oficial de tu comunidad autónoma o de tu provincia.",
    "fuente": [{ "anio": 2027, "id": "BOE-A-2026-21254", "verificadoEl": "2026-10-27" }],
    "duracionMs": 1
  }
]
```

| Field | Description |
|---|---|
| `operacion` | Resolved operation. |
| `parametros` | Parameters received, only those used by the operation. |
| `resultado` | Holidays, boolean, date or day count, depending on the operation. `null` on error. |
| `error` | Reason the query failed; absent when it resolved. |
| `aviso` | Fixed reminder that local holidays are not included. |
| `fuente` | BOE resolutions used, with `id` and `verificadoEl`; empty if the year is not published. |
| `duracionMs` | Resolution time in milliseconds. |

### Use cases

- **Payment and invoice due dates:** add or count business days for payment terms and reminders.
- **Payroll and HR planning:** list the holidays that affect a region and avoid scheduling work on non-business days.
- **Logistics and customer promises:** estimate delivery or service dates while skipping weekends and Spanish public holidays.

### Limits

- **Years with data: 2026 and 2027 only.** Any other year returns an error for that query, not an empty list.
- **Up to 1000 queries per run.**
- Dates are civil dates without time or time zone; relative dates and date-time values are not accepted.
- `n` must be an integer. A walk that crosses into a year without data stops with an error.
- No local holidays, municipal holidays or collective-agreement calendars.
- A national holiday that falls on a Sunday and is not moved does not appear in the list; that day is already a non-business day.

### Privacy

The Actor downloads no documents and stores no personal data. It only reads the query parameters and writes the result to the run dataset, which is visible to whoever runs the Actor. Run logs contain counts only, not the content of each query. No data is sent to third parties.

### Pricing

**Free during the launch period.** Later, one event per query resolved without an error (`consulta-calendario`); rejected/failed items are never charged.

### Disclaimer

This Actor provides calendar information for organisational and deadline-calculation purposes. It is **not labour, tax, legal or accounting advice**. Before making decisions with legal effects, check the dates against the BOE, your community's official gazette and your collective agreement.

### Español

### Calendario laboral y días hábiles de España (BOE)

Consulta los festivos nacionales y autonómicos publicados en el BOE, comprueba si una fecha es hábil, suma días hábiles a una fecha o los cuenta en un intervalo.

No hay una versión web aparte: ejecuta este actor en Apify.

### Para quién es

- Equipos de nóminas, recursos humanos y finanzas que calculan fechas de pago, ejecuciones de nómina o vencimientos en España.
- Equipos jurídicos, administrativos y de operaciones que necesitan contar días hábiles con criterios españoles.
- Desarrolladores que construyen flujos de planificación, facturación, logística o estimación de entregas que deben saltarse fines de semana y festivos.

### Qué comprueba

- **`festivos`**: lista los festivos de un año. Con un código de comunidad, devuelve los nacionales más los propios de esa comunidad; sin él, devuelve todos los publicados para el año, y el campo `ambito` indica si cada uno es nacional o autonómico.
- **`esHabil`**: dice si una fecha es día hábil. Por defecto, sábado y domingo no lo son; `sabadoHabil` hace que el sábado cuente salvo que sea festivo.
- **`sumarDiasHabiles`**: suma (o resta, con `n` negativo) días hábiles a una fecha. `n = 0` devuelve la misma fecha.
- **`contarDiasHabiles`**: cuenta los días hábiles de un intervalo con el criterio **(desde, hasta]**: el día inicial no cuenta y el final sí. Si las fechas se invierten, devuelve el negativo del criterio espejo `[hasta, desde)`.
- Los datos son los de las resoluciones del BOE para **2026** (`BOE-A-2025-21667`) y **2027** (`BOE-A-2026-21254`), verificadas el 2026-10-27.
- Las comunidades se identifican con su código **ISO 3166-2:ES** (`ES-MD`, `ES-CT`, `ES-AN`…), que cubre las 17 comunidades autónomas y las dos ciudades autónomas.
- Cada elemento incluye la **fuente del BOE** y un **aviso fijo sobre los festivos locales**, incluso cuando la consulta falla.
- Una consulta mala (año desconocido, fecha inválida, comunidad desconocida) se convierte en un **`error` de ese elemento**; el resto del lote continúa.

**Importante:** el calendario **no incluye las fiestas locales** (hasta dos por municipio) ni las acordadas en convenios colectivos. Para las comprobaciones de días hábiles, si se omite `comunidad` solo se aplican las fiestas nacionales.

### Entrada

Una consulta única usa los campos de la raíz; un lote usa el array `consultas`. Si llegan las dos, gana el lote y los campos de la consulta única se ignoran. Los ejemplos JSON completos están en la versión inglesa.

| Campo | Tipo | Operaciones | Descripción |
|---|---|---|---|
| `operacion` | texto | todas | `festivos`, `esHabil`, `sumarDiasHabiles` o `contarDiasHabiles`. |
| `anio` | entero | `festivos` | Año del calendario. Solo hay datos de 2026 y 2027. |
| `comunidad` | texto | todas | Código ISO 3166-2:ES. Opcional. |
| `fecha` | texto | `esHabil`, `sumarDiasHabiles` | Día civil como `AAAA-MM-DD`. |
| `n` | entero | `sumarDiasHabiles` | Días hábiles a sumar; negativo para restar. |
| `desde` | texto | `contarDiasHabiles` | Inicio del intervalo, excluido, como `AAAA-MM-DD`. |
| `hasta` | texto | `contarDiasHabiles` | Fin del intervalo, incluido, como `AAAA-MM-DD`. |
| `sabadoHabil` | booleano | `esHabil`, `sumarDiasHabiles`, `contarDiasHabiles` | Si es `true`, el sábado cuenta como hábil salvo que sea festivo. |
| `consultas` | array | lote | Hasta 1000 consultas, cada una con los campos anteriores. Cada consulta puede usar una operación distinta. |

La última consulta del ejemplo de lote devuelve un error claro porque 2028 aún no está publicado; las otras tres se resuelven y la ejecución termina correctamente.

### Salida

Un elemento del dataset por consulta, con una vista **Resumen**. El ejemplo JSON completo está en la versión inglesa.

| Campo | Descripción |
|---|---|
| `operacion` | Operación resuelta. |
| `parametros` | Parámetros recibidos, solo los que usa la operación. |
| `resultado` | Festivos, booleano, fecha o número de días, según la operación. `null` si hay error. |
| `error` | Motivo del fallo; ausente cuando la consulta se resolvió. |
| `aviso` | Recordatorio fijo de que no se incluyen las fiestas locales. |
| `fuente` | Resoluciones del BOE usadas, con `id` y `verificadoEl`; vacía si el año no está publicado. |
| `duracionMs` | Tiempo de resolución en milisegundos. |

### Casos de uso

- **Vencimientos de pagos y facturas:** sumar o contar días hábiles para plazos de pago y recordatorios.
- **Planificación de nóminas y recursos humanos:** listar los festivos que afectan a una región y evitar programar trabajo en días no hábiles.
- **Logística y promesas al cliente:** estimar fechas de entrega o de servicio saltándose fines de semana y festivos españoles.

### Límites

- **Años con datos: solo 2026 y 2027.** Cualquier otro año devuelve un error en esa consulta, no una lista vacía.
- **Hasta 1000 consultas por ejecución.**
- Las fechas son días civiles sin hora ni zona horaria; no se admiten fechas relativas ni valores con hora.
- `n` debe ser un entero. El recorrido se detiene con error si cruza a un año sin datos.
- No se incluyen fiestas locales, fiestas de municipios ni calendarios de convenios colectivos.
- Una fiesta nacional que caiga en domingo y no se traslade no aparece en la lista; ese día ya es inhábil.

### Privacidad

El actor no descarga documentos ni guarda datos personales. Solo lee los parámetros de la consulta y escribe el resultado en el dataset de la ejecución, que es visible para quien ejecuta el actor. Los registros de ejecución solo incluyen recuentos, no el contenido de cada consulta. No se envían datos a servicios de terceros.

### Precios

**Gratis durante el periodo de lanzamiento.** Después, un evento por cada consulta resuelta sin error (`consulta-calendario`); las consultas rechazadas o fallidas nunca se cobran.

### Aviso

Este actor ofrece información de calendario con fines organizativos y de cálculo de plazos. **No es asesoramiento laboral, fiscal, legal ni contable.** Antes de tomar decisiones con efectos jurídicos, contrasta las fechas con el BOE, el boletín oficial de tu comunidad y tu convenio colectivo.

# Actor input Schema

## `operacion` (type: `string`):

Operación de una consulta única. Si rellenas «Consultas en lote», este campo y sus parámetros se ignoran.

## `anio` (type: `integer`):

Año del calendario para la operación «festivos». Hay datos de 2026 y 2027; cualquier otro año devuelve un error en esa consulta.

## `comunidad` (type: `string`):

Código ISO 3166-2:ES (ES-AN, ES-AR, ES-AS, ES-IB, ES-CN, ES-CB, ES-CL, ES-CM, ES-CT, ES-EX, ES-GA, ES-MD, ES-MC, ES-NC, ES-PV, ES-RI, ES-VC, ES-CE, ES-ML). Si se omite, solo se aplican las fiestas nacionales.

## `fecha` (type: `string`):

Día civil en formato AAAA-MM-DD (sin hora ni zona horaria) para «esHabil» y «sumarDiasHabiles».

## `n` (type: `integer`):

Número entero de días hábiles que se suman a «fecha». Usa un valor negativo para restar.

## `desde` (type: `string`):

Día inicial del cómputo, excluido, en formato AAAA-MM-DD. El intervalo es (desde, hasta].

## `hasta` (type: `string`):

Día final del cómputo, incluido, en formato AAAA-MM-DD. El intervalo es (desde, hasta].

## `sabadoHabil` (type: `boolean`):

Si está activo, el sábado cuenta como día hábil salvo que sea festivo. Por defecto, sábado y domingo no son hábiles.

## `consultas` (type: `array`):

Hasta 1000 consultas. Si se rellena, tiene prioridad sobre la consulta única y se ignoran sus campos.

## Actor input object example

```json
{
  "operacion": "festivos",
  "anio": 2027,
  "comunidad": "ES-MD"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset con un elemento por consulta: resultado, error (si lo hay), aviso y fuente.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "operacion": "festivos",
    "anio": 2027,
    "comunidad": "ES-MD"
};

// Run the Actor and wait for it to finish
const run = await client.actor("angel.carreira/calendario-laboral-espana").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "operacion": "festivos",
    "anio": 2027,
    "comunidad": "ES-MD",
}

# Run the Actor and wait for it to finish
run = client.actor("angel.carreira/calendario-laboral-espana").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "operacion": "festivos",
  "anio": 2027,
  "comunidad": "ES-MD"
}' |
apify call angel.carreira/calendario-laboral-espana --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,angel.carreira/calendario-laboral-espana"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/uRdUAUZEyJvpw7SJJ/builds/8VxYN1p6MfSx0SLAu/openapi.json
