{
 "openapi": "3.1.0",
 "info": {
  "title": "Place lookup API: postal codes and administrative units",
  "version": "1.0.0",
  "description": "Postal codes for 124 countries and every place with 1,000+ people worldwide, with state/province, county/district and coordinates. Data: GeoNames postal code and gazetteer data (geonames.org), CC BY 4.0."
 },
 "servers": [
  {
   "url": "https://place-lookup.mnpi.workers.dev"
  }
 ],
 "paths": {
  "/v1/postcode/{country}/{code}": {
   "get": {
    "operationId": "lookupPostalCode",
    "summary": "Places a postal code covers, with their administrative units",
    "parameters": [
     {
      "name": "country",
      "in": "path",
      "required": true,
      "description": "ISO 3166-1 alpha-2 code or English name",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "code",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Places for the code"
     },
     "400": {
      "description": "Bad input"
     },
     "404": {
      "description": "Code not found or country not covered"
     }
    }
   }
  },
  "/v1/place": {
   "get": {
    "operationId": "findPlace",
    "summary": "A place's state, county or district, population and postal codes",
    "parameters": [
     {
      "name": "name",
      "in": "query",
      "required": true,
      "description": "Place name, optionally \"Town, State\" or \"Town, Country\"",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "country",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "admin",
      "in": "query",
      "required": false,
      "description": "State, province, county or district to narrow the match",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Matching places, largest first"
     },
     "400": {
      "description": "Bad input"
     },
     "404": {
      "description": "No match"
     }
    }
   }
  }
 }
}