{
  "openapi": "3.1.0",
  "info": {
    "title": "WeatherXM FACT Historical Benchmark",
    "version": "2.1.0",
    "description": "Read-only 2025 benchmark scoring all 45 NWP & AI forecast models (WeatherXM MOSAIC [MOSAIC], meteoblue [METEOBLUE], meteoblue station-mLM [mLM], ECMWF IFS [IFS025, IFSHRES], ECMWF AIFS AI [AIFS025], NOAA GFS [GFS05, GFS025], NOAA HRRR [HRRR], NOAA National Blend of Models [NBM], NOAA NAM [NAM3, NAM5, NAM12, NAMAK], DWD ICON [ICON, ICONEU, ICOND2], UK Met Office [UMGLOBAL10, UKMO2], ECCC GEM [GEM15, GEM2], Meteo-France ARPEGE/AROME [MFGLOBAL, MFEU, MFFR], COSMO [COSMOI2, COSMOM5], HARMONIE-AROME [HARMONIE], JMA MSM [MSM], WRF [WRFGR, WRFAMS], meteoblue NEMS/NMM [NEMSGLOBAL, NEMSGLOBAL_E, NEMS4, NEMS12, NEMS12_E, NEMSAF01, NEMSAS02, NEMSCAM, NEMSIN, NEMSNZ, NEMSSA, NMM4, NMM22], and regional AF01, AS01, SA01) against 8,927 quality-checked physical WeatherXM ground stations."
  },
  "servers": [
    {
      "url": "https://fact.weatherxm.com",
      "description": "WeatherXM FACT Production Server"
    }
  ],
  "paths": {
    "/api/v1/fact/best-model": {
      "get": {
        "operationId": "getBestForecastModel",
        "summary": "Read the published historical cell or station champion across all 45 weather forecast models. Provide (lat, lon) or station_or_report_id.",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lon",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "station_or_report_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            },
            "description": "Optional WeatherXM station UUID or custom site evaluation report ID (e.g. STUDY-...)"
          },
          {
            "name": "variable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "temperature",
                "wind_speed",
                "wind_direction",
                "precipitation",
                "humidity"
              ],
              "default": "temperature"
            }
          },
          {
            "name": "lead_day",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "0",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
              ]
            }
          },
          {
            "name": "exclude_commissioned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical results and provenance with explicit unknowns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported query",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "Index unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "description": "Returns all-hours cell champion plus, for wind_direction, the >3 m/s raw-sensor active-wind subset and, for wind_speed, the optional windier-days subset. wind_speed defaults to all hours; the optional wind_speed_windier_days subset (scaled daily-mean observed speed >= 3 m/s, exact distinct station/station-day counts) is returned separately and is not a height correction or preferred ranking."
      }
    },
    "/api/v1/fact/blind-spot": {
      "get": {
        "operationId": "checkGroundTruthCoverage",
        "summary": "Check historical publication coverage for a coordinate or station_or_report_id, plus interactive map deep-link and WeatherXM station overview link (weatherxm.com/stations).",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lon",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "station_or_report_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "variable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "temperature",
                "wind_speed",
                "wind_direction",
                "precipitation",
                "humidity"
              ],
              "default": "temperature"
            }
          },
          {
            "name": "lead_day",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "0",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
              ]
            }
          },
          {
            "name": "exclude_commissioned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical results and provenance with explicit unknowns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported query",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "Index unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fact/coverage": {
      "get": {
        "operationId": "checkGroundTruthCoverageAlias",
        "summary": "Alias of /api/v1/fact/blind-spot — check historical publication coverage for a coordinate or station_or_report_id.",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lon",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "station_or_report_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "variable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "temperature",
                "wind_speed",
                "wind_direction",
                "precipitation",
                "humidity"
              ],
              "default": "temperature"
            }
          },
          {
            "name": "lead_day",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "0",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
              ]
            }
          },
          {
            "name": "exclude_commissioned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical results and provenance with explicit unknowns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported query",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "Index unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fact/leaderboard": {
      "get": {
        "operationId": "getFactLeaderboard",
        "summary": "Global curves across all 45 models at a specific lead (default 1), or country cell-win summaries at all (default for country).",
        "parameters": [
          {
            "name": "variable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "temperature",
                "wind_speed",
                "wind_direction",
                "precipitation",
                "humidity"
              ],
              "default": "temperature"
            }
          },
          {
            "name": "lead_day",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "0",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
              ]
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "exclude_commissioned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 45,
              "default": 45
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical results and provenance with explicit unknowns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported query",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "Index unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "description": "Default leaderboard ranks all models with published curves (unchanged). coverage_split adds a broad/limited evaluated-record coverage proxy (>=60% of max records), which is not a matched cohort or a model-domain test. wind_speed defaults to all hours; the optional wind_speed_windier_days subset (scaled daily-mean observed speed >= 3 m/s, exact distinct station/station-day counts) is returned separately and is not a height correction or preferred ranking."
      }
    },
    "/api/v1/fact/compare": {
      "get": {
        "operationId": "getModelHeadToHead",
        "summary": "Global source-specific error curves and optional local H3 cell (lat/lon) or country comparisons across any of the 45 FACT models.",
        "parameters": [
          {
            "name": "variable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "temperature",
                "wind_speed",
                "wind_direction",
                "precipitation",
                "humidity"
              ],
              "default": "temperature"
            }
          },
          {
            "name": "models",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated canonical IDs, at most ten."
            }
          },
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lon",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "lead_day",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "0",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
              ]
            }
          },
          {
            "name": "exclude_commissioned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical results and provenance with explicit unknowns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported query",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "Index unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "description": "For wind_speed, models[].lead_days_windier_days carries the optional windier-days subset curves next to all-hours lead_days."
      }
    },
    "/api/v1/fact/head-to-head": {
      "get": {
        "operationId": "getModelHeadToHeadAlias",
        "summary": "Alias of /api/v1/fact/compare — global source-specific error curves and optional local H3 cell (lat/lon) or country comparisons.",
        "parameters": [
          {
            "name": "variable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "temperature",
                "wind_speed",
                "wind_direction",
                "precipitation",
                "humidity"
              ],
              "default": "temperature"
            }
          },
          {
            "name": "models",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated canonical IDs, at most ten."
            }
          },
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lon",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "lead_day",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "0",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
              ]
            }
          },
          {
            "name": "exclude_commissioned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical results and provenance with explicit unknowns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported query",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "Index unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "description": "For wind_speed, models[].lead_days_windier_days carries the optional windier-days subset curves next to all-hours lead_days."
      }
    },
    "/api/v1/fact/contact": {
      "post": {
        "operationId": "requestForecastAccess",
        "summary": "Submit a forecast API, station deployment, or enterprise benchmark inquiry",
        "description": "Stores the inquiry in FACT D1 and routes notifications to the WeatherXM team (Slack & sales@weatherxm.com).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "use_case"],
                "properties": {
                  "email": { "type": "string", "maxLength": 160 },
                  "use_case": { "type": "string", "enum": ["forecast_api", "deploy_station", "enterprise_data", "custom_benchmark", "partnership"] },
                  "name": { "type": "string", "maxLength": 120 },
                  "organization": { "type": "string", "maxLength": 160 },
                  "lat": { "type": "number", "minimum": -90, "maximum": 90 },
                  "lon": { "type": "number", "minimum": -180, "maximum": 180 },
                  "variable": { "type": "string", "enum": ["temperature", "wind_speed", "wind_direction", "precipitation", "humidity"] },
                  "winning_model": { "type": "string", "maxLength": 60 },
                  "notes": { "type": "string", "maxLength": 1500 }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Inquiry received",
            "content": {
              "application/json": {
                "schema": { "type": "object", "additionalProperties": true }
              }
            }
          },
          "400": {
            "description": "Invalid inquiry payload",
            "content": {
              "application/json": {
                "schema": { "type": "object", "additionalProperties": true }
              }
            }
          }
        }
      }
    }
  }
}
