{
  "name": "Australian Fuel Data API",
  "version": "2.1",
  "authentication": "API key required. Pass as ?key=YOUR_KEY or X-API-Key header",
  "endpoints": {
    "/": "This help message (no key required)",
    "/brands": "All fuel brands list",
    "/index": "Data index with checksums",
    "/prices": "Compact prices only (~200KB)",
    "/stations": "Station metadata",
    "/cheapest/:fuel": "Top 100 cheapest (e10, u91, u95, u98, diesel, lpg, premiumdiesel, e85, b20, laf, etc)",
    "/tiles": "Geographic tiles index",
    "/tiles/:tile": "Specific tile (e.g., /tiles/lat_-34_lng_150)",
    "/state/:state": "State data (act, nsw, nt, qld, sa, tas, vic, wa)",
    "/full": "Full Australia data (~1.9MB)",
    "/history": "History index (available states + date range)",
    "/history/national": "National daily avg/min/max per fuel type",
    "/history/:state": "State history with city breakdowns (e.g., /history/nsw)",
    "POST /snapshot": "Trigger D1 database snapshot (requires API key)",
    "/d1/stats": "D1 database statistics",
    "/d1/history/:stationCode": "All price changes for a station (?limit=100)",
    "/d1/history/:stationCode/:fuelType": "Price changes for station+fuel (?limit=100&offset=0)",
    "/d1/averages/:state": "Daily averages for all fuels in a state (?days=30)",
    "/d1/averages/:state/:fuelType": "Daily averages for state+fuel (?days=30)",
    "/d1/cheapest/:fuelType": "Cheapest current prices (?limit=20&state=NSW)",
    "/d1/cheapest/:fuelType/:date": "Cheapest on a date, e.g. /d1/cheapest/E10/2026-02-01",
    "/d1/comparison/:fuelType": "Today's avg per state for a fuel type (pre-computed, 1 row read)",
    "POST /d1/history/batch": "Batch station history ({stations:[], fuels:[], limit:100})",
    "POST /d1/report": "Submit station report ({station_code, fuel_type, report_type, reporter_hash, reported_price?})",
    "/d1/reports?codes=X,Y": "Bulk fetch active reports for stations (5-min edge cache)"
  }
}