{
    "openapi":  "3.0.3",
    "info":  {
                 "title":  "Maison Manendra booking API",
                 "version":  "1.1",
                 "description":  "Free to use by AI agents and booking assistants. Prices in IDR, per room per night, breakfast not included. A booking request holds the room for 12 hours until the hosts confirm. Payment on arrival (cash IDR, card +2%), no deposit."
             },
    "servers":  [
                    {
                        "url":  "https://maison-manendra.com"
                    }
                ],
    "paths":  {
                  "/api/availability":  {
                                            "get":  {
                                                        "operationId":  "getAvailability",
                                                        "summary":  "Rooms available and total price for a stay",
                                                        "parameters":  [
                                                                           {
                                                                               "name":  "checkin",
                                                                               "in":  "query",
                                                                               "required":  true,
                                                                               "schema":  {
                                                                                              "type":  "string",
                                                                                              "format":  "date"
                                                                                          }
                                                                           },
                                                                           {
                                                                               "name":  "checkout",
                                                                               "in":  "query",
                                                                               "required":  true,
                                                                               "schema":  {
                                                                                              "type":  "string",
                                                                                              "format":  "date"
                                                                                          }
                                                                           },
                                                                           {
                                                                               "name":  "guests",
                                                                               "in":  "query",
                                                                               "required":  false,
                                                                               "schema":  {
                                                                                              "maximum":  20,
                                                                                              "type":  "integer",
                                                                                              "minimum":  1
                                                                                          }
                                                                           },
                                                                           {
                                                                               "name":  "lang",
                                                                               "in":  "query",
                                                                               "required":  false,
                                                                               "schema":  {
                                                                                              "type":  "string",
                                                                                              "enum":  [
                                                                                                           "en",
                                                                                                           "fr",
                                                                                                           "de",
                                                                                                           "nl",
                                                                                                           "es",
                                                                                                           "it",
                                                                                                           "id"
                                                                                                       ]
                                                                                          }
                                                                           }
                                                                       ],
                                                        "responses":  {
                                                                          "200":  {
                                                                                      "description":  "For each room type: rooms free for every night, price per night by season and total. closedNights lists nights in the annual closure. howToBook shows the booking request to send."
                                                                                  }
                                                                      }
                                                    }
                                        },
                  "/api/bookings":  {
                                        "post":  {
                                                     "operationId":  "createBooking",
                                                     "summary":  "Request a booking: the rooms are held for 12 hours until the hosts confirm",
                                                     "requestBody":  {
                                                                         "required":  true,
                                                                         "content":  {
                                                                                         "application/json":  {
                                                                                                                  "schema":  {
                                                                                                                                 "type":  "object",
                                                                                                                                 "required":  [
                                                                                                                                                  "checkin",
                                                                                                                                                  "checkout",
                                                                                                                                                  "guests",
                                                                                                                                                  "rooms",
                                                                                                                                                  "name"
                                                                                                                                              ],
                                                                                                                                 "properties":  {
                                                                                                                                                    "checkin":  {
                                                                                                                                                                    "type":  "string",
                                                                                                                                                                    "format":  "date"
                                                                                                                                                                },
                                                                                                                                                    "checkout":  {
                                                                                                                                                                     "type":  "string",
                                                                                                                                                                     "format":  "date"
                                                                                                                                                                 },
                                                                                                                                                    "guests":  {
                                                                                                                                                                   "type":  "integer",
                                                                                                                                                                   "minimum":  1
                                                                                                                                                               },
                                                                                                                                                    "rooms":  {
                                                                                                                                                                  "type":  "array",
                                                                                                                                                                  "items":  {
                                                                                                                                                                                "type":  "object",
                                                                                                                                                                                "properties":  {
                                                                                                                                                                                                   "type":  {
                                                                                                                                                                                                                "type":  "string",
                                                                                                                                                                                                                "enum":  [
                                                                                                                                                                                                                             "double",
                                                                                                                                                                                                                             "extrabed",
                                                                                                                                                                                                                             "twin",
                                                                                                                                                                                                                             "quad"
                                                                                                                                                                                                                         ]
                                                                                                                                                                                                            },
                                                                                                                                                                                                   "qty":  {
                                                                                                                                                                                                               "type":  "integer",
                                                                                                                                                                                                               "minimum":  1
                                                                                                                                                                                                           }
                                                                                                                                                                                               }
                                                                                                                                                                            }
                                                                                                                                                              },
                                                                                                                                                    "name":  {
                                                                                                                                                                 "type":  "string"
                                                                                                                                                             },
                                                                                                                                                    "email":  {
                                                                                                                                                                  "type":  "string",
                                                                                                                                                                  "description":  "email or phone is required"
                                                                                                                                                              },
                                                                                                                                                    "phone":  {
                                                                                                                                                                  "type":  "string",
                                                                                                                                                                  "description":  "WhatsApp number with country code"
                                                                                                                                                              },
                                                                                                                                                    "country":  {
                                                                                                                                                                    "type":  "string"
                                                                                                                                                                },
                                                                                                                                                    "message":  {
                                                                                                                                                                    "type":  "string"
                                                                                                                                                                },
                                                                                                                                                    "lang":  {
                                                                                                                                                                 "type":  "string",
                                                                                                                                                                 "enum":  [
                                                                                                                                                                              "en",
                                                                                                                                                                              "fr",
                                                                                                                                                                              "de",
                                                                                                                                                                              "nl",
                                                                                                                                                                              "es",
                                                                                                                                                                              "it",
                                                                                                                                                                              "id"
                                                                                                                                                                          ]
                                                                                                                                                             },
                                                                                                                                                    "source":  {
                                                                                                                                                                   "type":  "string",
                                                                                                                                                                   "description":  "e.g. the name of the AI assistant"
                                                                                                                                                               }
                                                                                                                                                }
                                                                                                                             }
                                                                                                              }
                                                                                     }
                                                                     },
                                                     "responses":  {
                                                                       "201":  {
                                                                                   "description":  "Request created: reference, status \"pending\", holdUntil, total, statusUrl and api link with the guest token."
                                                                               },
                                                                       "409":  {
                                                                                   "description":  "Not available (taken or annual closure)."
                                                                               },
                                                                       "503":  {
                                                                                   "description":  "Online booking not enabled yet: use the WhatsApp link."
                                                                               }
                                                                   }
                                                 }
                                    },
                  "/api/bookings/{reference}":  {
                                                    "get":  {
                                                                "operationId":  "getBooking",
                                                                "summary":  "Booking status: pending, confirmed, declined, expired or cancelled",
                                                                "parameters":  [
                                                                                   {
                                                                                       "name":  "reference",
                                                                                       "in":  "path",
                                                                                       "required":  true,
                                                                                       "schema":  {
                                                                                                      "type":  "string"
                                                                                                  },
                                                                                       "example":  "MM-AB12CD"
                                                                                   },
                                                                                   {
                                                                                       "name":  "t",
                                                                                       "in":  "query",
                                                                                       "required":  true,
                                                                                       "description":  "Guest token returned when the booking was created",
                                                                                       "schema":  {
                                                                                                      "type":  "string"
                                                                                                  }
                                                                                   }
                                                                               ],
                                                                "responses":  {
                                                                                  "200":  {
                                                                                              "description":  "Booking"
                                                                                          },
                                                                                  "404":  {
                                                                                              "description":  "Not found"
                                                                                          }
                                                                              }
                                                            }
                                                },
                  "/api/bookings/{reference}/cancel":  {
                                                           "post":  {
                                                                        "operationId":  "cancelBooking",
                                                                        "summary":  "Cancel (free within 24 h of booking, then until 60 days before arrival)",
                                                                        "parameters":  [
                                                                                           {
                                                                                               "name":  "reference",
                                                                                               "in":  "path",
                                                                                               "required":  true,
                                                                                               "schema":  {
                                                                                                              "type":  "string"
                                                                                                          },
                                                                                               "example":  "MM-AB12CD"
                                                                                           },
                                                                                           {
                                                                                               "name":  "t",
                                                                                               "in":  "query",
                                                                                               "required":  true,
                                                                                               "description":  "Guest token returned when the booking was created",
                                                                                               "schema":  {
                                                                                                              "type":  "string"
                                                                                                          }
                                                                                           }
                                                                                       ],
                                                                        "responses":  {
                                                                                          "200":  {
                                                                                                      "description":  "Cancelled"
                                                                                                  },
                                                                                          "409":  {
                                                                                                      "description":  "Too late to cancel online: contact the hosts."
                                                                                                  }
                                                                                      }
                                                                    }
                                                       }
              }
}