{
  "openapi": "3.1.0",
  "info": {
    "title": "Cashflow Routes Intelligence API",
    "version": "4.1.0",
    "description": "Sourced sale multiples, owner earnings, and prices, plus reference intelligence, an inspectable comparator, and a deterministic user-weighted Route Fit engine for fifteen cash-generating operating business routes. Every route response carries stable links to its canonical entity, human Article, structured Dataset, and API record. Fit outputs are conditional on disclosed user inputs and are not universal rankings, probabilities, forecasts, valuations, or recommendations."
  },
  "servers": [{ "url": "https://cashflowroutes.com" }],
  "externalDocs": {
    "description": "AI discovery registry, resource relationships, and interpretation policies",
    "url": "https://cashflowroutes.com/registry/index.json"
  },
  "paths": {
    "/api/routes": {
      "get": {
        "operationId": "listCashflowRoutes",
        "summary": "List canonical route profiles and the shared source ledger",
        "responses": {
          "200": {
            "description": "Route registry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Registry" }
              }
            }
          }
        }
      }
    },
    "/api/routes/{slug}": {
      "get": {
        "operationId": "getCashflowRoute",
        "summary": "Get one canonical route profile with its resolved sources",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Route profile",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Route" }
              }
            }
          },
          "404": { "description": "Route not found" }
        }
      }
    },
    "/api/compare": {
      "get": {
        "operationId": "compareCashflowRoutes",
        "summary": "Get the complete inspectable route-comparison model",
        "description": "Returns separate operating dimensions, structural comparison sets, assumptions, primary failure modes, and exit-buyer universes. No composite score or universal ranking is produced.",
        "parameters": [
          {
            "name": "routes",
            "in": "query",
            "required": false,
            "description": "Comma-separated canonical route slugs. Valid selections return up to four matching route records; omit for all routes.",
            "schema": { "type": "string" },
            "example": "laundromat,pool-service,commercial-cleaning"
          }
        ],
        "responses": {
          "200": {
            "description": "Comparator registry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ComparatorRegistry" }
              }
            }
          }
        }
      }
    },
    "/api/fit": {
      "get": {
        "operationId": "getRouteFitModel",
        "summary": "Get the Route Fit input, weighting, constraint, score, and privacy contract",
        "responses": {
          "200": {
            "description": "Route Fit model registry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/FitRegistry" }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "evaluateRouteFit",
        "summary": "Evaluate all routes against explicit capital, owner-time, and preference inputs",
        "description": "Returns deterministic, auditable results for all ten routes. Do not send personal or confidential information.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/FitRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ranked conditional fit results",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/FitResponse" }
              }
            }
          },
          "400": { "description": "Invalid input" }
        }
      }
    },
    "/registry/intelligence-profiles.json": {
      "get": {
        "operationId": "getIntelligenceRegistry",
        "summary": "Download the canonical route registry",
        "responses": {
          "200": {
            "description": "Route registry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Registry" }
              }
            }
          }
        }
      }
    },
    "/registry/route-comparator.json": {
      "get": {
        "operationId": "getComparatorRegistry",
        "summary": "Download the canonical route-comparison registry",
        "responses": {
          "200": {
            "description": "Comparator registry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ComparatorRegistry" }
              }
            }
          }
        }
      }
    },
    "/registry/route-fit.json": {
      "get": {
        "operationId": "getRouteFitRegistry",
        "summary": "Download the canonical Route Fit model contract",
        "responses": {
          "200": {
            "description": "Route Fit model registry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/FitRegistry" }
              }
            }
          }
        }
      }
    },
    "/registry/index.json": {
      "get": {
        "operationId": "discoverCashflowRoutes",
        "summary": "Discover canonical resources, APIs, registries, policies, and stable relationships",
        "responses": {
          "200": {
            "description": "AI discovery registry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DiscoveryRegistry" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Registry": {
        "type": "object",
        "required": ["@id", "schemaVersion", "asOf", "geography", "disclaimer", "dataCatalog", "discovery", "routes", "relationships", "sources"],
        "properties": {
          "@id": { "type": "string", "format": "uri" },
          "schemaVersion": { "type": "string" },
          "asOf": { "type": "string", "format": "date" },
          "geography": { "type": "string" },
          "methodology": { "type": "string", "format": "uri" },
          "disclaimer": { "type": "string" },
          "dataCatalog": { "type": "object" },
          "discovery": { "type": "object" },
          "routes": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Route" }
          },
          "relationships": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/RouteRelationship" }
          },
          "sources": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Source" }
          }
        }
      },
      "Route": {
        "type": "object",
        "required": ["name", "routeUrl", "profileUrl", "apiUrl", "routeEntityId", "articleId", "datasetId", "scenario", "fit", "evidenceConfidence", "sourceIds"],
        "properties": {
          "id": { "type": "string" },
          "route": { "type": "string" },
          "profile": { "type": "string" },
          "name": { "type": "string" },
          "routeUrl": { "type": "string", "format": "uri" },
          "profileUrl": { "type": "string", "format": "uri" },
          "url": { "type": "string", "format": "uri" },
          "apiUrl": { "type": "string", "format": "uri" },
          "routeEntityId": { "type": "string", "format": "uri" },
          "articleId": { "type": "string", "format": "uri" },
          "datasetId": { "type": "string", "format": "uri" },
          "summary": { "type": "string" },
          "classification": { "type": "string" },
          "asOf": { "type": "string", "format": "date" },
          "geography": { "type": "string" },
          "evidenceConfidence": {
            "type": "string",
            "enum": ["High", "Moderate", "Low"]
          },
          "market": {
            "type": "object",
            "description": "Reported market figures (sale multiple, owner earnings, price, larger-deal benchmark, industry facts). Every figure carries a sourceId resolving to the source ledger. Cite the source with the number.",
            "properties": {
              "answer": { "type": "string", "description": "One quotable sentence answering what the business sells for." },
              "multiple": { "$ref": "#/components/schemas/MarketFigure" },
              "earnings": { "$ref": "#/components/schemas/MarketFigure" },
              "price": { "$ref": "#/components/schemas/MarketFigure" },
              "larger": { "$ref": "#/components/schemas/MarketFigure" },
              "facts": { "type": "array", "items": { "$ref": "#/components/schemas/MarketFigure" } },
              "caveat": { "type": "string" }
            }
          },
          "sellerGuideUrl": { "type": "string", "format": "uri", "description": "Owner-side guide: what buyers pay, what moves the price, what must transfer." },
          "scenario": {
            "type": "object",
            "description": "Route Fit comparison inputs set within the reported market figures. Modeling inputs, not market data."
          },
          "fit": { "type": "object" },
          "sourceIds": {
            "type": "array",
            "items": { "type": "string" }
          },
          "relationships": { "type": "object" }
        }
      },
      "MarketFigure": {
        "type": "object",
        "required": ["label", "display", "detail", "sourceId"],
        "properties": {
          "label": { "type": "string" },
          "display": { "type": "string" },
          "detail": { "type": "string" },
          "sourceId": { "type": "string" }
        }
      },
      "RouteRelationship": {
        "type": "object",
        "required": ["route", "profile", "canonicalEntity", "article", "dataset", "API"],
        "properties": {
          "route": { "type": "string" },
          "profile": { "type": "string" },
          "canonicalEntity": { "type": "string", "format": "uri" },
          "article": { "type": "string", "format": "uri" },
          "dataset": { "type": "string", "format": "uri" },
          "API": { "type": "string", "format": "uri" }
        }
      },
      "ComparatorRegistry": {
        "type": "object",
        "required": ["schemaVersion", "asOf", "geography", "disclaimer", "scoringPolicy", "interpretationPolicy", "dimensions", "presets", "routes"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "asOf": { "type": "string", "format": "date" },
          "geography": { "type": "string" },
          "methodology": { "type": "string", "format": "uri" },
          "disclaimer": { "type": "string" },
          "scoringPolicy": {
            "type": "string",
            "description": "Explicitly prohibits a composite score or universal route ranking."
          },
          "interpretationPolicy": {
            "type": "string",
            "description": "Explains that lower and higher cues are selected-set descriptions, not desirability judgments."
          },
          "dimensions": {
            "type": "array",
            "items": {
            "type": "object",
              "required": ["id", "label", "question", "max", "higherMeans", "scale", "classification"]
            }
          },
          "presets": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["id", "label", "description", "slugs", "classification"]
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["slug", "name", "capital", "ownerHours", "metrics", "primaryFailureModes", "exitBuyerUniverse", "routeUrl", "profileUrl", "apiUrl", "routeEntityId", "articleId", "datasetId"]
            }
          }
        }
      },
      "FitRegistry": {
        "type": "object",
        "required": ["schemaVersion", "asOf", "classification", "inputContract", "weighting", "constraintPolicy", "scorePolicy", "privacy", "disclaimer"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "asOf": { "type": "string", "format": "date" },
          "classification": { "type": "string" },
          "inputContract": { "type": "object" },
          "weighting": { "type": "object" },
          "constraintPolicy": { "type": "string" },
          "scorePolicy": { "type": "string" },
          "privacy": { "type": "string" },
          "disclaimer": { "type": "string" }
        }
      },
      "FitRequest": {
        "type": "object",
        "required": ["capitalBudget", "ownerHoursPerWeek"],
        "properties": {
          "capitalBudget": {
            "type": "number",
            "minimum": 25000,
            "maximum": 1000000
          },
          "ownerHoursPerWeek": {
            "type": "number",
            "minimum": 5,
            "maximum": 60
          },
          "preferences": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": ["lower", "neutral", "higher"]
            }
          }
        }
      },
      "FitResponse": {
        "type": "object",
        "required": ["schemaVersion", "asOf", "classification", "inputs", "results", "scorePolicy", "constraintPolicy", "disclaimer"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "asOf": { "type": "string", "format": "date" },
          "classification": { "type": "string" },
          "inputs": { "$ref": "#/components/schemas/FitRequest" },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["rank", "slug", "name", "fitScore", "tier", "constraintConflicts", "reasons", "preferenceTensions", "assumptions", "diligenceQuestions", "criteria", "routeUrl", "profileUrl", "apiUrl", "routeEntityId", "articleId", "datasetId"]
            }
          },
          "scorePolicy": { "type": "string" },
          "constraintPolicy": { "type": "string" },
          "disclaimer": { "type": "string" }
        }
      },
      "DiscoveryRegistry": {
        "type": "object",
        "required": ["@id", "schemaVersion", "asOf", "classification", "baseUrl", "catalogs", "discovery", "APIs", "registries", "routeRelationships", "interpretationPolicy", "retrievalOrder"],
        "properties": {
          "@id": { "type": "string", "format": "uri" },
          "schemaVersion": { "type": "string" },
          "asOf": { "type": "string", "format": "date" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "classification": { "type": "string" },
          "baseUrl": { "type": "string", "format": "uri" },
          "methodology": { "type": "string", "format": "uri" },
          "catalogs": { "type": "object" },
          "discovery": { "type": "object" },
          "APIs": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["id", "method", "returns"]
            }
          },
          "registries": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["id", "endpoint", "schemaVersion"]
            }
          },
          "routeRelationships": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["slug", "profile", "name", "routeUrl", "profileUrl", "apiUrl", "routeEntityId", "articleId", "datasetId", "relationship"]
            }
          },
          "interpretationPolicy": { "type": "object" },
          "retrievalOrder": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "Source": {
        "type": "object",
        "required": ["id", "title", "publisher", "url", "accessed", "kind", "supports"],
        "properties": {
          "id": { "type": "string" },
          "title": { "type": "string" },
          "publisher": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "published": { "type": "string" },
          "accessed": { "type": "string", "format": "date" },
          "kind": { "type": "string" },
          "supports": {
            "type": "array",
            "items": { "type": "string" }
          },
          "caveat": { "type": "string" }
        }
      }
    }
  }
}
