{
  "ok": true,
  "endpoint": "/api/v1/freight-math",
  "mode": "schema_help",
  "description": "Deterministic freight operations math REST endpoint. Pass ?calc=<name> with optional numeric query parameters.",
  "supported_calculations": [
    "deadhead",
    "cpm",
    "operating-ratio",
    "detention",
    "broker-margin"
  ],
  "calculations": {
    "deadhead": {
      "description": "Calculate empty deadhead percentage, total miles, and loaded ratio percentage.",
      "parameters": {
        "loaded": {
          "type": "number",
          "default": 780,
          "minimum": 0,
          "description": "Loaded billable miles"
        },
        "empty": {
          "type": "number",
          "default": 120,
          "minimum": 0,
          "description": "Empty deadhead reposition miles"
        }
      },
      "outputs": [
        "deadhead_pct",
        "total_miles",
        "loaded_ratio_pct"
      ],
      "example_url": "https://strongtoweronline.com/api/v1/freight-math?calc=deadhead&loaded=780&empty=120"
    },
    "cpm": {
      "description": "Calculate fixed cost per mile, total cost per mile, and monthly break-even revenue.",
      "parameters": {
        "fixed_monthly": {
          "type": "number",
          "default": 4800,
          "minimum": 0,
          "description": "Monthly fixed truck and overhead costs (USD)"
        },
        "variable_cpm": {
          "type": "number",
          "default": 1.28,
          "minimum": 0,
          "description": "Variable operating cost per mile (USD/mile)"
        },
        "monthly_miles": {
          "type": "number",
          "default": 9500,
          "exclusiveMinimum": 0,
          "description": "Total monthly operating miles"
        }
      },
      "outputs": [
        "fixed_cpm",
        "total_cpm",
        "break_even_revenue"
      ],
      "example_url": "https://strongtoweronline.com/api/v1/freight-math?calc=cpm&fixed_monthly=4800&variable_cpm=1.28&monthly_miles=9500"
    },
    "operating-ratio": {
      "description": "Calculate motor carrier operating ratio (OR), operating margin percentage, and net operating income.",
      "parameters": {
        "operating_expenses": {
          "type": "number",
          "default": 184000,
          "minimum": 0,
          "description": "Total period operating expenses (USD)"
        },
        "operating_revenue": {
          "type": "number",
          "default": 200000,
          "exclusiveMinimum": 0,
          "description": "Total period operating revenue (USD)"
        }
      },
      "outputs": [
        "operating_ratio_pct",
        "operating_margin_pct",
        "net_operating_income"
      ],
      "example_url": "https://strongtoweronline.com/api/v1/freight-math?calc=operating-ratio&operating_expenses=184000&operating_revenue=200000"
    },
    "detention": {
      "description": "Calculate billable dock detention hours above free time and total detention billing in USD.",
      "parameters": {
        "hours_at_dock": {
          "type": "number",
          "default": 4.5,
          "minimum": 0,
          "description": "Total elapsed hours at shipper or consignee dock"
        },
        "free_hours": {
          "type": "number",
          "default": 2,
          "minimum": 0,
          "description": "Contractual free time hours before detention starts"
        },
        "hourly_rate": {
          "type": "number",
          "default": 75,
          "minimum": 0,
          "description": "Detention billing rate per hour (USD)"
        }
      },
      "outputs": [
        "billable_hours",
        "total_detention_usd"
      ],
      "example_url": "https://strongtoweronline.com/api/v1/freight-math?calc=detention&hours_at_dock=4.5&free_hours=2.0&hourly_rate=75"
    },
    "broker-margin": {
      "description": "Calculate freight brokerage gross margin USD, gross margin percentage, sales rep commission payout, and net brokerage USD.",
      "parameters": {
        "customer_rate": {
          "type": "number",
          "default": 2450,
          "exclusiveMinimum": 0,
          "description": "All-in customer bill rate (USD)"
        },
        "carrier_pay": {
          "type": "number",
          "default": 2050,
          "minimum": 0,
          "description": "All-in carrier linehaul and accessorial buy rate (USD)"
        },
        "rep_commission_pct": {
          "type": "number",
          "default": 15,
          "minimum": 0,
          "maximum": 100,
          "description": "Broker sales rep commission percentage on positive gross margin"
        }
      },
      "outputs": [
        "gross_margin_usd",
        "gross_margin_pct",
        "rep_payout_usd",
        "net_brokerage_usd"
      ],
      "example_url": "https://strongtoweronline.com/api/v1/freight-math?calc=broker-margin&customer_rate=2450&carrier_pay=2050&rep_commission_pct=15"
    }
  },
  "openapi_url": "https://strongtoweronline.com/openapi.json",
  "publisher": {
    "name": "Strong Tower Consulting, LLC",
    "url": "https://strongtoweronline.com/",
    "phone": "763-244-1373",
    "license": "CC-BY-4.0"
  }
}