{
  "openapi": "3.1.1",
  "info": {
    "title": "Crewdesk Working Days Calculator API",
    "version": "1.0.0",
    "summary": "Count the working days between two dates with your weekdays and regional public holidays.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://crewdeskworkingdays.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Count the working days between two dates with your weekdays and regional public holidays.",
        "description": "Counts the working days from a first to a last day (both included) for your own working pattern — Mon–Fri, a four-day week or shifts — minus the public holidays of your country and state or region (all 16 German states, Austrian and Swiss regions, US states, UK nations and more) and any extra company holidays. Half days at the start or end count 0.5. Lists every holiday and a month-by-month breakdown.\n\nMethodology:\n- Every date from the first to the last day (both included) is a working day when it is one of your working weekdays, not a public holiday of the chosen country and region, and not an extra holiday.\n- Public holidays: Nager.Date entries of type “Public” — nationwide ones plus those of the chosen state or region. Holidays that fall on a day you do not work change nothing.\n- A half first or last day counts 0.5 (a one-day range is 0.5 when either is set).\n- Some holidays apply only in some towns (e.g. Assumption Day in most of Bavaria, the Augsburg Peace Festival); they are named in the warnings — add them as extra holidays where they apply.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "crewdesk_working_days",
        "x-owner-app": "crewdesk",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrewdeskWorkingDaysInput"
              },
              "examples": {
                "example1": {
                  "summary": "Christmas break in Bavaria",
                  "value": {
                    "from": "2026-12-21",
                    "to": "2027-01-08",
                    "country": "DE",
                    "subdivision": "DE-BY"
                  }
                },
                "example2": {
                  "summary": "Same break in Berlin with Christmas Eve and New Year’s Eve closed",
                  "value": {
                    "from": "2026-12-21",
                    "to": "2027-01-08",
                    "country": "DE",
                    "subdivision": "DE-BE",
                    "extraHolidays": "2026-12-24, Christmas Eve\n2026-12-31, New Year’s Eve"
                  }
                },
                "example3": {
                  "summary": "Four-day week over Easter in Vienna",
                  "value": {
                    "from": "2027-03-22",
                    "to": "2027-04-02",
                    "country": "AT",
                    "subdivision": "AT-9",
                    "workingDays": "Mon-Thu"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrewdeskWorkingDaysResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "CrewdeskWorkingDaysInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "from": {
            "title": "First day (YYYY-MM-DD)",
            "type": "string",
            "maxLength": 10,
            "default": "2026-12-21"
          },
          "to": {
            "title": "Last day (YYYY-MM-DD)",
            "type": "string",
            "maxLength": 10,
            "default": "2027-01-08"
          },
          "country": {
            "title": "Country (two letters)",
            "type": "string",
            "maxLength": 4,
            "default": "DE"
          },
          "subdivision": {
            "title": "State or region (optional)",
            "description": "ISO 3166-2 code such as DE-BY (Bavaria), DE-BE (Berlin), AT-9 (Vienna), CH-ZH or US-CA. Without it only nationwide holidays count.",
            "type": "string",
            "maxLength": 6,
            "default": "DE-BY"
          },
          "workingDays": {
            "title": "Working days",
            "description": "Mon-Fri, Mon-Thu, Tue-Sat or Mon+Wed+Fri.",
            "type": "string",
            "maxLength": 40,
            "default": "Mon-Fri"
          },
          "halfFrom": {
            "title": "The first day counts half",
            "type": "boolean",
            "default": false
          },
          "halfTo": {
            "title": "The last day counts half",
            "type": "boolean",
            "default": false
          },
          "extraHolidays": {
            "title": "Extra holidays (one per line: YYYY-MM-DD, name)",
            "description": "Company closing days or local holidays that are not in the national data, e.g. 2026-12-24, Christmas Eve.",
            "type": "string",
            "maxLength": 6000,
            "default": ""
          }
        },
        "required": []
      },
      "CrewdeskWorkingDaysResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "workingDays",
              "calendarDays",
              "holidays",
              "byMonth"
            ],
            "properties": {
              "workingDays": {
                "type": "number"
              },
              "calendarDays": {
                "type": "integer"
              },
              "holidays": {
                "type": "array"
              },
              "byMonth": {
                "type": "array"
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}