{"openapi":"3.1.0","info":{"title":"Queria Places Search","version":"0.1.0","description":"日本の地名 (都道府県・市区町村・町字)・駅・施設を引く無料の API。合併などで無くなった旧市町村は検索に出さず、/v1/places/{place_id} でだけ引ける。API キーは不要。\n\n- `GET /v1/autocomplete`: 入力の途中から候補を返す\n- `GET /v1/search`: 文字で場所を検索し、近い順に寄せて返す\n- `GET /v1/nearby`: 座標の周りの場所を近い順に返す\n- `GET /v1/places/{place_id}`: ID から詳細を返す\n- `POST /v1/places/batch`: ID から詳細を 100 件までまとめて返す\n\n1 つの IP アドレスから 1 分に 600 回まで。結果を公開するときは `source.attribution` の出典も表示する。\n\n場所の ID は、元のデータのコード (駅・町字・学校・避難場所・Overture の ID) か、市区町村コードと名前 (医療機関・公共施設・福祉施設は一覧の住所も) から作る。データを更新しても同じ場所は同じ ID のままで、名前か市区町村 (と住所) が変わったときだけ変わる。\n\n`info.version` はセマンティックバージョニングで付ける。1.0.0 より前は互換性を約束しない。"},"components":{"schemas":{"AutocompleteResponse":{"type":"object","properties":{"places":{"type":"array","items":{"$ref":"#/components/schemas/Suggestion"}},"source":{"$ref":"#/components/schemas/Source"}},"required":["places","source"]},"Suggestion":{"type":"object","properties":{"place_id":{"type":["string","null"],"description":"場所の ID (UUID)。/v1/places/{place_id} で詳細を引ける。Overture の施設は GERS ID、ほかは元のデータのコードから作る UUID v5。住所の候補のうち番地と丁目は ID を持たず null (住所の文字列と座標を保存する)","example":"9e393e15-cdb7-576e-8f7a-667184a7e349"},"name":{"type":"string"},"address":{"type":["string","null"],"description":"所在地 (都道府県から市区町村まで)"},"kind":{"type":"string","enum":["prefecture","city","former_city","town","station","poi","address"],"description":"address はジオコーダーから足した住所の候補"},"type":{"type":"string","description":"場所の種類 (train_station・bus_stop・hospital など)"},"lat":{"type":"number"},"lng":{"type":"number"}},"required":["place_id","name","address","kind","type","lat","lng"]},"Source":{"type":"object","properties":{"dataset":{"type":"string"},"version":{"type":"string","description":"答えに使ったデータのバージョン"},"attribution":{"type":"array","items":{"type":"string"},"description":"出典の表示。結果を公開するときは一緒に表示する"}},"required":["dataset","version","attribution"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"SearchResponse":{"type":"object","properties":{"places":{"type":"array","items":{"$ref":"#/components/schemas/Suggestion"}},"source":{"$ref":"#/components/schemas/Source"}},"required":["places","source"]},"NearbyResponse":{"type":"object","properties":{"places":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Suggestion"},{"type":"object","properties":{"distance_m":{"type":"integer","description":"中心からの距離 (m)"}},"required":["distance_m"]}]}},"source":{"$ref":"#/components/schemas/Source"}},"required":["places","source"]},"PlaceResponse":{"type":"object","properties":{"place":{"$ref":"#/components/schemas/Place"},"source":{"$ref":"#/components/schemas/Source"}},"required":["place","source"]},"Place":{"allOf":[{"$ref":"#/components/schemas/Suggestion"},{"type":"object","properties":{"country":{"type":"string","description":"国 (ISO 3166-1 alpha-2)","example":"JP"},"source_type":{"type":"string","description":"出典の種類 (pref・city・town・former・station・school・overture・poi など)","example":"station"},"source_id":{"type":"string","description":"出典でのコード (駅のグループコード、Overture の GERS ID など)","example":"003766"},"reading":{"type":["string","null"],"description":"読み (カタカナ)"},"lg_code":{"type":["string","null"],"description":"所在する市区町村の地方公共団体コード (6 桁、検査数字つき)"},"lines":{"type":["array","null"],"items":{"type":"string"},"description":"駅の路線"}},"required":["country","source_type","source_id","reading","lg_code","lines"]}]},"PlacesBatchResponse":{"type":"object","properties":{"results":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"place":{"$ref":"#/components/schemas/Place"}},"required":["place"]},{"$ref":"#/components/schemas/Error"}]}},"source":{"$ref":"#/components/schemas/Source"}},"required":["results","source"]},"PlacesBatchRequest":{"type":"object","properties":{"place_ids":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"minItems":1,"maxItems":100}},"required":["place_ids"]}},"parameters":{}},"paths":{"/v1/autocomplete":{"get":{"summary":"入力の途中から場所の候補を返す","description":"地名・駅・施設を、入力の途中・ひらがなの読み・表記の揺れ (ヶとケ、全角と半角など) から引く。空白で区切った複数の語は、1 つの語で引き、ほかの語が名前か所在地に含まれる候補に絞る。lat と lng を渡すと、近い候補を先に並べる。住所の途中 (「千代田区紀尾井町1」) は Queria Geocoder の /v1/autocomplete で引き、場所の候補の後ろに kind が address の候補として足す (同じ都道府県・市区町村・町字は 1 件にする)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"example":"しんじゅく","description":"入力の途中。100 文字まで"},"required":true,"description":"入力の途中。100 文字まで","name":"q","in":"query"},{"schema":{"type":"number"},"required":false,"name":"lat","in":"query"},{"schema":{"type":"number"},"required":false,"name":"lng","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"この種類の場所だけを返す。type=train_station&type=bus_stop のように繰り返す"},"required":false,"description":"この種類の場所だけを返す。type=train_station&type=bus_stop のように繰り返す","name":"type","in":"query","style":"form","explode":true},{"schema":{"type":"integer","description":"1〜20。既定は 10"},"required":false,"description":"1〜20。既定は 10","name":"limit","in":"query"}],"responses":{"200":{"description":"候補を並べた順に返す","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutocompleteResponse"}}}},"400":{"description":"パラメータが不正","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"リクエストの回数が上限 (1 つの IP アドレスから 1 分に 600 回まで) を超えた","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"索引を読めない","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/search":{"get":{"summary":"文字で場所を検索し、近い順に寄せて返す","description":"/v1/autocomplete と同じ索引 (名前・読み・名前の途中の語の頭から) で引き、住所の候補も同じく後ろに足す。lat と lng を渡すと、近さを autocomplete より強く効かせて並べる (距離 10 倍ごとに 2 点)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"example":"附属病院","description":"検索する文字。100 文字まで"},"required":true,"description":"検索する文字。100 文字まで","name":"q","in":"query"},{"schema":{"type":"number"},"required":false,"name":"lat","in":"query"},{"schema":{"type":"number"},"required":false,"name":"lng","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"この種類の場所だけを返す。type=train_station&type=bus_stop のように繰り返す"},"required":false,"description":"この種類の場所だけを返す。type=train_station&type=bus_stop のように繰り返す","name":"type","in":"query","style":"form","explode":true},{"schema":{"type":"integer","description":"1〜20。既定は 10"},"required":false,"description":"1〜20。既定は 10","name":"limit","in":"query"}],"responses":{"200":{"description":"並べた順","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"400":{"description":"パラメータが不正","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"リクエストの回数が上限 (1 つの IP アドレスから 1 分に 600 回まで) を超えた","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"索引を読めない","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/nearby":{"get":{"summary":"座標の周りの場所を近い順に返す","description":"中心から半径 radius (m) の中の場所を近い順に返す。最寄りの駅は type=train_station、避難場所は type=evacuation_site のように種類で絞る。半径は 5000 m まで。公的な一覧に無い種類 (飲食店など) を含むとき (type を渡さないときも) は 1000 m まで","parameters":[{"schema":{"type":"number"},"required":false,"name":"lat","in":"query"},{"schema":{"type":"number"},"required":false,"name":"lng","in":"query"},{"schema":{"type":"integer","description":"半径 (m)。既定は 500"},"required":false,"description":"半径 (m)。既定は 500","name":"radius","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"この種類の場所だけを返す。type=train_station&type=bus_stop のように繰り返す"},"required":false,"description":"この種類の場所だけを返す。type=train_station&type=bus_stop のように繰り返す","name":"type","in":"query","style":"form","explode":true},{"schema":{"type":"integer","description":"1〜20。既定は 10"},"required":false,"description":"1〜20。既定は 10","name":"limit","in":"query"}],"responses":{"200":{"description":"近い順","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NearbyResponse"}}}},"400":{"description":"パラメータが不正","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"リクエストの回数が上限 (1 つの IP アドレスから 1 分に 600 回まで) を超えた","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"索引を読めない","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/places/{place_id}":{"get":{"summary":"ID から場所の詳細を返す","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"example":"9e393e15-cdb7-576e-8f7a-667184a7e349"},"required":true,"name":"place_id","in":"path"}],"responses":{"200":{"description":"場所の詳細","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceResponse"}}}},"404":{"description":"その ID の場所が無い","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"リクエストの回数が上限 (1 つの IP アドレスから 1 分に 600 回まで) を超えた","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"索引を読めない","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/places/batch":{"post":{"summary":"ID から場所の詳細をまとめて返す","description":"ID を 1 回に 100 件まで JSON の place_ids で渡す。結果は渡した ID と同じ順・同じ数で返し、無い ID はその要素を error にする","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlacesBatchRequest"}}}},"responses":{"200":{"description":"渡した ID と同じ順・同じ数","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlacesBatchResponse"}}}},"400":{"description":"パラメータが不正","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"リクエストの回数が上限 (1 つの IP アドレスから 1 分に 600 回まで) を超えた","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"索引を読めない","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}