{
  "openapi": "3.1.0",
  "info": {
    "title": "HowMuchWorks API",
    "version": "1.1.0",
    "summary": "Material estimates for tile and roofing jobs, JSON in and out.",
    "description": "materials/estimate turns tile and roofing measurements into material line items, free and without a key. Every result states its assumptions. Inputs are not stored. The same workflow is the estimate_materials tool of the remote MCP server at https://howmuchworks.com/mcp. The fleet VIN audit and the CPSC product recall match are available as Apify Actors: https://apify.com/howmuchworks/fleet-vin-audit and https://apify.com/howmuchworks/cpsc-recall-match"
  },
  "servers": [
    {
      "url": "https://howmuchworks.com"
    }
  ],
  "externalDocs": {
    "url": "https://howmuchworks.com/developers/"
  },
  "paths": {
    "/api/v1/materials/estimate": {
      "post": {
        "operationId": "estimateMaterials",
        "summary": "Estimate materials for a batch of tile and roofing jobs",
        "description": "Free, no key. Up to 50 jobs per request; each job is validated and calculated on its own.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "jobs": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "1 to 50 independent jobs. Each job is estimated on its own; one invalid job does not stop the others.",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "title": "Tile for a rectangular floor or wall",
                          "properties": {
                            "type": {
                              "const": "tile",
                              "description": "Tile for a rectangular floor or wall"
                            },
                            "id": {
                              "type": "string",
                              "maxLength": 100,
                              "description": "Optional label echoed back, such as a room name."
                            },
                            "unit": {
                              "type": "string",
                              "enum": [
                                "imperial",
                                "metric"
                              ],
                              "description": "imperial: length and width in feet, tile size and grout joint in inches, openingsArea in sq ft. metric: length and width in metres, tile size in centimetres, grout joint in millimetres, openingsArea in m²."
                            },
                            "length": {
                              "type": "number",
                              "description": "Floor or wall length (ft or m).",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "width": {
                              "type": "number",
                              "description": "Floor width or wall height (ft or m).",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "tileLength": {
                              "type": "number",
                              "description": "Measured tile face length (in or cm), not the nominal size.",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "tileWidth": {
                              "type": "number",
                              "description": "Measured tile face width (in or cm).",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "tilesPerBox": {
                              "type": "integer",
                              "description": "Tiles per box, from the product label.",
                              "minimum": 1,
                              "maximum": 100000
                            },
                            "groutJoint": {
                              "type": "number",
                              "description": "Grout joint width (in or mm). Default 0.125 in (imperial) or 3 mm (metric). 0 for butt-joined tiles.",
                              "minimum": 0,
                              "maximum": 50
                            },
                            "wastePercent": {
                              "type": "number",
                              "description": "Waste allowance in percent, 0 to 50. Default 10 (straight lay); use about 15 for diagonal or herringbone.",
                              "minimum": 0,
                              "maximum": 50,
                              "default": 10
                            },
                            "openingsArea": {
                              "type": "number",
                              "description": "Area inside the rectangle that is not tiled (doors, a tub, cabinets), in sq ft or m². Default 0. When above 0 the count is by area only.",
                              "minimum": 0,
                              "maximum": 100000000,
                              "default": 0
                            }
                          },
                          "required": [
                            "type",
                            "unit",
                            "length",
                            "width",
                            "tileLength",
                            "tileWidth",
                            "tilesPerBox"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "title": "Asphalt shingles and underlayment for a roof with one pitch",
                          "properties": {
                            "type": {
                              "const": "roofing",
                              "description": "Asphalt shingles and underlayment for a roof with one pitch"
                            },
                            "id": {
                              "type": "string",
                              "maxLength": 100,
                              "description": "Optional label echoed back, such as a room name."
                            },
                            "unit": {
                              "type": "string",
                              "enum": [
                                "imperial",
                                "metric"
                              ],
                              "description": "imperial: lengths in feet. metric: lengths in metres. Bundle coverage is always in sq ft (as printed on US wrappers)."
                            },
                            "length": {
                              "type": "number",
                              "description": "House footprint length (ft or m).",
                              "exclusiveMinimum": 0,
                              "maximum": 100000
                            },
                            "width": {
                              "type": "number",
                              "description": "House footprint width (ft or m).",
                              "exclusiveMinimum": 0,
                              "maximum": 100000
                            },
                            "pitch": {
                              "type": "number",
                              "description": "Roof pitch as rise per 12 of run (6 means 6/12). From degrees: 12 x tan(angle).",
                              "minimum": 0,
                              "maximum": 24
                            },
                            "overhang": {
                              "type": "number",
                              "description": "Eave overhang added to every side (ft or m). Default 0, meaning the length and width are already measured edge to edge.",
                              "minimum": 0,
                              "maximum": 100,
                              "default": 0
                            },
                            "wastePercent": {
                              "type": "number",
                              "description": "Waste allowance in percent, 0 to 50. Default 10 (simple gable); use 15 or more for hips, valleys and dormers.",
                              "minimum": 0,
                              "maximum": 50,
                              "default": 10
                            },
                            "bundleCoverageSqft": {
                              "type": "number",
                              "description": "Coverage per shingle bundle in sq ft, from the wrapper. Default 32.8 (common architectural shingles: 98.4 sq ft per 3 bundles).",
                              "minimum": 20,
                              "maximum": 50,
                              "default": 32.8
                            },
                            "underlayment": {
                              "type": "string",
                              "enum": [
                                "felt15",
                                "felt30",
                                "synthetic"
                              ],
                              "description": "felt15: #15 felt, about 400 sq ft net per roll. felt30: #30 felt, about 200 sq ft net. synthetic: 10-square synthetic roll, about 929 sq ft net with 3 in laps. Default felt15.",
                              "default": "felt15"
                            }
                          },
                          "required": [
                            "type",
                            "unit",
                            "length",
                            "width",
                            "pitch"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "jobs"
                ],
                "additionalProperties": false
              },
              "example": {
                "jobs": [
                  {
                    "type": "tile",
                    "id": "kitchen",
                    "unit": "imperial",
                    "length": 12,
                    "width": 10,
                    "tileLength": 12,
                    "tileWidth": 12,
                    "tilesPerBox": 10
                  },
                  {
                    "type": "roofing",
                    "id": "house",
                    "unit": "imperial",
                    "length": 40,
                    "width": 30,
                    "overhang": 1,
                    "pitch": 6
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Estimate for every job (check each job's ok field).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string",
                      "description": "Version of the estimate logic."
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "jobs": {
                          "type": "integer"
                        },
                        "succeeded": {
                          "type": "integer"
                        },
                        "failed": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "jobs",
                        "succeeded",
                        "failed"
                      ]
                    },
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "description": "Position of the job in the request, from 0."
                          },
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "ok": {
                            "type": "boolean"
                          },
                          "error": {
                            "type": "string",
                            "description": "Present when ok is false: what to fix."
                          },
                          "inputsUsed": {
                            "type": "object",
                            "description": "The inputs after defaults were applied."
                          },
                          "measurements": {
                            "type": "object"
                          },
                          "lineItems": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "item": {
                                  "type": "string"
                                },
                                "quantity": {
                                  "type": "number",
                                  "description": "Amount needed including waste, before rounding to packages."
                                },
                                "unit": {
                                  "type": "string",
                                  "description": "Unit of quantity: tile or sq ft."
                                },
                                "wastePercent": {
                                  "type": "number"
                                },
                                "packageName": {
                                  "type": "string",
                                  "description": "box, bundle or roll."
                                },
                                "packageSize": {
                                  "type": "number",
                                  "description": "How much one package holds or covers, in packageUnit."
                                },
                                "packageUnit": {
                                  "type": "string"
                                },
                                "packagesToBuy": {
                                  "type": "integer",
                                  "description": "quantity / packageSize, rounded up to whole packages."
                                },
                                "leftover": {
                                  "type": "number",
                                  "description": "packagesToBuy x packageSize - quantity, in unit."
                                },
                                "rounding": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "item",
                                "quantity",
                                "unit",
                                "wastePercent",
                                "packageName",
                                "packageSize",
                                "packageUnit",
                                "packagesToBuy",
                                "leftover",
                                "rounding"
                              ]
                            }
                          },
                          "assumptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "warnings": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "index",
                          "type",
                          "ok"
                        ]
                      }
                    },
                    "totals": {
                      "type": "array",
                      "description": "Packages summed across successful jobs, per identical item and package size. Each job is rounded up on its own, so a combined order can sometimes be smaller.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "item": {
                            "type": "string"
                          },
                          "packageName": {
                            "type": "string"
                          },
                          "packageSize": {
                            "type": "number"
                          },
                          "packageUnit": {
                            "type": "string"
                          },
                          "packagesToBuy": {
                            "type": "integer"
                          },
                          "jobs": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "item",
                          "packageName",
                          "packageSize",
                          "packageUnit",
                          "packagesToBuy",
                          "jobs"
                        ]
                      }
                    }
                  },
                  "required": [
                    "version",
                    "summary",
                    "jobs",
                    "totals"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON, or the request as a whole is invalid (no jobs, more than 50, unknown top-level field).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_json",
                            "invalid_body",
                            "invalid_input",
                            "no_jobs",
                            "too_many_jobs",
                            "body_too_large",
                            "method_not_allowed",
                            "free_allowance_used_up",
                            "upstream_unavailable",
                            "internal_error"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Only POST (and OPTIONS) are accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_json",
                            "invalid_body",
                            "invalid_input",
                            "no_jobs",
                            "too_many_jobs",
                            "body_too_large",
                            "method_not_allowed",
                            "free_allowance_used_up",
                            "upstream_unavailable",
                            "internal_error"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_json",
                            "invalid_body",
                            "invalid_input",
                            "no_jobs",
                            "too_many_jobs",
                            "body_too_large",
                            "method_not_allowed",
                            "free_allowance_used_up",
                            "upstream_unavailable",
                            "internal_error"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_json",
                            "invalid_body",
                            "invalid_input",
                            "no_jobs",
                            "too_many_jobs",
                            "body_too_large",
                            "method_not_allowed",
                            "free_allowance_used_up",
                            "upstream_unavailable",
                            "internal_error"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
