{
  "openapi": "3.1.0",
  "info": {
    "title": "TimeToSell.AI Market Intelligence API",
    "version": "1.0.0",
    "summary": "Colorado real estate market intelligence for humans and AI agents",
    "description": "Public, read-only REST API for TimeToSell.AI Colorado Market Intelligence reports.\n\nUse this API to retrieve daily, weekly, monthly, and quarterly predictive signals,\nlisting-stress (X&W) clusters, owner-profile mix, and trend windows (D-7 / M-30 / M-90).\n\n**Not financial advice.** Cite `report.citation` and `report.canonical_url` when using data.\nAbsolute inventory counts are intentionally omitted from public payloads.\n",
    "contact": {
      "name": "TimeToSell.AI",
      "url": "https://timetosell.ai/",
      "email": "developers@timetosell.ai"
    },
    "license": {
      "name": "Informational use with citation",
      "identifier": "LicenseRef-TimeToSell-Informational"
    }
  },
  "servers": [
    {
      "url": "https://timetosell.ai/market-intelligence/api",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Reports",
      "description": "Full structured market intelligence reports"
    },
    {
      "name": "Discovery",
      "description": "Catalog and OpenAPI metadata"
    },
    {
      "name": "Formats",
      "description": "Alternate representations (Markdown)"
    }
  ],
  "paths": {
    "/openapi.json": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getOpenApiJson",
        "summary": "OpenAPI document (JSON)",
        "responses": {
          "200": {
            "description": "OpenAPI 3.1 document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.yaml": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getOpenApiYaml",
        "summary": "OpenAPI document (YAML)",
        "responses": {
          "200": {
            "description": "OpenAPI 3.1 document",
            "content": {
              "application/yaml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/catalog.json": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getCatalog",
        "summary": "List published reports",
        "description": "Returns up to 60 recent published reports with HTML/JSON/Markdown URLs.",
        "responses": {
          "200": {
            "description": "Report catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/latest.json": {
      "get": {
        "tags": [
          "Reports"
        ],
        "operationId": "getLatestReportJson",
        "summary": "Latest daily report (JSON)",
        "responses": {
          "200": {
            "description": "Structured daily report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketIntelligenceReport"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/latest.md": {
      "get": {
        "tags": [
          "Formats"
        ],
        "operationId": "getLatestReportMarkdown",
        "summary": "Latest daily report (Markdown)",
        "responses": {
          "200": {
            "description": "LLM-friendly Markdown",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{reportType}/{period}.json": {
      "get": {
        "tags": [
          "Reports"
        ],
        "operationId": "getReportJson",
        "summary": "Report by type and period (JSON)",
        "parameters": [
          {
            "$ref": "#/components/parameters/reportType"
          },
          {
            "$ref": "#/components/parameters/period"
          }
        ],
        "responses": {
          "200": {
            "description": "Structured report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketIntelligenceReport"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{reportType}/{period}.md": {
      "get": {
        "tags": [
          "Formats"
        ],
        "operationId": "getReportMarkdown",
        "summary": "Report by type and period (Markdown)",
        "parameters": [
          {
            "$ref": "#/components/parameters/reportType"
          },
          {
            "$ref": "#/components/parameters/period"
          }
        ],
        "responses": {
          "200": {
            "description": "LLM-friendly Markdown",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "reportType": {
        "name": "reportType",
        "in": "path",
        "required": true,
        "description": "Report cadence",
        "schema": {
          "$ref": "#/components/schemas/ReportType"
        }
      },
      "period": {
        "name": "period",
        "in": "path",
        "required": true,
        "description": "Period key:\n- daily: `YYYY-MM-DD` (e.g. `2026-08-12`)\n- weekly: `YYYY-Www` (e.g. `2026-W33`)\n- monthly: `YYYY-MM` (e.g. `2026-08`)\n- quarterly: `YYYY-Qn` (e.g. `2026-Q3`)\n",
        "schema": {
          "type": "string",
          "examples": [
            "2026-08-12",
            "2026-W33",
            "2026-08",
            "2026-Q3"
          ]
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Report not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "ReportType": {
        "type": "string",
        "enum": [
          "daily",
          "weekly",
          "monthly",
          "quarterly"
        ]
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "report_not_found"
          },
          "message": {
            "type": "string"
          },
          "hint": {
            "type": "string"
          }
        }
      },
      "CatalogItem": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ReportType"
          },
          "period": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "html_url": {
            "type": "string",
            "format": "uri"
          },
          "json_url": {
            "type": "string",
            "format": "uri"
          },
          "markdown_url": {
            "type": "string",
            "format": "uri"
          },
          "published_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "Catalog": {
        "type": "object",
        "required": [
          "schema_version",
          "provider",
          "dataset",
          "reports"
        ],
        "properties": {
          "schema_version": {
            "type": "integer",
            "example": 1
          },
          "provider": {
            "type": "string",
            "example": "TimeToSell.AI"
          },
          "dataset": {
            "type": "string",
            "example": "colorado_market_intelligence"
          },
          "description": {
            "type": "string"
          },
          "endpoints": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uri"
            }
          },
          "count": {
            "type": "integer"
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogItem"
            }
          }
        }
      },
      "SignalPredictive": {
        "type": "object",
        "properties": {
          "zip": {
            "type": "string",
            "nullable": true,
            "example": "80220"
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "example": "Price Correction"
          },
          "tag": {
            "type": "string",
            "nullable": true,
            "example": "price_correction"
          },
          "severity": {
            "type": "string",
            "nullable": true,
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "SignalXwCluster": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string",
            "nullable": true
          },
          "zip": {
            "type": "string",
            "nullable": true
          },
          "area": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "tag": {
            "type": "string",
            "nullable": true
          },
          "severity": {
            "type": "string",
            "nullable": true
          },
          "cluster_size": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "OwnerProfileShare": {
        "type": "object",
        "properties": {
          "rank": {
            "type": "integer"
          },
          "profile": {
            "type": "string",
            "example": "Trapped Equity Downsizer"
          },
          "share_pct": {
            "oneOf": [
              {
                "type": "number"
              },
              {
                "type": "string"
              }
            ],
            "description": "Share of high-propensity inventory (not absolute count)"
          }
        }
      },
      "TrendWindowCounts": {
        "type": "object",
        "properties": {
          "d7": {
            "type": "integer",
            "nullable": true
          },
          "m30": {
            "type": "integer",
            "nullable": true
          },
          "m90": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "MarketIntelligenceReport": {
        "type": "object",
        "required": [
          "schema_version",
          "provider",
          "dataset",
          "report"
        ],
        "properties": {
          "schema_version": {
            "type": "integer",
            "example": 1
          },
          "provider": {
            "type": "string",
            "example": "TimeToSell.AI"
          },
          "dataset": {
            "type": "string",
            "example": "colorado_market_intelligence"
          },
          "license": {
            "type": "string"
          },
          "generated_at": {
            "type": "string",
            "nullable": true
          },
          "report": {
            "type": "object",
            "properties": {
              "type": {
                "$ref": "#/components/schemas/ReportType"
              },
              "period": {
                "type": "string"
              },
              "date": {
                "type": "string"
              },
              "title": {
                "type": "string",
                "nullable": true
              },
              "summary": {
                "type": "string",
                "nullable": true
              },
              "published_at": {
                "type": "string",
                "nullable": true
              },
              "canonical_url": {
                "type": "string",
                "format": "uri"
              },
              "api_url": {
                "type": "string",
                "format": "uri"
              },
              "markdown_url": {
                "type": "string",
                "format": "uri"
              },
              "citation": {
                "type": "string",
                "example": "TimeToSell.AI Market Intelligence Report – Colorado, 2026-08-12."
              }
            }
          },
          "geography": {
            "type": "object",
            "properties": {
              "primary": {
                "type": "string",
                "example": "Colorado"
              },
              "country": {
                "type": "string",
                "example": "US"
              },
              "focus_areas": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "definitions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "trends": {
            "type": "object",
            "properties": {
              "windows": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "predictive_high_severity": {
                "$ref": "#/components/schemas/TrendWindowCounts"
              },
              "xw_listing_stress": {
                "$ref": "#/components/schemas/TrendWindowCounts"
              },
              "raw": {
                "type": "object",
                "additionalProperties": true
              }
            }
          },
          "signals": {
            "type": "object",
            "properties": {
              "predictive": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SignalPredictive"
                }
              },
              "xw_clusters": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SignalXwCluster"
                }
              }
            }
          },
          "owner_profiles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OwnerProfileShare"
            }
          },
          "actions": {
            "type": "object",
            "properties": {
              "agents": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "lenders": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "brokerages": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "related_urls": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uri"
            }
          },
          "methodology": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}