{
  "openapi": "3.1.1",
  "info": {
    "title": "Crewdesk Absence Coverage Check API",
    "version": "1.0.0",
    "summary": "Check planned absences against minimum staffing per team, with 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://crewdeskabsencecoverage.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Check planned absences against minimum staffing per team, with public holidays.",
        "description": "Paste your people with their team and working days, their absences (approved or still requested, half days) and how many people each team needs: the check lists every working day on which a team falls below its minimum, who is away then, and the days with the most people away — before you approve the next request.\n\nMethodology:\n- Each person is available on their working days unless a public holiday of the region or an absence covers the day; half days count 0.5.\n- Requested (pending) absences count as away, so the result shows what approving them would mean.\n- A team falls short on a day when at least one of its members would normally work and fewer people than its minimum are available. A person in several teams counts in each.\n- Busiest days: the dates with the most people away (absences of any status).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "crewdesk_absence_coverage",
        "x-owner-app": "crewdesk",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrewdeskAbsenceCoverageInput"
              },
              "examples": {
                "example1": {
                  "summary": "Christmas in a Berlin studio",
                  "value": {
                    "people": "Jonas, Design, Mon-Fri\nLea, Design, Mon-Fri\nPriya, Engineering, Mon-Fri\nFelix, Engineering, Mon-Thu\nAma, Engineering, Mon-Fri",
                    "absences": "Jonas, 2026-12-21..2026-12-23\nLea, 2026-12-21..2026-12-31, pending\nPriya, 2026-12-24..2026-12-31, half-start\nFelix, 2026-12-21..2026-12-30, pending\nAma, 2026-12-28..2027-01-08",
                    "minimums": "Design: 1\nEngineering: 2",
                    "from": "2026-12-21",
                    "to": "2027-01-08",
                    "country": "DE",
                    "subdivision": "DE-BE"
                  }
                },
                "example2": {
                  "summary": "Bookshop Tuesday to Saturday, three people on the floor",
                  "value": {
                    "people": "Eva, Floor, Tue-Sat\nJan, Floor, Tue-Sat\nMia, Floor, Thu-Sat\nOlli, Floor, Tue-Sat",
                    "absences": "Jan, 2026-12-08..2026-12-12\nMia, 2026-12-10..2026-12-12, pending",
                    "minimums": "Floor: 3",
                    "from": "2026-12-07",
                    "to": "2026-12-19",
                    "country": "DE",
                    "subdivision": "DE-NW"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrewdeskAbsenceCoverageResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "CrewdeskAbsenceCoverageInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "people": {
            "title": "People (one per line: name, team, working days)",
            "description": "Someone in several teams: separate the teams with a slash, e.g. “Eva, Office/Floor, Tue-Sat”.",
            "type": "string",
            "maxLength": 20000,
            "default": "Jonas, Design, Mon-Fri\nLea, Design, Mon-Fri\nPriya, Engineering, Mon-Fri\nFelix, Engineering, Mon-Thu\nAma, Engineering, Mon-Fri"
          },
          "absences": {
            "title": "Absences (one per line: name, YYYY-MM-DD..YYYY-MM-DD[, pending][, half-start][, half-end])",
            "description": "“pending” marks a request that is not approved yet; it counts as away so you see what approving it would do.",
            "type": "string",
            "maxLength": 100000,
            "default": "Jonas, 2026-12-21..2026-12-23\nLea, 2026-12-21..2026-12-31, pending\nPriya, 2026-12-24..2026-12-31, half-start\nFelix, 2026-12-21..2026-12-30, pending\nAma, 2026-12-28..2027-01-08"
          },
          "minimums": {
            "title": "Minimum staffing (one per line: team: number)",
            "type": "string",
            "maxLength": 4000,
            "default": "Design: 1\nEngineering: 2"
          },
          "from": {
            "title": "From (YYYY-MM-DD)",
            "type": "string",
            "maxLength": 10,
            "default": "2026-12-21"
          },
          "to": {
            "title": "To (YYYY-MM-DD, at most 93 days)",
            "type": "string",
            "maxLength": 10,
            "default": "2027-01-08"
          },
          "country": {
            "title": "Country for public holidays (optional)",
            "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-BE"
          },
          "extraHolidays": {
            "title": "Extra holidays (YYYY-MM-DD, name per line)",
            "type": "string",
            "maxLength": 6000,
            "default": ""
          }
        },
        "required": []
      },
      "CrewdeskAbsenceCoverageResult": {
        "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": [
              "shortfalls",
              "busiestDays",
              "awayDays"
            ],
            "properties": {
              "shortfalls": {
                "type": "array"
              },
              "busiestDays": {
                "type": "array"
              },
              "awayDays": {
                "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"
              }
            }
          }
        }
      }
    }
  }
}