{
  "openapi": "3.1.0",
  "info": {
    "title": "Manabi Map 学校基本情報 API（学校入口の校種）",
    "version": "b00d179d50bf1dda60060b6453f7c29feea4da15",
    "summary": "文部科学省の学校コードと国土数値情報の位置を結び付けた、日本の小学校・中学校・大学・専修学校などの基本情報。",
    "description": "認証は不要で、CORS は全 origin に開いています。実体は固定 URL の静的 JSON なので、検索・絞り込みのパラメータはありません。\n校種ごとに全件または都道府県別に取得して、利用側で絞り込んでください。\nライセンスと出典表記は校種ごとの dataset.json の license・attribution を使ってください。\n高校・高専は高校版のサイトの /api/v1/ で配布しています。",
    "contact": {
      "name": "Manabi Map",
      "url": "https://school.manabi-map.app/data/"
    }
  },
  "servers": [
    {
      "url": "https://school.manabi-map.app"
    }
  ],
  "paths": {
    "/api/v1/dataset.json": {
      "get": {
        "operationId": "listKinds",
        "summary": "配布している校種の一覧",
        "responses": {
          "200": {
            "description": "校種の一覧",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/{kind}/dataset.json": {
      "get": {
        "operationId": "getKindDataset",
        "summary": "校種の収録範囲・ライセンス・配布先",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "校種（例: primary）。",
            "schema": {
              "type": "string",
              "enum": [
                "primary",
                "middle",
                "university",
                "vocational"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "データセットのメタデータ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetMetadata"
                }
              }
            }
          },
          "404": {
            "description": "配布していない校種"
          }
        }
      }
    },
    "/api/v1/{kind}/schools.json": {
      "get": {
        "operationId": "listKindSchools",
        "summary": "校種の収録校を全件取得する",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "校種（例: primary）。",
            "schema": {
              "type": "string",
              "enum": [
                "primary",
                "middle",
                "university",
                "vocational"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "収録校の全件",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SchoolCollection"
                }
              }
            }
          },
          "404": {
            "description": "配布していない校種"
          }
        }
      }
    },
    "/api/v1/{kind}/schools/{prefecture}.json": {
      "get": {
        "operationId": "listKindSchoolsByPrefecture",
        "summary": "校種と都道府県を指定して収録校を取得する",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "校種（例: primary）。",
            "schema": {
              "type": "string",
              "enum": [
                "primary",
                "middle",
                "university",
                "vocational"
              ]
            }
          },
          {
            "name": "prefecture",
            "in": "path",
            "required": true,
            "description": "都道府県のローマ字 slug（例: gunma）。",
            "schema": {
              "type": "string",
              "enum": [
                "aichi",
                "akita",
                "aomori",
                "chiba",
                "ehime",
                "fukui",
                "fukuoka",
                "fukushima",
                "gifu",
                "gunma",
                "hiroshima",
                "hokkaido",
                "hyogo",
                "ibaraki",
                "ishikawa",
                "iwate",
                "kagawa",
                "kagoshima",
                "kanagawa",
                "kochi",
                "kumamoto",
                "kyoto",
                "mie",
                "miyagi",
                "miyazaki",
                "nagano",
                "nagasaki",
                "nara",
                "niigata",
                "oita",
                "okayama",
                "okinawa",
                "osaka",
                "saga",
                "saitama",
                "shiga",
                "shimane",
                "shizuoka",
                "tochigi",
                "tokushima",
                "tokyo",
                "tottori",
                "toyama",
                "wakayama",
                "yamagata",
                "yamaguchi",
                "yamanashi"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "指定した都道府県の収録校",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrefectureSchoolCollection"
                }
              }
            }
          },
          "404": {
            "description": "収録校の無い都道府県"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DatasetMetadata": {
        "type": "object",
        "required": [
          "api_version",
          "kind",
          "generated_at",
          "school_count",
          "prefecture_count",
          "prefectures",
          "license",
          "attribution"
        ],
        "additionalProperties": true,
        "properties": {
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "kind": {
            "type": "string"
          },
          "generated_at": {
            "type": "string"
          },
          "school_count": {
            "type": "integer"
          },
          "prefecture_count": {
            "type": "integer"
          },
          "prefectures": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "license": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          }
        }
      },
      "SchoolCollection": {
        "type": "object",
        "required": [
          "api_version",
          "kind",
          "generated_at",
          "count",
          "schools"
        ],
        "properties": {
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "kind": {
            "type": "string"
          },
          "generated_at": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "schools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/School"
            }
          }
        },
        "additionalProperties": true
      },
      "PrefectureSchoolCollection": {
        "type": "object",
        "required": [
          "api_version",
          "kind",
          "generated_at",
          "prefecture",
          "count",
          "schools"
        ],
        "properties": {
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "kind": {
            "type": "string"
          },
          "generated_at": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "schools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/School"
            }
          },
          "prefecture": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "School": {
        "type": "object",
        "required": [
          "record_key",
          "school_code",
          "name",
          "prefecture",
          "campuses",
          "provenance"
        ],
        "additionalProperties": true,
        "properties": {
          "record_key": {
            "type": "string",
            "description": "mext-<学校コード> 形式の安定キー。"
          },
          "school_code": {
            "type": "string",
            "description": "文部科学省の学校コード（13桁）。"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          },
          "ownership": {
            "type": [
              "string",
              "null"
            ]
          },
          "branch": {
            "type": [
              "string",
              "null"
            ]
          },
          "prefecture": {
            "type": "string",
            "description": "本部（文部科学省の所在地）の都道府県名。"
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": "string"
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "latitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "longitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "campuses": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "provenance": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    }
  }
}
