{
  "openapi": "3.0.3",
  "info": {
    "title": "Half Mile Hail API",
    "version": "1.1.0",
    "summary": "Free, keyless hail data for any US address, from NOAA radar.",
    "description": "Radar-detected hail for any US address or coordinate, from NOAA. **No API key, no account, no\nregistration.** CORS is open to `*`, so it works from a browser.\n\n## Two different resolutions, and the difference matters\n\n| Endpoint | Grid | Covers | Answers |\n| --- | --- | --- | --- |\n| `/hail-history` | 0.1°, ~7 miles | 1992 to now | Has hail ever been detected near here, and how often |\n| `/precise-hail` | 0.01°, ~0.7 miles | last 24h + current scan | What the radar estimated over this block, and when |\n| `/recent-hail` | a point | last 48h | What a person actually reported seeing |\n\n`/precise-hail` returns **two figures, deliberately kept apart**: `atAddressInches` is the single\n~0.7 mile cell the coordinate falls in, and `nearbyMaxInches` is the largest value anywhere in the\n~2.8 mile block around it. The second is always the larger. Anything that reports one number at\nthis resolution is showing you the second and calling it the first.\n\n## What this is not\n\nMESH and SWDI are **radar estimates, not observations**. They tell you where an estimate applies,\nnever what is on a roof. Nothing here is proof of damage, an insurance report, or an engineering\nassessment. A zero means the radar did not estimate hail, which is an absence of evidence and not\nevidence of absence.\n\n## Rate limits\n\nNone documented, which is not the same as none existing. Please pace requests and identify your\ntool in a `User-Agent` header.",
    "contact": {
      "name": "Half Mile Hail",
      "url": "https://halfmilehail.com",
      "email": "hello@halfmilehail.com"
    },
    "license": {
      "name": "Underlying data: US Government work, public domain",
      "url": "https://www.noaa.gov/information-technology/open-data-dissemination"
    }
  },
  "servers": [
    {
      "url": "https://halfmilehail.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Human-readable API docs",
    "url": "https://halfmilehail.com/api-docs.html"
  },
  "tags": [
    {
      "name": "hail",
      "description": "Radar-detected and human-reported hail"
    },
    {
      "name": "meta",
      "description": "Service description"
    }
  ],
  "paths": {
    "/hail-history": {
      "get": {
        "tags": [
          "hail"
        ],
        "operationId": "hailHistory",
        "summary": "Every year radar detected hail near an address, since 1992",
        "description": "Rolled up per calendar year for the 0.1° tile (~7 miles) containing the point. Supply either `address` or both `lat` and `lon`. A hail day means radar detected hail somewhere in that tile, not that hail fell on a specific building.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "US one-line address. Mutually exclusive with lat/lon."
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "Latitude, decimal degrees. Required unless `address` is given."
          },
          {
            "name": "lon",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "Longitude, decimal degrees. Required unless `address` is given."
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Start year, inclusive. Clamped to 1992."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "End year, inclusive. Clamped to the current year."
          },
          {
            "name": "detail",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`none` (default), `top`, or a specific `YYYY-MM-DD`."
          }
        ],
        "responses": {
          "200": {
            "description": "Hail history for the tile containing the point.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "object"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "matchedAddress": {
                          "type": "string",
                          "nullable": true
                        },
                        "lat": {
                          "type": "number"
                        },
                        "lon": {
                          "type": "number"
                        },
                        "county": {
                          "type": "string",
                          "nullable": true
                        },
                        "countyFips": {
                          "type": "string",
                          "nullable": true
                        },
                        "zip": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    },
                    "searchArea": {
                      "type": "object",
                      "description": "The tile actually queried, in degrees and miles."
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "hailDays": {
                          "type": "integer",
                          "description": "Distinct days hail was detected."
                        },
                        "totalRadarDetections": {
                          "type": "integer"
                        },
                        "yearsWithHail": {
                          "type": "integer"
                        },
                        "avgHailDaysPerYear": {
                          "type": "number"
                        },
                        "frequencyBand": {
                          "type": "string",
                          "description": "Plain-language band, with its thresholds returned alongside."
                        },
                        "mostRecentHailDay": {
                          "type": "string",
                          "nullable": true,
                          "format": "date"
                        },
                        "perYear": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "retrievedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. The body explains what was missing or wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/precise-hail": {
      "get": {
        "tags": [
          "hail"
        ],
        "operationId": "preciseHail",
        "summary": "Hail estimated over one address in the last 24 hours, on a ~1km grid",
        "description": "NOAA MRMS MESH, refreshed roughly every two minutes. Returns the last-24-hour running maximum and the current scan. **Read `atAddressInches` and `nearbyMaxInches` as different questions**: the first is the single ~0.7 mile cell containing the point, the second is the largest reading anywhere in the ~2.8 mile block around it.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "US one-line address. Mutually exclusive with lat/lon."
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "Latitude, decimal degrees. Required unless `address` is given."
          },
          {
            "name": "lon",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "Longitude, decimal degrees. Required unless `address` is given."
          }
        ],
        "responses": {
          "200": {
            "description": "Hail estimate at, and around, the point.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "object"
                    },
                    "resolution": {
                      "type": "object",
                      "properties": {
                        "degrees": {
                          "type": "number"
                        },
                        "cellKm": {
                          "type": "number"
                        },
                        "cellMiles": {
                          "type": "number"
                        },
                        "neighbourhoodCells": {
                          "type": "string",
                          "example": "5x5"
                        },
                        "neighbourhoodSpanMiles": {
                          "type": "number"
                        },
                        "readThis": {
                          "type": "string",
                          "description": "Plain-language statement of what each figure means."
                        }
                      }
                    },
                    "last24Hours": {
                      "type": "object",
                      "properties": {
                        "atAddressInches": {
                          "type": "number",
                          "nullable": true,
                          "description": "Estimated hail size in inches."
                        },
                        "nearbyMaxInches": {
                          "type": "number",
                          "nullable": true,
                          "description": "Estimated hail size in inches."
                        },
                        "anyHail": {
                          "type": "boolean"
                        },
                        "cellsWithHail": {
                          "type": "integer"
                        },
                        "cellsCovered": {
                          "type": "integer"
                        },
                        "inCoverage": {
                          "type": "boolean"
                        },
                        "observedUtc": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "product": {
                          "type": "string"
                        }
                      }
                    },
                    "rightNow": {
                      "type": "object",
                      "properties": {
                        "atAddressInches": {
                          "type": "number",
                          "nullable": true,
                          "description": "Estimated hail size in inches."
                        },
                        "nearbyMaxInches": {
                          "type": "number",
                          "nullable": true,
                          "description": "Estimated hail size in inches."
                        },
                        "anyHail": {
                          "type": "boolean"
                        },
                        "observedUtc": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "ageMinutes": {
                          "type": "number",
                          "nullable": true
                        },
                        "product": {
                          "type": "string"
                        }
                      }
                    },
                    "degraded": {
                      "type": "boolean",
                      "description": "True when upstream MRMS was unreachable. NOT a finding that no hail fell."
                    },
                    "honesty": {
                      "type": "object",
                      "description": "What this measurement is and is not."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. The body explains what was missing or wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/recent-hail": {
      "get": {
        "tags": [
          "hail"
        ],
        "operationId": "recentHail",
        "summary": "Hail people actually reported in the last 48 hours",
        "description": "NWS Local Storm Reports: a person or a mesonet station saw hail at a point and measured it. Ground truth rather than radar. Reports depend on somebody being there, so an absence near you does not mean no hail fell.",
        "parameters": [
          {
            "name": "hours",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 48
            },
            "description": "Look-back window in hours."
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Two-letter state code to filter by."
          }
        ],
        "responses": {
          "200": {
            "description": "Reported hail in the window.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "object",
                      "properties": {
                        "hours": {
                          "type": "integer"
                        },
                        "state": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "reportCount": {
                          "type": "integer"
                        },
                        "totalInWindow": {
                          "type": "integer"
                        },
                        "truncated": {
                          "type": "boolean"
                        },
                        "statesAffected": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "largestInches": {
                          "type": "number",
                          "nullable": true,
                          "description": "Estimated hail size in inches."
                        },
                        "reports": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "observedUtc": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "sizeInches": {
                                "type": "number"
                              },
                              "sizeCoin": {
                                "type": "string",
                                "description": "Coin comparison, e.g. \"golf ball\"."
                              },
                              "place": {
                                "type": "string"
                              },
                              "county": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string"
                              },
                              "lat": {
                                "type": "number"
                              },
                              "lon": {
                                "type": "number"
                              },
                              "source": {
                                "type": "string"
                              },
                              "nwsOffice": {
                                "type": "string"
                              },
                              "remark": {
                                "type": "string",
                                "nullable": true
                              }
                            }
                          }
                        }
                      }
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "retrievedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. The body explains what was missing or wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "meta"
        ],
        "operationId": "health",
        "summary": "Service description and endpoint list",
        "responses": {
          "200": {
            "description": "Service metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}
