{
  "openapi": "3.1.1",
  "info": {
    "title": "Will It Fit? API",
    "version": "1.0.0",
    "summary": "Check if a sofa, wardrobe or box fits through doors, corners, stairs and lifts.",
    "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://willitfit.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Check if a sofa, wardrobe or box fits through doors, corners, stairs and lifts.",
        "description": "Enter the item’s length, width and height and the measurements along the delivery path. Will It Fit? tries every orientation, in-plane diagonal tilts and the classic moving-sofa corner calculation, then reports pass/fail per checkpoint with spare centimetres and how to carry the item.\n\nMethodology:\n- The item is treated as a rigid rectangular box; the safety clearance is subtracted from every opening dimension.\n- Doors, stairs and elevator doors: for each of the 3 choices of travel axis, the remaining two sides form the cross-section; it is rotated in the opening plane from 0° to 90° in 0.25° steps (bounding box p·cosθ+q·sinθ by p·sinθ+q·cosθ) and the best margin is kept — this covers the \"diagonal\" tilt through a door.\n- Corner: the classic moving-sofa formula for a right-angle turn between corridors of widths a and b gives the longest flat length L_max(w) = min over θ of a/sinθ + b/cosθ − w/(sinθ·cosθ), evaluated numerically in 0.05° steps.\n- Corner, 3D: every side may stand vertical if it fits under the ceiling; the item may also be tilted upward by φ (constant during the turn) so its plan length becomes L·cosφ + h·sinφ while L·sinφ + h·cosφ stays under the ceiling. Fixed-tilt is a conservative approximation of real manoeuvring.\n- Elevator cabin and room: one side stays horizontal while the other two stand in a vertical plane tilted by φ = 0…90° (1° steps): height p·sinφ + q·cosφ must fit under the ceiling and the footprint (p·cosφ + q·sinφ) × side is rotated on the floor (0.25° steps) to fit the plan — this covers upright placement, standing diagonally in the cabin and leaning.\n- Stairs are modelled as an opening of stair width × headroom; landings and turns of the stairwell are not modelled.\n\nGeometric estimate for rigid boxes. Real items have legs, curves and soft parts; real people need grip room. Measure twice.",
        "tags": [
          "home-travel"
        ],
        "x-mcp-tool": "will_it_fit",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WillItFitInput"
              },
              "examples": {
                "example1": {
                  "summary": "3-seat sofa through a flat door and corridor",
                  "value": {
                    "itemLength": 210,
                    "itemWidth": 90,
                    "itemHeight": 85,
                    "clearance": 2,
                    "doorWidth": 80,
                    "doorHeight": 200,
                    "hallwayWidthBefore": 100,
                    "hallwayWidthAfter": 100,
                    "ceilingHeight": 250,
                    "roomWidth": 400,
                    "roomDepth": 350,
                    "roomHeight": 250
                  }
                },
                "example2": {
                  "summary": "Wardrobe box via elevator and stairs",
                  "value": {
                    "itemLength": 200,
                    "itemWidth": 60,
                    "itemHeight": 50,
                    "clearance": 3,
                    "doorWidth": 76,
                    "doorHeight": 198,
                    "ceilingHeight": 250,
                    "stairsWidth": 90,
                    "stairsHeadroom": 200,
                    "elevatorDoorWidth": 80,
                    "elevatorDoorHeight": 200,
                    "elevatorCabinWidth": 110,
                    "elevatorCabinDepth": 140,
                    "elevatorCabinHeight": 210
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WillItFitResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "WillItFitInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "itemLength": {
            "title": "Item length",
            "type": "number",
            "minimum": 1,
            "maximum": 2000,
            "x-unit": "cm"
          },
          "itemWidth": {
            "title": "Item width/depth",
            "type": "number",
            "minimum": 1,
            "maximum": 2000,
            "x-unit": "cm"
          },
          "itemHeight": {
            "title": "Item height",
            "type": "number",
            "minimum": 1,
            "maximum": 2000,
            "x-unit": "cm"
          },
          "clearance": {
            "title": "Safety clearance",
            "description": "Subtracted from every opening dimension (hands, padding, wobble).",
            "type": "number",
            "minimum": 0,
            "maximum": 30,
            "default": 2,
            "x-unit": "cm"
          },
          "doorWidth": {
            "title": "Door clear width",
            "description": "Measure between door stops with the door fully open.",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "doorHeight": {
            "title": "Door clear height",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "hallwayWidthBefore": {
            "title": "Hallway width before corner",
            "description": "Leave empty to skip the corner check.",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "hallwayWidthAfter": {
            "title": "Hallway width after corner",
            "description": "Defaults to the width before the corner.",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "ceilingHeight": {
            "title": "Hallway ceiling height",
            "description": "Used to tilt the item upward in the corner.",
            "type": "number",
            "minimum": 50,
            "maximum": 1000,
            "default": 250,
            "x-unit": "cm"
          },
          "stairsWidth": {
            "title": "Stair width",
            "description": "Leave empty to skip stairs.",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "stairsHeadroom": {
            "title": "Stair headroom (perpendicular to pitch)",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "elevatorDoorWidth": {
            "title": "Elevator door width",
            "description": "Leave elevator fields empty to skip.",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "elevatorDoorHeight": {
            "title": "Elevator door height",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "elevatorCabinWidth": {
            "title": "Elevator cabin width",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "elevatorCabinDepth": {
            "title": "Elevator cabin depth",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "elevatorCabinHeight": {
            "title": "Elevator cabin height",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          },
          "roomWidth": {
            "title": "Room width",
            "description": "Leave empty to skip the room check.",
            "type": "number",
            "minimum": 10,
            "maximum": 5000,
            "x-unit": "cm"
          },
          "roomDepth": {
            "title": "Room depth",
            "type": "number",
            "minimum": 10,
            "maximum": 5000,
            "x-unit": "cm"
          },
          "roomHeight": {
            "title": "Room height",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "x-unit": "cm"
          }
        },
        "required": [
          "itemLength",
          "itemWidth",
          "itemHeight",
          "doorWidth",
          "doorHeight"
        ]
      },
      "WillItFitResult": {
        "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",
            "additionalProperties": false,
            "required": [
              "item",
              "clearanceCm",
              "overallFits",
              "bottleneck",
              "checkpoints"
            ],
            "properties": {
              "item": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "lengthCm",
                  "widthCm",
                  "heightCm",
                  "diagonalCm"
                ],
                "properties": {
                  "lengthCm": {
                    "type": "number"
                  },
                  "widthCm": {
                    "type": "number"
                  },
                  "heightCm": {
                    "type": "number"
                  },
                  "diagonalCm": {
                    "type": "number"
                  }
                }
              },
              "clearanceCm": {
                "type": "number",
                "minimum": 0
              },
              "overallFits": {
                "type": "boolean"
              },
              "bottleneck": {
                "type": "string",
                "description": "Checkpoint id with the smallest margin."
              },
              "checkpoints": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "name",
                    "fits",
                    "marginCm",
                    "orientation",
                    "detail"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "enum": [
                        "door",
                        "corner",
                        "stairs",
                        "elevator-door",
                        "elevator-cabin",
                        "room"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "fits": {
                      "type": "boolean"
                    },
                    "marginCm": {
                      "type": "number",
                      "description": "Spare centimetres after clearance; negative = too big by that much."
                    },
                    "orientation": {
                      "type": "string"
                    },
                    "detail": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}