{
  "openapi": "3.1.0",
  "info": {
    "title": "BoxAudit Shipping Box Suite Optimizer API",
    "version": "1.4.2",
    "description": "Deterministic 3D packing and USPS Notice 123 (2026-10-04) Commercial Cubic / DIM-139 API."
  },
  "x-service-info": {
    "categories": [
      "shipping",
      "logistics",
      "ecommerce",
      "optimization"
    ],
    "docs": {
      "homepage": "https://getboxaudit.com",
      "llms": "https://getboxaudit.com/llms.txt"
    }
  },
  "servers": [
    {
      "url": "https://getboxaudit.com"
    }
  ],
  "paths": {
    "/api/healthz": {
      "get": {
        "summary": "Service and D1 health check",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/audit": {
      "post": {
        "summary": "Run 3D bin-packing box-suite audit preview",
        "responses": {
          "200": {
            "description": "Redacted audit teaser"
          },
          "413": {
            "description": "Payload exceeds 2 MB"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/api/checkout": {
      "post": {
        "summary": "Create $49 USD Stripe Checkout session",
        "x-payment-info": {
          "intent": "charge",
          "method": "stripe",
          "amount": "49.00",
          "currency": "USD",
          "description": "One-off 90-day 4-6 box procurement plan and per-order replay CSV"
        },
        "responses": {
          "200": {
            "description": "Stripe Checkout URL"
          },
          "400": {
            "description": "Invalid audit or savings below $49"
          },
          "404": {
            "description": "Audit not found"
          },
          "409": {
            "description": "Already paid or refunded"
          },
          "502": {
            "description": "Upstream Stripe API error"
          },
          "503": {
            "description": "Stripe not configured"
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "summary": "Streamable HTTP MCP JSON-RPC 2.0 endpoint (initialize, tools/list, tools/call)",
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response"
          },
          "202": {
            "description": "Notification accepted"
          },
          "400": {
            "description": "Parse error or invalid JSON-RPC request"
          }
        }
      }
    },
    "/api/tools/box-leak": {
      "post": {
        "operationId": "compareBoxLeak",
        "summary": "Check USPS Cubic outer-wall tier bumps, UPS/FedEx DIM-139 weight, and 90-day box savings",
        "responses": {
          "200": {
            "description": "Box leak comparison and optimal smaller standard box"
          },
          "400": {
            "description": "Invalid dimensions, weight, or zone"
          }
        }
      }
    },
    "/api/v1": {
      "get": {
        "summary": "HTTP 402 Stripe Checkout payment discovery challenge",
        "x-payment-info": {
          "intent": "charge",
          "method": "stripe",
          "amount": "49.00",
          "currency": "USD",
          "description": "BoxAudit 90-day full box-suite audit unlock"
        },
        "responses": {
          "402": {
            "description": "Payment required"
          }
        }
      }
    }
  }
}