{
  "openapi": "3.0.3",
  "info": {
    "title": "Business Days API: Working Days & Holidays",
    "version": "1.1.0",
    "description": "Working-day arithmetic with real public holidays: add business days to a date, count the working days between two dates, check one date, or list a year's public holidays.\n115 calendars: countries and their regions (for example US, GB-ENG, DE-BY). Years 2010 to 2045.\n\n**Keys.** Every call except `/v1/calendars`, `/v1/about` and `/health` needs a key in the `X-Api-Key` header (or `?key=`).\n\n| Plan | Calls a month | Price |\n|---|---|---|\n| Free | 100 | $0, no end date, no credit card, one key per email address |\n| 14-day trial | 1,000 | $0 |\n| Starter | 10,000 | $49 a year |\n| Pro | 100,000 | $149 a year |\n| Business | 1,000,000 | $399 a year |\n\nGet a key at https://tachlestools.com/en/business-days-api/. Calls are counted per calendar month (UTC); `/v1/usage` is not counted.\n\n**Rules.** `workday` works like WORKDAY in Excel and Google Sheets (the start day is not counted). `networkdays` works like NETWORKDAYS (both ends counted).\n\n**Errors.** Every error is JSON: `{\"error\": \"<code>\", \"message\": \"<what to fix>\"}`.\n\nHoliday data: the date-holidays project (CC BY 3.0), checked against a second source and corrected from official lists. See `/v1/about`.",
    "contact": {
      "name": "Tachles Tools",
      "url": "https://tachlestools.com/en/support/",
      "email": "support@tachlestools.com"
    },
    "termsOfService": "https://tachlestools.com/en/terms/"
  },
  "externalDocs": {
    "description": "Guide, prices and keys",
    "url": "https://tachlestools.com/en/business-days-api/"
  },
  "servers": [
    {
      "url": "https://api.tachlestools.com"
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "ApiKeyQuery": []
    }
  ],
  "tags": [
    {
      "name": "Working days",
      "description": "Date arithmetic with public holidays."
    },
    {
      "name": "Holidays",
      "description": "Calendars and their public holidays."
    },
    {
      "name": "Account",
      "description": "Your key and this API."
    }
  ],
  "paths": {
    "/v1/workday": {
      "get": {
        "tags": [
          "Working days"
        ],
        "operationId": "addWorkdays",
        "summary": "Add or subtract working days",
        "description": "The date that is `days` working days after `start` (before it, when `days` is negative). The start day itself is not counted; `days=0` gives `start` back.",
        "parameters": [
          {
            "$ref": "#/components/parameters/calendar"
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "description": "The date to count from.",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-12-23"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": true,
            "description": "Working days to add. Negative to go back.",
            "schema": {
              "type": "integer",
              "minimum": -3650,
              "maximum": 3650,
              "example": 5
            }
          },
          {
            "$ref": "#/components/parameters/weekend"
          },
          {
            "$ref": "#/components/parameters/days_off"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Quota-Limit": {
                "description": "Calls your plan allows in a calendar month.",
                "schema": {
                  "type": "integer",
                  "example": 100
                }
              },
              "X-Quota-Remaining": {
                "description": "Calls left this month, after this one.",
                "schema": {
                  "type": "integer",
                  "example": 99
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Workday"
                },
                "examples": {
                  "us": {
                    "summary": "GET /v1/workday?calendar=US&start=2026-12-23&days=5",
                    "value": {
                      "calendar": {
                        "id": "US",
                        "name": "United States",
                        "weekend": [
                          "Saturday",
                          "Sunday"
                        ]
                      },
                      "start": "2026-12-23",
                      "days": 5,
                      "date": "2026-12-31",
                      "weekday": "Thursday"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Something in the request needs fixing. The message says what.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "missing_calendar",
                            "unknown_calendar",
                            "region_required",
                            "invalid_date",
                            "out_of_range",
                            "invalid_weekend",
                            "too_many_days_off",
                            "invalid_year",
                            "invalid_days"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/NoKey"
          },
          "403": {
            "$ref": "#/components/responses/Expired"
          },
          "429": {
            "$ref": "#/components/responses/OverQuota"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/networkdays": {
      "get": {
        "tags": [
          "Working days"
        ],
        "operationId": "countWorkdays",
        "summary": "Count the working days between two dates",
        "description": "Working days from `start` to `end`, both counted. If `end` is before `start` the count is negative. The answer also lists the holidays that fell on working days.",
        "parameters": [
          {
            "$ref": "#/components/parameters/calendar"
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "description": "First date.",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-12-01"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "description": "Last date.",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-12-31"
            }
          },
          {
            "$ref": "#/components/parameters/weekend"
          },
          {
            "$ref": "#/components/parameters/days_off"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Quota-Limit": {
                "description": "Calls your plan allows in a calendar month.",
                "schema": {
                  "type": "integer",
                  "example": 100
                }
              },
              "X-Quota-Remaining": {
                "description": "Calls left this month, after this one.",
                "schema": {
                  "type": "integer",
                  "example": 99
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Networkdays"
                },
                "examples": {
                  "germany": {
                    "summary": "GET /v1/networkdays?calendar=DE&start=2026-12-01&end=2026-12-31",
                    "value": {
                      "calendar": {
                        "id": "DE",
                        "name": "Germany",
                        "weekend": [
                          "Saturday",
                          "Sunday"
                        ]
                      },
                      "start": "2026-12-01",
                      "end": "2026-12-31",
                      "working_days": 22,
                      "calendar_days": 31,
                      "weekend_days": 8,
                      "holidays_on_workdays": [
                        {
                          "date": "2026-12-25",
                          "name": "Christmas Day",
                          "weekday": "Friday"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Something in the request needs fixing. The message says what.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "missing_calendar",
                            "unknown_calendar",
                            "region_required",
                            "invalid_date",
                            "out_of_range",
                            "invalid_weekend",
                            "too_many_days_off",
                            "invalid_year",
                            "invalid_days"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/NoKey"
          },
          "403": {
            "$ref": "#/components/responses/Expired"
          },
          "429": {
            "$ref": "#/components/responses/OverQuota"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/is-workday": {
      "get": {
        "tags": [
          "Working days"
        ],
        "operationId": "isWorkday",
        "summary": "Is this date a working day?",
        "description": "`true` or `false`, and why not: a weekend, a public holiday (with its name) or one of your own days off.",
        "parameters": [
          {
            "$ref": "#/components/parameters/calendar"
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "description": "The date to check.",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-12-28"
            }
          },
          {
            "$ref": "#/components/parameters/weekend"
          },
          {
            "$ref": "#/components/parameters/days_off"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Quota-Limit": {
                "description": "Calls your plan allows in a calendar month.",
                "schema": {
                  "type": "integer",
                  "example": 100
                }
              },
              "X-Quota-Remaining": {
                "description": "Calls left this month, after this one.",
                "schema": {
                  "type": "integer",
                  "example": 99
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IsWorkday"
                },
                "examples": {
                  "england": {
                    "summary": "GET /v1/is-workday?calendar=GB-ENG&date=2026-12-28",
                    "value": {
                      "calendar": {
                        "id": "GB-ENG",
                        "name": "United Kingdom – England",
                        "weekend": [
                          "Saturday",
                          "Sunday"
                        ]
                      },
                      "date": "2026-12-28",
                      "weekday": "Monday",
                      "is_workday": false,
                      "reason": "holiday",
                      "holiday": "Boxing Day (observed)"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Something in the request needs fixing. The message says what.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "missing_calendar",
                            "unknown_calendar",
                            "region_required",
                            "invalid_date",
                            "out_of_range",
                            "invalid_weekend",
                            "too_many_days_off",
                            "invalid_year",
                            "invalid_days"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/NoKey"
          },
          "403": {
            "$ref": "#/components/responses/Expired"
          },
          "429": {
            "$ref": "#/components/responses/OverQuota"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/holidays": {
      "get": {
        "tags": [
          "Holidays"
        ],
        "operationId": "listHolidays",
        "summary": "List the public holidays of a year",
        "description": "The public holidays of one calendar in one year, substitute (observed) days included. `calendar=none` is not accepted here.",
        "parameters": [
          {
            "$ref": "#/components/parameters/calendar"
          },
          {
            "name": "year",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 2010,
              "maximum": 2045,
              "example": 2027
            }
          },
          {
            "$ref": "#/components/parameters/weekend"
          },
          {
            "$ref": "#/components/parameters/days_off"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Quota-Limit": {
                "description": "Calls your plan allows in a calendar month.",
                "schema": {
                  "type": "integer",
                  "example": 100
                }
              },
              "X-Quota-Remaining": {
                "description": "Calls left this month, after this one.",
                "schema": {
                  "type": "integer",
                  "example": 99
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Holidays"
                },
                "examples": {
                  "england": {
                    "summary": "GET /v1/holidays?calendar=GB-ENG&year=2027",
                    "value": {
                      "calendar": {
                        "id": "GB-ENG",
                        "name": "United Kingdom – England",
                        "weekend": [
                          "Saturday",
                          "Sunday"
                        ]
                      },
                      "year": 2027,
                      "count": 10,
                      "holidays": [
                        {
                          "date": "2027-01-01",
                          "name": "New Year's Day",
                          "weekday": "Friday",
                          "on_weekend": false
                        },
                        {
                          "date": "2027-03-26",
                          "name": "Good Friday",
                          "weekday": "Friday",
                          "on_weekend": false
                        },
                        {
                          "date": "2027-03-29",
                          "name": "Easter Monday",
                          "weekday": "Monday",
                          "on_weekend": false
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Something in the request needs fixing. The message says what.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "missing_calendar",
                            "unknown_calendar",
                            "region_required",
                            "invalid_date",
                            "out_of_range",
                            "invalid_weekend",
                            "too_many_days_off",
                            "invalid_year",
                            "invalid_days"
                          ]
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "region_required": {
                    "summary": "GET /v1/holidays?calendar=Australia&year=2026",
                    "value": {
                      "error": "region_required",
                      "message": "Australia has different holidays by region: choose one.",
                      "regions": [
                        {
                          "id": "AU-ACT",
                          "name": "Australia – Australian Capital Territory"
                        },
                        {
                          "id": "AU-NSW",
                          "name": "Australia – New South Wales"
                        },
                        {
                          "id": "AU-NT",
                          "name": "Australia – Northern Territory"
                        }
                      ]
                    }
                  },
                  "invalid_date": {
                    "summary": "GET /v1/workday?calendar=US&start=2026-02-30&days=1",
                    "value": {
                      "error": "invalid_date",
                      "message": "start is not a real date: 2026-02-30."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/NoKey"
          },
          "403": {
            "$ref": "#/components/responses/Expired"
          },
          "429": {
            "$ref": "#/components/responses/OverQuota"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/calendars": {
      "get": {
        "tags": [
          "Holidays"
        ],
        "operationId": "listCalendars",
        "summary": "List every calendar",
        "security": [],
        "description": "Every country and region, with its id and usual weekend. No key needed, and not counted.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Calendars"
                },
                "examples": {
                  "all": {
                    "summary": "GET /v1/calendars",
                    "value": {
                      "count": 115,
                      "years": {
                        "first": 2010,
                        "last": 2045
                      },
                      "calendars": [
                        {
                          "id": "AU-ACT",
                          "name": "Australia – Australian Capital Territory",
                          "country": "AU",
                          "region": true,
                          "weekend": [
                            "Saturday",
                            "Sunday"
                          ]
                        },
                        {
                          "id": "AU-NSW",
                          "name": "Australia – New South Wales",
                          "country": "AU",
                          "region": true,
                          "weekend": [
                            "Saturday",
                            "Sunday"
                          ]
                        },
                        {
                          "id": "AU-NT",
                          "name": "Australia – Northern Territory",
                          "country": "AU",
                          "region": true,
                          "weekend": [
                            "Saturday",
                            "Sunday"
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getUsage",
        "summary": "Your plan and the calls used this month",
        "description": "Shows your plan, when the key ends (`null` for a free key) and the calls used this calendar month. This call is not counted.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                },
                "examples": {
                  "free_key": {
                    "summary": "GET /v1/usage",
                    "value": {
                      "plan": "free",
                      "expires": null,
                      "month": "2026-11",
                      "used": 0,
                      "limit": 100,
                      "remaining": 100
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/NoKey"
          },
          "403": {
            "$ref": "#/components/responses/Expired"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/about": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getAbout",
        "summary": "About this API and its data",
        "security": [],
        "description": "Version, number of calendars, years covered and where the holidays come from. No key needed.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/About"
                },
                "examples": {
                  "about": {
                    "summary": "GET /v1/about",
                    "value": {
                      "name": "Business Days API",
                      "version": "1.1.0",
                      "calendars": 115,
                      "years": {
                        "first": 2010,
                        "last": 2045
                      },
                      "data": "Public holidays from the date-holidays project (data licensed CC BY 3.0, https://github.com/commenthol/date-holidays), checked day by day against a second independent source and corrected from official government lists. Israel: Yom Tov days and Independence Day from the Hebrew calendar.",
                      "rules": "workday works like Excel/Sheets WORKDAY (the start day is not counted). networkdays works like NETWORKDAYS (both ends counted).",
                      "by": "Tachles Tools – https://tachlestools.com"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getHealth",
        "summary": "Is the API up?",
        "security": [],
        "description": "A quick check that needs no key.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                },
                "examples": {
                  "health": {
                    "summary": "GET /health",
                    "value": {
                      "ok": true,
                      "name": "Business Days API",
                      "version": "1.1.0",
                      "docs": "https://tachlestools.com/en/business-days-api/"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Your key, as it arrived by email (it starts with `TT1-`)."
      },
      "ApiKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "key",
        "description": "The same key in the address, for places where a header can't be set. The header is safer."
      }
    },
    "parameters": {
      "calendar": {
        "name": "calendar",
        "in": "query",
        "required": true,
        "description": "A calendar id from `/v1/calendars` (`US`, `GB-ENG`, `DE-BY`), a name (`Germany`, `Bavaria`, `uk`), or `none` for weekends only. A country whose holidays differ by region answers `region_required` with the regions to choose from.",
        "schema": {
          "type": "string",
          "example": "GB-ENG"
        }
      },
      "weekend": {
        "name": "weekend",
        "in": "query",
        "required": false,
        "description": "The weekly days off, when they differ from the country's usual weekend: `sat-sun`, `fri-sat`, `sun`, `sat`, `fri`, `thu-fri`, `sun-mon`, `none`, or 7 digits Monday to Sunday where 1 is a day off (`0000011`).",
        "schema": {
          "type": "string",
          "example": "fri-sat"
        }
      },
      "days_off": {
        "name": "days_off",
        "in": "query",
        "required": false,
        "description": "Your own closed dates, comma separated (`2026-12-24,2026-12-31`). Up to 366.",
        "schema": {
          "type": "string",
          "example": "2026-12-24,2026-12-31"
        }
      }
    },
    "responses": {
      "NoKey": {
        "description": "No key was sent, or the key is not valid.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "missing_key",
                        "invalid_key"
                      ]
                    }
                  }
                }
              ]
            },
            "examples": {
              "missing_key": {
                "summary": "GET /v1/workday?calendar=US&start=2026-12-23&days=5 (no key)",
                "value": {
                  "error": "missing_key",
                  "message": "Send your API key in the X-Api-Key header. Get a free key (100 calls a month) at https://tachlestools.com/en/business-days-api/#plans"
                }
              },
              "invalid_key": {
                "summary": "GET /v1/workday?calendar=US&start=2026-12-23&days=5 (a wrong key)",
                "value": {
                  "error": "invalid_key",
                  "message": "This API key is not valid. Copy it again from your email, or get one at https://tachlestools.com/en/business-days-api/#plans"
                }
              }
            }
          }
        }
      },
      "Expired": {
        "description": "The trial or the paid year has ended. A free key has no end date.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "required": [
                    "expired"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "expired_key"
                      ]
                    }
                  }
                }
              ]
            },
            "examples": {
              "expired_key": {
                "summary": "GET /v1/workday?calendar=US&start=2026-12-23&days=5 (a trial key that ended)",
                "value": {
                  "error": "expired_key",
                  "message": "Your trial ended on 2026-11-01. Renew at https://tachlestools.com/en/business-days-api/#plans",
                  "expired": "2026-11-01"
                }
              }
            }
          }
        }
      },
      "OverQuota": {
        "description": "This month's calls are used up. Counting starts again on the 1st (UTC). Nothing is charged.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "required": [
                    "plan",
                    "limit",
                    "resets"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "quota_exceeded"
                      ]
                    }
                  }
                }
              ]
            },
            "examples": {
              "quota_exceeded": {
                "summary": "GET /v1/workday?calendar=US&start=2026-12-23&days=5 (call 101 with a free key)",
                "value": {
                  "error": "quota_exceeded",
                  "message": "This key has used its 100 calls for 2026-11. The count starts again on 2026-12-01. For more calls, see https://tachlestools.com/en/business-days-api/#plans",
                  "plan": "free",
                  "limit": 100,
                  "resets": "2026-12-01"
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "No such endpoint.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              ]
            },
            "examples": {
              "not_found": {
                "summary": "GET /v1/nothing",
                "value": {
                  "error": "not_found",
                  "message": "Unknown endpoint. Try /v1/calendars, /v1/holidays, /v1/is-workday, /v1/workday, /v1/networkdays or /v1/usage."
                }
              }
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "Only GET is supported.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "method_not_allowed"
                      ]
                    }
                  }
                }
              ]
            },
            "examples": {
              "method_not_allowed": {
                "summary": "POST /v1/calendars",
                "value": {
                  "error": "method_not_allowed",
                  "message": "Use GET."
                }
              }
            }
          }
        }
      },
      "ServerError": {
        "description": "Something went wrong on our side.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "server_error"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "Weekday": {
        "type": "string",
        "enum": [
          "Sunday",
          "Monday",
          "Tuesday",
          "Wednesday",
          "Thursday",
          "Friday",
          "Saturday"
        ]
      },
      "Plan": {
        "type": "string",
        "enum": [
          "free",
          "trial",
          "starter",
          "pro",
          "business"
        ],
        "description": "free: 100 calls a month; trial: 1,000 calls a month; starter: 10,000 calls a month; pro: 100,000 calls a month; business: 1,000,000 calls a month."
      },
      "CalendarUsed": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "weekend"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The calendar id, or `none`.",
            "example": "GB-ENG"
          },
          "name": {
            "type": "string",
            "example": "United Kingdom – England"
          },
          "weekend": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Weekday"
            },
            "description": "The weekly days off that were used."
          }
        },
        "description": "The calendar and weekend the answer was worked out with, so you can check it."
      },
      "Workday": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "calendar",
          "start",
          "days",
          "date",
          "weekday"
        ],
        "properties": {
          "calendar": {
            "$ref": "#/components/schemas/CalendarUsed"
          },
          "start": {
            "type": "string",
            "format": "date",
            "description": "The date you gave."
          },
          "days": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "The answer."
          },
          "weekday": {
            "$ref": "#/components/schemas/Weekday"
          }
        }
      },
      "Networkdays": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "calendar",
          "start",
          "end",
          "working_days",
          "calendar_days",
          "weekend_days",
          "holidays_on_workdays"
        ],
        "properties": {
          "calendar": {
            "$ref": "#/components/schemas/CalendarUsed"
          },
          "start": {
            "type": "string",
            "format": "date"
          },
          "end": {
            "type": "string",
            "format": "date"
          },
          "working_days": {
            "type": "integer",
            "description": "Negative when `end` is before `start`."
          },
          "calendar_days": {
            "type": "integer",
            "description": "All days in the range, both ends counted."
          },
          "weekend_days": {
            "type": "integer"
          },
          "holidays_on_workdays": {
            "type": "array",
            "description": "Public holidays and your days off that fell on working days, in date order.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "date",
                "name",
                "weekday"
              ],
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "name": {
                  "type": "string"
                },
                "weekday": {
                  "$ref": "#/components/schemas/Weekday"
                }
              }
            }
          }
        }
      },
      "IsWorkday": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "calendar",
          "date",
          "weekday",
          "is_workday",
          "reason",
          "holiday"
        ],
        "properties": {
          "calendar": {
            "$ref": "#/components/schemas/CalendarUsed"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "weekday": {
            "$ref": "#/components/schemas/Weekday"
          },
          "is_workday": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "enum": [
              "weekend",
              "holiday",
              "day_off",
              null
            ],
            "description": "Why it is not a working day; `null` when it is one."
          },
          "holiday": {
            "type": "string",
            "nullable": true,
            "description": "The public holiday on this date, if there is one (also given when it falls on a weekend)."
          }
        }
      },
      "Holidays": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "calendar",
          "year",
          "count",
          "holidays"
        ],
        "properties": {
          "calendar": {
            "$ref": "#/components/schemas/CalendarUsed"
          },
          "year": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "holidays": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "date",
                "name",
                "weekday",
                "on_weekend"
              ],
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "name": {
                  "type": "string"
                },
                "weekday": {
                  "$ref": "#/components/schemas/Weekday"
                },
                "on_weekend": {
                  "type": "boolean",
                  "description": "True when the holiday falls on a weekly day off."
                }
              }
            }
          }
        }
      },
      "Calendars": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "count",
          "years",
          "calendars"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "years": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "first",
              "last"
            ],
            "properties": {
              "first": {
                "type": "integer"
              },
              "last": {
                "type": "integer"
              }
            }
          },
          "calendars": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "name",
                "country",
                "region",
                "weekend"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "example": "DE-BY"
                },
                "name": {
                  "type": "string",
                  "example": "Germany – Bavaria"
                },
                "country": {
                  "type": "string",
                  "description": "Two-letter country code.",
                  "example": "DE"
                },
                "region": {
                  "type": "boolean",
                  "description": "True for a region of a country."
                },
                "weekend": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Weekday"
                  }
                }
              }
            }
          }
        }
      },
      "Usage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "plan",
          "expires",
          "month",
          "used",
          "limit",
          "remaining"
        ],
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/Plan"
          },
          "expires": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "The last day the key works. `null` for a free key, which has no end date."
          },
          "month": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}$",
            "description": "The calendar month being counted (UTC).",
            "example": "2026-11"
          },
          "used": {
            "type": "integer",
            "nullable": true
          },
          "limit": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "About": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "version",
          "calendars",
          "years",
          "data",
          "rules",
          "by"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "calendars": {
            "type": "integer"
          },
          "years": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "first",
              "last"
            ],
            "properties": {
              "first": {
                "type": "integer"
              },
              "last": {
                "type": "integer"
              }
            }
          },
          "data": {
            "type": "string"
          },
          "rules": {
            "type": "string"
          },
          "by": {
            "type": "string"
          }
        }
      },
      "Health": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ok",
          "name",
          "version",
          "docs"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "docs": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "missing_calendar",
              "unknown_calendar",
              "region_required",
              "invalid_date",
              "out_of_range",
              "invalid_weekend",
              "too_many_days_off",
              "invalid_year",
              "invalid_days",
              "missing_key",
              "invalid_key",
              "expired_key",
              "quota_exceeded",
              "not_found",
              "method_not_allowed",
              "server_error"
            ],
            "description": "A code you can test in your program."
          },
          "message": {
            "type": "string",
            "description": "What went wrong and what to do, in plain English."
          },
          "regions": {
            "type": "array",
            "description": "With `region_required`: the regions to choose from.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "expired": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "With `expired_key`: the day the key ended."
          },
          "plan": {
            "$ref": "#/components/schemas/Plan"
          },
          "limit": {
            "type": "integer",
            "description": "With `quota_exceeded`: the calls your plan allows in a month."
          },
          "resets": {
            "type": "string",
            "format": "date",
            "description": "With `quota_exceeded`: the day counting starts again."
          }
        }
      }
    }
  }
}
