{
  "openapi": "3.1.0",
  "info": {
    "title": "La Casita en el Patio - availability",
    "version": "1.0.0",
    "description": "Read-only availability of La Casita en el Patio, a holiday studio for up to 2 guests in Coín (Málaga, Spain). No authentication. Availability is synced from Airbnb and Booking.com every 30 minutes and may be slightly out of date. A stay is only confirmed by the host (direct booking: price confirmed by email, payment by Bizum or bank transfer) or by the booking platform."
  },
  "servers": [
    {
      "url": "https://lacasitaenelpatio.com"
    }
  ],
  "paths": {
    "/availability.json": {
      "get": {
        "operationId": "getAvailability",
        "summary": "Free dates for the next months, and optionally check a specific stay",
        "parameters": [
          {
            "name": "checkin",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Arrival date (YYYY-MM-DD)"
          },
          {
            "name": "checkout",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Departure date (YYYY-MM-DD)"
          },
          {
            "name": "guests",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 2
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Availability",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "property": {
                      "type": "object"
                    },
                    "updated_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "window": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "format": "date"
                        },
                        "until": {
                          "type": "string",
                          "format": "date"
                        }
                      }
                    },
                    "available_stays": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "checkin": {
                            "type": "string",
                            "format": "date"
                          },
                          "checkout": {
                            "type": "string",
                            "format": "date",
                            "description": "Day of departure (not a night stayed)"
                          },
                          "nights": {
                            "type": "integer"
                          }
                        }
                      },
                      "description": "Longest free periods; any stay inside one of them is free"
                    },
                    "booking_links": {
                      "type": "object"
                    },
                    "requested_stay": {
                      "type": "object",
                      "description": "Only when checkin and checkout are given",
                      "properties": {
                        "available": {
                          "type": "boolean"
                        },
                        "occupied_nights": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "date"
                          }
                        },
                        "booking_links": {
                          "type": "object",
                          "description": "Prefilled with the dates"
                        }
                      }
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid dates or number of guests"
          }
        }
      }
    }
  }
}