{
 "openapi": "3.1.0",
 "info": {
  "title": "BokenJapan static data",
  "version": "1.0.0",
  "description": "Read-only static JSON files published on bokenjapan.com (English travel guide to rural and small-town Japan). Plain HTTPS GET, no key, no rate limit beyond normal crawling courtesy. Sources and licences: https://bokenjapan.com/data-sources/",
  "contact": {
   "email": "boken_japan@agentmail.to"
  }
 },
 "servers": [
  {
   "url": "https://bokenjapan.com"
  }
 ],
 "paths": {
  "/data/index.json": {
   "get": {
    "summary": "Dataset entry point: files, schema and counts",
    "operationId": "getDataIndex",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/data/prefectures.json": {
   "get": {
    "summary": "All prefectures with counts and their data file",
    "operationId": "listPrefectures",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/data/{prefecture}.json": {
   "get": {
    "summary": "All towns of one prefecture with their listed places",
    "operationId": "getPrefectureData",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   },
   "parameters": [
    {
     "name": "prefecture",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^[a-z]+$"
     },
     "description": "Prefecture slug, e.g. aomori"
    }
   ]
  },
  "/data/towns/index.json": {
   "get": {
    "summary": "All towns (one row per town page)",
    "operationId": "listTowns",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/data/towns/{prefecture}/{town}.json": {
   "get": {
    "summary": "One town: names, prefecture, geo, official links, counts, sections, Town Pack facts (access, must-see, nearby towns, plans), citation",
    "operationId": "getTown",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Town"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   },
   "parameters": [
    {
     "name": "prefecture",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^[a-z]+$"
     },
     "description": "Prefecture slug, e.g. aomori"
    },
    {
     "name": "town",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
     },
     "description": "Town slug, e.g. ajigasawa"
    }
   ]
  },
  "/data/trip/graph.json": {
   "get": {
    "summary": "Trip graph: towns (lat/lon, car needed, stays) and approximate drive times between nearby towns",
    "operationId": "getTripGraph",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/changes.json": {
   "get": {
    "summary": "Latest page changes from the site history (newest first)",
    "operationId": "listChanges",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/llms.txt": {
   "get": {
    "summary": "Site summary for language models",
    "operationId": "getLlmsTxt",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Town": {
    "type": "object",
    "required": [
     "id",
     "slug",
     "name_en",
     "prefecture",
     "url"
    ],
    "properties": {
     "id": {
      "type": "string",
      "examples": [
       "aomori/ajigasawa"
      ]
     },
     "slug": {
      "type": "string"
     },
     "name_en": {
      "type": [
       "string",
       "null"
      ]
     },
     "name_ja": {
      "type": [
       "string",
       "null"
      ]
     },
     "prefecture": {
      "type": "object",
      "properties": {
       "slug": {
        "type": "string"
       },
       "name_en": {
        "type": "string"
       },
       "url": {
        "type": "string",
        "format": "uri"
       }
      }
     },
     "url": {
      "type": "string",
      "format": "uri"
     },
     "json": {
      "type": "string",
      "format": "uri"
     },
     "jis_code": {
      "type": [
       "string",
       "null"
      ]
     },
     "geo": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "lat": {
        "type": "number"
       },
       "lon": {
        "type": "number"
       },
       "source": {
        "type": [
         "string",
         "null"
        ]
       }
      }
     },
     "official": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "links": {
        "type": "array",
        "items": {
         "type": "object",
         "properties": {
          "label": {
           "type": "string"
          },
          "url": {
           "type": "string"
          }
         }
        }
       },
       "address": {
        "type": [
         "string",
         "null"
        ]
       },
       "phone": {
        "type": [
         "string",
         "null"
        ]
       }
      }
     },
     "counts": {
      "type": "object",
      "additionalProperties": {
       "type": [
        "integer",
        "null"
       ]
      },
      "description": "Cards per section: every card list on the section page and its sub-pages, de-duplicated by name + link; 0 = section does not exist; null = the stay page only lists a neighbouring town"
     },
     "sections": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": {
       "type": "string",
       "format": "uri"
      }
     },
     "sights": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      }
     },
     "lat": {
      "type": [
       "number",
       "null"
      ]
     },
     "lon": {
      "type": [
       "number",
       "null"
      ]
     },
     "coord_src": {
      "type": [
       "string",
       "null"
      ]
     },
     "must_see": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "object",
       "properties": {
        "name": {
         "type": [
          "string",
          "null"
         ]
        },
        "url": {
         "type": [
          "string",
          "null"
         ]
        }
       }
      }
     },
     "access": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "station": {
        "type": [
         "string",
         "null"
        ]
       },
       "station_ja": {
        "type": [
         "string",
         "null"
        ]
       },
       "operator": {
        "type": [
         "string",
         "null"
        ]
       },
       "station_km": {
        "type": [
         "number",
         "null"
        ]
       },
       "station_drive_min": {
        "type": [
         "integer",
         "null"
        ]
       },
       "bus_stops_1km": {
        "type": [
         "integer",
         "null"
        ]
       },
       "car_needed": {
        "type": [
         "string",
         "null"
        ],
        "enum": [
         "no",
         "recommended",
         "yes",
         null
        ]
       }
      }
     },
     "access_line": {
      "type": [
       "string",
       "null"
      ]
     },
     "car_needed": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "no",
       "recommended",
       "yes",
       null
      ]
     },
     "cluster": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": [
          "string",
          "null"
         ]
        },
        "name": {
         "type": [
          "string",
          "null"
         ]
        },
        "url": {
         "type": "string",
         "format": "uri"
        },
        "minutes": {
         "type": [
          "integer",
          "null"
         ]
        },
        "km_straight": {
         "type": [
          "number",
          "null"
         ]
        },
        "stay_count": {
         "type": [
          "integer",
          "null"
         ]
        }
       }
      }
     },
     "plans": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "half_day": {
        "type": [
         "array",
         "null"
        ],
        "items": {
         "type": "object",
         "properties": {
          "kind": {
           "type": [
            "string",
            "null"
           ]
          },
          "name": {
           "type": [
            "string",
            "null"
           ]
          },
          "url": {
           "type": [
            "string",
            "null"
           ]
          },
          "minutes": {
           "type": "integer"
          }
         }
        }
       },
       "one_day": {
        "type": [
         "array",
         "null"
        ],
        "items": {
         "type": "object",
         "properties": {
          "kind": {
           "type": [
            "string",
            "null"
           ]
          },
          "name": {
           "type": [
            "string",
            "null"
           ]
          },
          "url": {
           "type": [
            "string",
            "null"
           ]
          },
          "minutes": {
           "type": "integer"
          }
         }
        }
       },
       "overnight": {
        "type": [
         "array",
         "null"
        ],
        "items": {
         "type": "object",
         "properties": {
          "kind": {
           "type": [
            "string",
            "null"
           ]
          },
          "name": {
           "type": [
            "string",
            "null"
           ]
          },
          "url": {
           "type": [
            "string",
            "null"
           ]
          },
          "minutes": {
           "type": "integer"
          }
         }
        }
       }
      }
     },
     "seasonal": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "object",
       "properties": {
        "season": {
         "type": "string"
        },
        "places": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "name": {
            "type": [
             "string",
             "null"
            ]
           },
           "url": {
            "type": [
             "string",
             "null"
            ]
           }
          }
         }
        }
       }
      }
     },
     "stay_near": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "id": {
        "type": [
         "string",
         "null"
        ]
       },
       "url": {
        "type": "string",
        "format": "uri"
       }
      }
     },
     "townpack": {
      "type": [
       "object",
       "null"
      ],
      "description": "Town Pack version/date and where the fields came from (townpack-output or page)",
      "properties": {
       "version": {
        "type": [
         "integer",
         "null"
        ]
       },
       "date": {
        "type": [
         "string",
         "null"
        ]
       },
       "source": {
        "type": "string",
        "enum": [
         "townpack-output",
         "page"
        ]
       },
       "stay_count": {
        "type": [
         "integer",
         "null"
        ]
       },
       "food_count": {
        "type": [
         "integer",
         "null"
        ]
       }
      }
     },
     "is_based_on": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      }
     },
     "noindex": {
      "type": "boolean"
     },
     "date_modified": {
      "type": [
       "string",
       "null"
      ]
     },
     "last_commit": {
      "type": [
       "string",
       "null"
      ]
     },
     "items_file": {
      "type": "string",
      "format": "uri"
     },
     "citation": {
      "type": "string"
     }
    }
   }
  }
 }
}
