{
  "openapi": "3.1.1",
  "info": {
    "title": "Warranty Value Calculator API",
    "version": "1.0.0",
    "summary": "Is the extended warranty worth it? Expected payout vs. price and break-even failure rate.",
    "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://warrantyvaluecalculator.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Is the extended warranty worth it? Expected payout vs. price and break-even failure rate.",
        "description": "Enter the warranty price, how many years it covers, what is already covered by the legal or manufacturer warranty, a failure probability, repair cost, deductible and the chance a claim is approved. The calculator shows the expected payout, the expected net value and the failure rate at which the warranty would break even.\n\nMethodology:\n- Effective years = coverage years − years already covered by the legal/manufacturer warranty (floored at 0); during the overlap the extended warranty adds nothing for defects.\n- Payout per claim = min(average repair cost, item price) − deductible, floored at 0 (a repair costing more than the item is replaced instead).\n- Expected approved claims = effective years × annual failure probability × approval probability (at most one failure per year, years independent).\n- Expected payout = expected approved claims × payout per claim; expected net value = expected payout − warranty price.\n- Probability of at least one approved claim = 1 − (1 − p × a)^years, with p = annual failure probability and a = approval probability.\n- Break-even failure probability = warranty price ÷ (effective years × approval probability × payout per claim).\n- Verdict: worth it if net value > +10% of the warranty price, not worth it if < −10%, otherwise marginal.",
        "tags": [
          "money"
        ],
        "x-mcp-tool": "warranty_value_calculator",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WarrantyValueCalculatorInput"
              },
              "examples": {
                "example1": {
                  "summary": "TV: 3-year plan over a 2-year legal warranty",
                  "value": {
                    "currency": "EUR",
                    "itemPrice": 900,
                    "warrantyPrice": 99,
                    "coverageYears": 3,
                    "overlapYears": 2,
                    "annualFailureProbabilityPercent": 5,
                    "averageRepairCost": 300,
                    "deductible": 0,
                    "claimApprovalPercent": 80
                  }
                },
                "example2": {
                  "summary": "Phone: 2-year protection with deductible",
                  "value": {
                    "currency": "USD",
                    "itemPrice": 1000,
                    "warrantyPrice": 199,
                    "coverageYears": 2,
                    "overlapYears": 1,
                    "annualFailureProbabilityPercent": 15,
                    "averageRepairCost": 400,
                    "deductible": 99,
                    "claimApprovalPercent": 90
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WarrantyValueCalculatorResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "WarrantyValueCalculatorInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "currency": {
            "title": "Currency",
            "description": "Shown in results only; no conversion is performed.",
            "type": "string",
            "maxLength": 8,
            "default": "EUR"
          },
          "itemPrice": {
            "title": "Item price",
            "type": "number",
            "minimum": 0.01,
            "default": 800
          },
          "warrantyPrice": {
            "title": "Warranty price",
            "type": "number",
            "minimum": 0,
            "default": 120
          },
          "coverageYears": {
            "title": "Warranty covers (from purchase)",
            "type": "number",
            "minimum": 0.1,
            "maximum": 30,
            "default": 3,
            "x-unit": "years"
          },
          "overlapYears": {
            "title": "Of which already covered by legal / manufacturer warranty",
            "description": "E.g. 2 years of statutory warranty in the EU; set 0 if the warranty starts after it.",
            "type": "number",
            "minimum": 0,
            "maximum": 30,
            "default": 2,
            "x-unit": "years"
          },
          "annualFailureProbabilityPercent": {
            "title": "Chance of a failure per year",
            "description": "Your estimate; reliability differs a lot by product and brand.",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 5,
            "x-unit": "%/year"
          },
          "averageRepairCost": {
            "title": "Typical repair cost",
            "type": "number",
            "minimum": 0,
            "default": 250
          },
          "deductible": {
            "title": "Deductible per claim",
            "type": "number",
            "minimum": 0,
            "default": 0
          },
          "claimApprovalPercent": {
            "title": "Chance a claim is approved",
            "description": "Exclusions (accidental damage, wear) often reduce real coverage.",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 80,
            "x-unit": "%"
          }
        },
        "required": [
          "itemPrice",
          "warrantyPrice"
        ]
      },
      "WarrantyValueCalculatorResult": {
        "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": [
              "currency",
              "verdict",
              "effectiveYears",
              "payoutPerClaim",
              "expectedClaims",
              "probabilityOfAnyClaim",
              "expectedPayout",
              "expectedNetValue",
              "returnPerCurrencyUnit",
              "breakEvenAnnualFailurePercent",
              "warrantyShareOfItemPricePercent"
            ],
            "properties": {
              "currency": {
                "type": "string"
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "worth-it",
                  "marginal",
                  "not-worth-it"
                ]
              },
              "effectiveYears": {
                "type": "number",
                "description": "Coverage years not already covered by the legal/manufacturer warranty."
              },
              "payoutPerClaim": {
                "type": "number",
                "description": "min(repair cost, item price) − deductible, floored at 0."
              },
              "expectedClaims": {
                "type": "number",
                "description": "Expected number of approved claims."
              },
              "probabilityOfAnyClaim": {
                "type": "number",
                "minimum": 0,
                "maximum": 100,
                "description": "Percent chance of at least one approved claim."
              },
              "expectedPayout": {
                "type": "number"
              },
              "expectedNetValue": {
                "type": "number",
                "description": "expectedPayout − warranty price."
              },
              "returnPerCurrencyUnit": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Expected payout per unit of warranty price; null if the warranty is free."
              },
              "breakEvenAnnualFailurePercent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Annual failure probability at which expected payout equals price; null if unreachable (above 100% or no payout possible)."
              },
              "warrantyShareOfItemPricePercent": {
                "type": "number"
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}