{
  "openapi": "3.1.0",
  "info": {
    "title": "JunkHauler.com Public Quote & MCP Agent API",
    "version": "1.0.0",
    "description": "Zero-authentication REST API (/api/v1/quote) and Streamable HTTP Model Context Protocol server (/api/mcp) for upfront guaranteed maximum 16-cubic-yard junk removal pricing. Versioning & Deprecation Policy: Stable endpoints are versioned under /api/v1/* and return X-API-Version: 2026-11-25. Breaking changes increment the URL version (/api/v2/*) with at least 180 days notice via RFC 8594 Sunset and Deprecation headers. Rate Limit Policy: 120 requests per 60-second window (signaled via RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After on 429).",
    "contact": {
      "name": "JunkHauler.com API & Dispatch Engineering",
      "email": "dispatch@junkhauler.com",
      "url": "https://junkhauler.com/developers/"
    },
    "license": {
      "name": "Public Commercial Quote API Terms",
      "url": "https://junkhauler.com/terms/"
    }
  },
  "servers": [
    {
      "url": "https://junkhauler.com",
      "description": "Production Edge API & MCP Server"
    }
  ],
  "paths": {
    "/api/v1/quote": {
      "get": {
        "operationId": "calculateJunkQuoteGet",
        "summary": "Calculate upfront guaranteed maximum junk removal price by ZIP, items, or cubic yards",
        "description": "Returns deterministic 16-cubic-yard box-truck pricing, EPA/mattress tag modifiers, national 1-800 franchise savings, and a $0-today booking link.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersionHeader"
          },
          {
            "name": "zip",
            "in": "query",
            "required": false,
            "description": "5-digit U.S. postal ZIP code (defaults to 78701 if omitted).",
            "schema": {
              "type": "string",
              "pattern": "^\\d{5}(-\\d{4})?$",
              "example": "78701"
            }
          },
          {
            "name": "items",
            "in": "query",
            "required": false,
            "description": "Comma-separated item:qty pairs (e.g. sofa:1,mattress:1,fridge:1).",
            "schema": {
              "type": "string",
              "example": "sofa:1,mattress:1,fridge:1"
            }
          },
          {
            "name": "yards",
            "in": "query",
            "required": false,
            "description": "Estimated load volume in cubic yards (0.5 to 64.0).",
            "schema": {
              "type": "number",
              "minimum": 0.5,
              "maximum": 64,
              "example": 7.5
            }
          },
          {
            "name": "curbside",
            "in": "query",
            "required": false,
            "description": "Set true if items are staged outside within 10 ft of driveway access.",
            "schema": {
              "type": "boolean",
              "example": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Upfront guaranteed maximum junk removal price quote.",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimitRemaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimitReset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/QuoteResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequestProblem" },
          "404": { "$ref": "#/components/responses/NotFoundProblem" },
          "429": { "$ref": "#/components/responses/RateLimitedProblem" },
          "500": { "$ref": "#/components/responses/ServerErrorProblem" }
        }
      },
      "post": {
        "operationId": "calculateJunkQuotePost",
        "summary": "Calculate upfront guaranteed maximum junk removal price from a JSON manifest",
        "description": "Accepts a structured JSON item manifest or cubic-yard volume and returns guaranteed maximum pricing.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersionHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/QuoteRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upfront guaranteed maximum junk removal price quote.",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimitRemaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimitReset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/QuoteResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequestProblem" },
          "404": { "$ref": "#/components/responses/NotFoundProblem" },
          "429": { "$ref": "#/components/responses/RateLimitedProblem" },
          "500": { "$ref": "#/components/responses/ServerErrorProblem" }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "invokeMcpJsonRpc",
        "summary": "Streamable HTTP Model Context Protocol (MCP 2025-03-26) JSON-RPC 2.0 endpoint",
        "description": "Zero-auth MCP endpoint exposing calculate_junk_quote, lookup_item_disposal_price, and list_truck_volume_tiers.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersionHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/McpJsonRpcRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 MCP tool or initialization response.",
            "headers": {
              "Mcp-Session-Id": {
                "description": "Stateless MCP session identifier.",
                "schema": { "type": "string", "example": "jh-mcp-stateless-v1" }
              },
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimitRemaining" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpJsonRpcResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequestProblem" },
          "405": { "$ref": "#/components/responses/MethodNotAllowedProblem" },
          "429": { "$ref": "#/components/responses/RateLimitedProblem" },
          "500": { "$ref": "#/components/responses/ServerErrorProblem" }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ApiVersionHeader": {
        "name": "X-API-Version",
        "in": "header",
        "required": false,
        "description": "Pinned API calendar version (defaults to 2026-11-25).",
        "schema": {
          "type": "string",
          "default": "2026-11-25",
          "example": "2026-11-25"
        }
      }
    },
    "headers": {
      "XApiVersion": {
        "description": "Active API version string.",
        "schema": { "type": "string", "example": "2026-11-25" }
      },
      "RateLimitLimit": {
        "description": "Maximum requests permitted per 60-second window.",
        "schema": { "type": "integer", "example": 120 }
      },
      "RateLimitRemaining": {
        "description": "Requests remaining in the current 60-second window.",
        "schema": { "type": "integer", "example": 119 }
      },
      "RateLimitReset": {
        "description": "Seconds until the current rate-limit window resets.",
        "schema": { "type": "integer", "example": 60 }
      }
    },
    "responses": {
      "BadRequestProblem": {
        "description": "Invalid query parameter or malformed JSON payload (RFC 9457 Problem Details).",
        "content": {
          "application/problem+json": {
            "schema": { "$ref": "#/components/schemas/ProblemDetails" }
          }
        }
      },
      "NotFoundProblem": {
        "description": "Requested API resource or endpoint does not exist (RFC 9457 Problem Details).",
        "content": {
          "application/problem+json": {
            "schema": { "$ref": "#/components/schemas/ProblemDetails" }
          }
        }
      },
      "MethodNotAllowedProblem": {
        "description": "Unsupported HTTP method (RFC 9457 Problem Details).",
        "content": {
          "application/problem+json": {
            "schema": { "$ref": "#/components/schemas/ProblemDetails" }
          }
        }
      },
      "RateLimitedProblem": {
        "description": "Rate limit exceeded (120 requests/min). Inspect Retry-After header.",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying.",
            "schema": { "type": "integer", "example": 60 }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": { "$ref": "#/components/schemas/ProblemDetails" }
          }
        }
      },
      "ServerErrorProblem": {
        "description": "Unexpected server error (RFC 9457 Problem Details).",
        "content": {
          "application/problem+json": {
            "schema": { "$ref": "#/components/schemas/ProblemDetails" }
          }
        }
      }
    },
    "schemas": {
      "QuoteRequest": {
        "type": "object",
        "properties": {
          "zip": {
            "type": "string",
            "pattern": "^\\d{5}(-\\d{4})?$",
            "description": "5-digit U.S. postal ZIP code.",
            "example": "78701"
          },
          "items": {
            "type": "string",
            "description": "Comma-separated item:qty pairs.",
            "example": "sofa:1,mattress:1,fridge:1"
          },
          "yards": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 64,
            "description": "Optional explicit cubic-yard estimate.",
            "example": 7.5
          },
          "curbside": {
            "type": "boolean",
            "description": "True if staged at driveway edge.",
            "example": false
          }
        },
        "required": ["zip"]
      },
      "QuoteResponse": {
        "type": "object",
        "required": [
          "ok",
          "apiVersion",
          "provider",
          "zip5",
          "estimatedCubicYards",
          "pickupTruckBedsEquivalent",
          "matchedTier",
          "guaranteedMaxPriceUsd",
          "franchiseComparisonUsd",
          "statutoryModifiersIncluded",
          "manifest",
          "guarantee",
          "bookingUrl"
        ],
        "properties": {
          "ok": { "type": "boolean", "example": true },
          "apiVersion": { "type": "string", "example": "2026-11-25" },
          "provider": { "type": "string", "example": "JunkHauler.com" },
          "zip5": { "type": "string", "example": "78701" },
          "estimatedCubicYards": { "type": "number", "example": 5.5 },
          "pickupTruckBedsEquivalent": { "type": "number", "example": 2.8 },
          "matchedTier": { "type": "string", "example": "Half 16-Yd Truck (1-Car Garage)" },
          "guaranteedMaxPriceUsd": {
            "type": "object",
            "required": ["low", "high", "formatted", "dueTodayUsd"],
            "properties": {
              "low": { "type": "integer", "example": 410 },
              "high": { "type": "integer", "example": 430 },
              "formatted": { "type": "string", "example": "$410–$430" },
              "dueTodayUsd": { "type": "integer", "example": 0 }
            }
          },
          "franchiseComparisonUsd": {
            "type": "object",
            "required": ["low", "high", "estimatedSavingsUsd"],
            "properties": {
              "low": { "type": "integer", "example": 515 },
              "high": { "type": "integer", "example": 590 },
              "estimatedSavingsUsd": { "type": "integer", "example": 105 }
            }
          },
          "statutoryModifiersIncluded": {
            "type": "object",
            "required": ["mattresses", "freonUnits", "recyclingFeesUsd"],
            "properties": {
              "mattresses": { "type": "integer", "example": 1 },
              "freonUnits": { "type": "integer", "example": 1 },
              "recyclingFeesUsd": { "type": "integer", "example": 65 }
            }
          },
          "manifest": {
            "type": "array",
            "items": { "type": "string" },
            "example": ["1x Sofa / Couch", "1x Mattress / Box Spring", "1x Refrigerator / Freezer"]
          },
          "guarantee": { "type": "string" },
          "bookingUrl": { "type": "string", "format": "uri", "example": "https://junkhauler.com/quote/?zip=78701&stop=3" }
        }
      },
      "McpJsonRpcRequest": {
        "type": "object",
        "required": ["jsonrpc", "method"],
        "properties": {
          "jsonrpc": { "type": "string", "enum": ["2.0"] },
          "id": { "type": ["integer", "string", "null"], "example": 1 },
          "method": {
            "type": "string",
            "enum": ["initialize", "notifications/initialized", "ping", "tools/list", "tools/call"],
            "example": "tools/call"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "McpJsonRpcResponse": {
        "type": "object",
        "required": ["jsonrpc", "id"],
        "properties": {
          "jsonrpc": { "type": "string", "enum": ["2.0"] },
          "id": { "type": ["integer", "string", "null"], "example": 1 },
          "result": { "type": "object", "additionalProperties": true },
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": { "type": "integer", "example": -32601 },
              "message": { "type": "string", "example": "Unknown tool" }
            }
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "description": "RFC 9457 Problem Details for HTTP APIs.",
        "required": ["type", "title", "status", "code", "message", "detail", "resolution"],
        "properties": {
          "type": { "type": "string", "format": "uri", "example": "https://junkhauler.com/developers/#invalid_zip" },
          "title": { "type": "string", "example": "Invalid 5-Digit U.S. ZIP Code" },
          "status": { "type": "integer", "example": 400 },
          "code": { "type": "string", "example": "INVALID_ZIP" },
          "message": { "type": "string", "example": "Provided zip is not a valid 5-digit U.S. postal code." },
          "detail": { "type": "string", "example": "Provided zip is not a valid 5-digit U.S. postal code." },
          "resolution": { "type": "string", "example": "Pass a 5-digit U.S. ZIP code such as ?zip=78701." },
          "docsUrl": { "type": "string", "format": "uri", "example": "https://junkhauler.com/developers/" }
        }
      }
    }
  }
}
