{
  "openapi": "3.1.0",
  "info": {
    "title": "シルギア ナンバープレートの地域名API",
    "version": "1.0.0",
    "description": "登録不要・無料のナンバープレートの地域名API。全138の地域名（うちご当地ナンバー51）の読み・都道府県・交付対象の市区町村と、市区町村（自治体コード5桁・6桁、政令市の区も）からその地域名を返します。登録自動車と軽自動車の地域名は同じです。運輸支局・自動車検査登録事務所との対応は含みません。出典: 国土交通省「ナンバープレートの地域名と市区町村の対応表」を加工して作成（アナライズギア株式会社。国土交通省の公式の API ではありません）。説明: https://api.shirugear.com/plate/ 。v1 の中では項目を足すことはあっても、名前や意味は変えません（知らない項目は無視してください）。",
    "termsOfService": "https://api.shirugear.com/terms/",
    "contact": {
      "name": "アナライズギア株式会社（シルギア）",
      "url": "https://shirugear.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.shirugear.com"
    }
  ],
  "paths": {
    "/plate/v1/{key}.json": {
      "get": {
        "summary": "市区町村 → 地域名（数字5桁・6桁）、または地域名1件（英小文字の id）",
        "operationId": "getPlate",
        "description": "key が自治体コード5桁（または検査数字付き6桁）なら PlateMunicipality、地域名の id なら PlateRegionDetail を返します。",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "自治体コード5桁・6桁、または地域名の id（all.json の id）",
            "schema": {
              "type": "string",
              "pattern": "^([0-9]{5,6}|[a-z]{2,20})$"
            },
            "examples": {
              "municipality": {
                "summary": "新宿区",
                "value": "13104"
              },
              "region": {
                "summary": "富士山",
                "value": "fujisan"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "市区町村の地域名、または地域名1件",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PlateMunicipality"
                    },
                    {
                      "$ref": "#/components/schemas/PlateRegionDetail"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "URLの形が違う（code は invalid_request）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "無い市区町村コード・地域名・都道府県コード（北方領土の6村も 404。code は not_found）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/plate/v1/pref/{pref}.json": {
      "get": {
        "summary": "都道府県の地域名と市区町村",
        "operationId": "getPlatePref",
        "parameters": [
          {
            "name": "pref",
            "in": "path",
            "required": true,
            "description": "都道府県コード2桁（01〜47）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{2}$"
            },
            "example": "13"
          }
        ],
        "responses": {
          "200": {
            "description": "都道府県の地域名",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatePref"
                }
              }
            }
          },
          "400": {
            "description": "URLの形が違う（code は invalid_request）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "無い市区町村コード・地域名・都道府県コード（北方領土の6村も 404。code は not_found）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/plate/v1/all.json": {
      "get": {
        "summary": "全138の地域名（市区町村コードの配列つき）",
        "operationId": "getPlateAll",
        "responses": {
          "200": {
            "description": "全部",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlateAll"
                }
              }
            }
          }
        }
      }
    },
    "/plate/v1/meta.json": {
      "get": {
        "summary": "データの版・出典・件数",
        "operationId": "getPlateMeta",
        "responses": {
          "200": {
            "description": "版と件数",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlateMeta"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PlateShort": {
        "type": "object",
        "required": [
          "id",
          "name",
          "kana",
          "gotochi"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "地域名の id（英小文字）",
            "examples": [
              "shinagawa"
            ]
          },
          "name": {
            "type": "string",
            "description": "ナンバーに書かれる地域名",
            "examples": [
              "品川"
            ]
          },
          "kana": {
            "type": "string",
            "description": "読み（ひらがな）",
            "examples": [
              "しながわ"
            ]
          },
          "gotochi": {
            "type": "boolean",
            "description": "ご当地ナンバーなら true"
          }
        }
      },
      "Municipality": {
        "type": "object",
        "required": [
          "code",
          "code6",
          "name",
          "kind",
          "pref_code",
          "prefecture"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[0-9]{5}$",
            "description": "自治体コード5桁"
          },
          "code6": {
            "type": "string",
            "pattern": "^[0-9]{6}$",
            "description": "検査数字付き6桁"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "city",
              "designated_city",
              "special_ward",
              "town",
              "village",
              "ward"
            ]
          },
          "pref_code": {
            "type": "string",
            "pattern": "^[0-9]{2}$"
          },
          "prefecture": {
            "type": "string"
          }
        }
      },
      "PlateRegion": {
        "type": "object",
        "required": [
          "id",
          "name",
          "kana",
          "gotochi",
          "prefectures",
          "gotochi_round",
          "gotochi_from",
          "design",
          "municipality_count"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "地域名の id（英小文字）",
            "examples": [
              "shinagawa"
            ]
          },
          "name": {
            "type": "string",
            "description": "ナンバーに書かれる地域名",
            "examples": [
              "品川"
            ]
          },
          "kana": {
            "type": "string",
            "description": "読み（ひらがな）",
            "examples": [
              "しながわ"
            ]
          },
          "gotochi": {
            "type": "boolean",
            "description": "ご当地ナンバーなら true"
          },
          "prefectures": {
            "type": "array",
            "description": "地域名がある都道府県（富士山だけ2つ）",
            "items": {
              "type": "object",
              "properties": {
                "pref_code": {
                  "type": "string"
                },
                "prefecture": {
                  "type": "string"
                },
                "coverage": {
                  "type": "string",
                  "enum": [
                    "list",
                    "rest",
                    "all"
                  ],
                  "description": "list=市区町村を並べている／rest=同じ都道府県のほかの地域名の残り全部／all=都道府県内全域"
                },
                "coverage_text": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "coverage が rest・all のときの対応表の書き方（\"弘前及び八戸の交付対象以外\" など）"
                },
                "municipality_count": {
                  "type": "integer"
                }
              }
            }
          },
          "gotochi_round": {
            "type": [
              "integer",
              "null"
            ],
            "description": "ご当地ナンバーの導入の弾（1〜4）"
          },
          "gotochi_from": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]{4}-[0-9]{2}$",
            "description": "ご当地ナンバーの交付が始まった年月"
          },
          "design": {
            "type": "object",
            "properties": {
              "local": {
                "type": "boolean",
                "description": "地方版の図柄入りナンバーがある"
              },
              "prefecture": {
                "type": "boolean",
                "description": "都道府県単位の図柄入りナンバーがある"
              }
            }
          },
          "municipality_count": {
            "type": "integer",
            "description": "交付対象の市区町村の数（政令市は1つ）"
          }
        }
      },
      "PlateMunicipality": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Municipality"
          },
          {
            "type": "object",
            "required": [
              "parent_code",
              "plate",
              "lgcode",
              "data_version"
            ],
            "properties": {
              "parent_code": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "政令市の区なら市のコード"
              },
              "plate": {
                "$ref": "#/components/schemas/PlateShort"
              },
              "lgcode": {
                "type": "string",
                "format": "uri",
                "description": "自治体コードAPIの同じ団体の URL"
              },
              "data_version": {
                "type": "string"
              }
            }
          }
        ]
      },
      "PlateRegionDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlateRegion"
          },
          {
            "type": "object",
            "properties": {
              "kana_source": {
                "type": "string",
                "description": "読みの出典"
              },
              "municipalities": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Municipality"
                }
              },
              "data_version": {
                "type": "string"
              }
            }
          }
        ]
      },
      "PlatePref": {
        "type": "object",
        "properties": {
          "pref_code": {
            "type": "string"
          },
          "prefecture": {
            "type": "string"
          },
          "regions": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/PlateShort"
                },
                {
                  "type": "object",
                  "properties": {
                    "coverage": {
                      "type": "string",
                      "enum": [
                        "list",
                        "rest",
                        "all"
                      ],
                      "description": "list=市区町村を並べている／rest=同じ都道府県のほかの地域名の残り全部／all=都道府県内全域"
                    },
                    "coverage_text": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "coverage が rest・all のときの対応表の書き方（\"弘前及び八戸の交付対象以外\" など）"
                    },
                    "municipalities": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Municipality"
                      }
                    }
                  }
                }
              ]
            }
          },
          "data_version": {
            "type": "string"
          }
        }
      },
      "PlateAll": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "regions": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/PlateRegion"
                },
                {
                  "type": "object",
                  "properties": {
                    "municipalities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "交付対象の市区町村の自治体コード5桁"
                    }
                  }
                }
              ]
            }
          },
          "data_version": {
            "type": "string"
          }
        }
      },
      "PlateMeta": {
        "type": "object",
        "properties": {
          "data_version": {
            "type": "string"
          },
          "built_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "license": {
            "type": "string"
          },
          "lgcode_data_version": {
            "type": "string"
          },
          "counts": {
            "type": "object"
          },
          "gotochi_rounds": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "excluded": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "kana_note": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "status": {
                "type": "integer"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
