{
  "openapi": "3.1.0",
  "info": {
    "title": "Hotelovia Directory API",
    "version": "1.1.0",
    "description": "Read-only access to published Hotelovia places to stay: hotels, guesthouses, hostels, rural houses, apartments, holiday homes, campsites, bed and breakfasts, resorts and motorhome areas. Hotelovia is a directory, not a booking site: it publishes no availability, prices or reservations, and its ratings are Google's. whatsappEligible is a technical reachability signal, not consent or marketing permission."
  },
  "servers": [{ "url": "https://www.hotelovia.com" }],
  "security": [{ "ApiKey": [] }],
  "paths": {
    "/api/v1/key": {
      "get": {
        "operationId": "getCurrentDeveloperKey",
        "summary": "Validate the current API key",
        "responses": {
          "200": {
            "description": "Non-secret key metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["key"],
                  "properties": {
                    "key": { "$ref": "#/components/schemas/Key" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "429": { "$ref": "#/components/responses/TooManyRequests" }
        }
      }
    },
    "/api/v1/places": {
      "get": {
        "operationId": "searchPlaces",
        "summary": "Search published places to stay",
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "required": true,
            "schema": { "type": "string", "enum": ["es", "gb", "fr", "pt"] },
            "description": "A country with a published dataset: es (Spain), gb (United Kingdom), fr (France) or pt (Portugal). France and Portugal have partial initial coverage around twenty major cities and nearby lodging."
          },
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": { "type": "string", "maxLength": 100 }
          },
          {
            "name": "lodgingType",
            "in": "query",
            "schema": { "$ref": "#/components/schemas/LodgingType" }
          },
          {
            "name": "whatsapp",
            "in": "query",
            "schema": { "type": "boolean" }
          },
          {
            "name": "verified",
            "in": "query",
            "schema": { "type": "boolean" }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": { "type": "string", "maxLength": 2048 }
          }
        ],
        "responses": {
          "200": {
            "description": "A bounded page of published records",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PlacePage" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "429": { "$ref": "#/components/responses/TooManyRequests" }
        }
      }
    },
    "/api/v1/places/{placeId}": {
      "get": {
        "operationId": "getPlace",
        "summary": "Get one current published record",
        "parameters": [
          {
            "name": "placeId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "maxLength": 300 }
          }
        ],
        "responses": {
          "200": {
            "description": "The published record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["place"],
                  "properties": {
                    "place": { "$ref": "#/components/schemas/Place" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": { "type": "apiKey", "in": "header", "name": "X-API-Key" }
    },
    "responses": {
      "BadRequest": { "description": "Invalid query or path parameter" },
      "Unauthorized": { "description": "Missing, invalid, or revoked API key" },
      "NotFound": { "description": "No current published record has that id" },
      "TooManyRequests": { "description": "Per-key rate limit exceeded" }
    },
    "schemas": {
      "Key": {
        "type": "object",
        "required": ["id", "name", "prefix", "creationTime"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "prefix": { "type": "string" },
          "creationTime": { "type": "string", "format": "date-time" }
        }
      },
      "LodgingType": {
        "type": "string",
        "description": "Language-neutral kind of place to sleep. A place belongs to the most specific key its Google categories name; lodging is the catch-all and restricts nothing as a filter.",
        "enum": [
          "lodging",
          "hotel",
          "guesthouse",
          "hostel",
          "ruralHouse",
          "apartment",
          "holidayHome",
          "campsite",
          "bedAndBreakfast",
          "resort",
          "motorhomeArea"
        ]
      },
      "Address": {
        "type": "object",
        "required": ["city", "country", "postalCode", "state", "street"],
        "properties": {
          "city": { "type": ["string", "null"] },
          "country": { "type": ["string", "null"] },
          "postalCode": { "type": ["string", "null"] },
          "state": { "type": ["string", "null"] },
          "street": { "type": ["string", "null"] }
        }
      },
      "Place": {
        "type": "object",
        "required": [
          "id",
          "name",
          "legalName",
          "address",
          "location",
          "phone",
          "phoneType",
          "additionalPhones",
          "email",
          "website",
          "googleMapsUrl",
          "primaryType",
          "lodgingTypes",
          "lodgingType",
          "rating",
          "reviewCount",
          "whatsappEligible",
          "verified",
          "openingHours",
          "profileUrl"
        ],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": ["string", "null"] },
          "legalName": { "type": ["string", "null"] },
          "address": { "$ref": "#/components/schemas/Address" },
          "location": {
            "oneOf": [
              { "type": "null" },
              {
                "type": "object",
                "required": ["latitude", "longitude"],
                "properties": {
                  "latitude": { "type": "number" },
                  "longitude": { "type": "number" }
                }
              }
            ]
          },
          "phone": { "type": ["string", "null"] },
          "phoneType": {
            "type": ["string", "null"],
            "enum": ["mobile", "landline", "other", null]
          },
          "additionalPhones": {
            "type": "array",
            "items": { "type": "object" },
            "maxItems": 20
          },
          "email": { "type": ["string", "null"] },
          "website": { "type": ["string", "null"], "format": "uri" },
          "googleMapsUrl": { "type": ["string", "null"], "format": "uri" },
          "primaryType": { "type": ["string", "null"] },
          "lodgingTypes": {
            "type": "array",
            "items": { "type": "string" },
            "maxItems": 50,
            "description": "Google's own category labels, in the country's language."
          },
          "lodgingType": { "$ref": "#/components/schemas/LodgingType" },
          "rating": {
            "type": ["number", "null"],
            "description": "Google's rating, not Hotelovia's."
          },
          "reviewCount": { "type": ["number", "null"] },
          "whatsappEligible": {
            "type": "boolean",
            "description": "Technical reachability signal only; not consent."
          },
          "verified": {
            "type": "boolean",
            "description": "Whether the Google listing is marked verified."
          },
          "openingHours": { "type": ["object", "null"] },
          "profileUrl": { "type": "string", "format": "uri" }
        }
      },
      "PlacePage": {
        "type": "object",
        "required": ["places", "page"],
        "properties": {
          "places": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Place" },
            "maxItems": 100
          },
          "page": {
            "type": "object",
            "required": ["count", "hasMore", "nextCursor"],
            "properties": {
              "count": { "type": "integer", "minimum": 0, "maximum": 100 },
              "hasMore": { "type": "boolean" },
              "nextCursor": { "type": ["string", "null"] }
            }
          }
        }
      }
    }
  }
}
