{
  "openapi": "3.1.0",
  "info": {
    "title": "Sleep Space Booking API",
    "version": "1.0.0",
    "description": "Live sales closed. Public quotes are planned estimates. Authenticated sandbox is optional, fictional, test-payments only; no outbound email is sent."
  },
  "servers": [
    {
      "url": "https://www.sleepspace.net"
    }
  ],
  "paths": {
    "/api/booking/v1/availability": {
      "get": {
        "operationId": "publicAvailability",
        "summary": "Check planned price; live rooms unavailable",
        "responses": {
          "200": {
            "description": "JSON response. Monetary amounts are integer US cents."
          },
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "checkin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "checkout",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "guests",
            "required": true,
            "schema": {
              "type": "integer",
              "enum": [
                1,
                2
              ]
            }
          },
          {
            "in": "query",
            "name": "roomType",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "Economy",
                "Economy Plus"
              ]
            }
          }
        ]
      }
    },
    "/api/booking/v1/quotes": {
      "post": {
        "operationId": "publicQuote",
        "summary": "Create a planned estimate, not a purchase quote",
        "responses": {
          "200": {
            "description": "JSON response. Monetary amounts are integer US cents."
          },
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "checkin",
                  "checkout",
                  "guests",
                  "roomType"
                ],
                "properties": {
                  "checkin": {
                    "type": "string",
                    "format": "date"
                  },
                  "checkout": {
                    "type": "string",
                    "format": "date"
                  },
                  "guests": {
                    "type": "integer",
                    "enum": [
                      1,
                      2
                    ]
                  },
                  "roomType": {
                    "type": "string",
                    "enum": [
                      "Economy",
                      "Economy Plus"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/booking/v1/checkout": {
      "post": {
        "operationId": "publicCheckout",
        "summary": "Always returns 409 BOOKING_CLOSED; no charge or reservation",
        "responses": {
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          }
        }
      }
    },
    "/api/booking/v1/sandbox/availability": {
      "get": {
        "operationId": "testAvailability",
        "summary": "Check test inventory",
        "responses": {
          "200": {
            "description": "JSON response. Monetary amounts are integer US cents."
          },
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          },
          "401": {
            "description": "Sandbox token required"
          },
          "404": {
            "description": "Sandbox disabled or booking not found"
          }
        },
        "security": [
          {
            "SandboxToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "checkin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "checkout",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "guests",
            "required": true,
            "schema": {
              "type": "integer",
              "enum": [
                1,
                2
              ]
            }
          },
          {
            "in": "query",
            "name": "roomType",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "Economy",
                "Economy Plus"
              ]
            }
          }
        ]
      }
    },
    "/api/booking/v1/sandbox/quotes": {
      "post": {
        "operationId": "testQuote",
        "summary": "Create a test quote, valid for ten minutes",
        "responses": {
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          },
          "401": {
            "description": "Sandbox token required"
          },
          "404": {
            "description": "Sandbox disabled or booking not found"
          },
          "201": {
            "description": "JSON response. Monetary amounts are integer US cents."
          }
        },
        "security": [
          {
            "SandboxToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "checkin",
                  "checkout",
                  "guests",
                  "roomType"
                ],
                "properties": {
                  "checkin": {
                    "type": "string",
                    "format": "date"
                  },
                  "checkout": {
                    "type": "string",
                    "format": "date"
                  },
                  "guests": {
                    "type": "integer",
                    "enum": [
                      1,
                      2
                    ]
                  },
                  "roomType": {
                    "type": "string",
                    "enum": [
                      "Economy",
                      "Economy Plus"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/booking/v1/sandbox/checkout": {
      "post": {
        "operationId": "testCheckout",
        "summary": "Create hosted TEST checkout after traveler approval",
        "responses": {
          "200": {
            "description": "JSON response. Monetary amounts are integer US cents."
          },
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          },
          "401": {
            "description": "Sandbox token required"
          },
          "404": {
            "description": "Sandbox disabled or booking not found"
          }
        },
        "security": [
          {
            "SandboxToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "quoteId",
                  "email",
                  "acceptedTerms"
                ],
                "properties": {
                  "quoteId": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "acceptedTerms": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{16,100}$"
            }
          }
        ]
      }
    },
    "/api/booking/v1/status": {
      "get": {
        "operationId": "bookingStatus",
        "summary": "Read current launch status; live sales are closed",
        "responses": {
          "200": {
            "description": "JSON response. Monetary amounts are integer US cents."
          },
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          }
        }
      }
    },
    "/api/booking/v1/sandbox/bookings/{bookingId}": {
      "get": {
        "operationId": "testBookingStatus",
        "summary": "Read a test booking; only verified paid webhooks confirm it",
        "responses": {
          "200": {
            "description": "JSON response. Monetary amounts are integer US cents."
          },
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Booking closed, sold out, expired quote or idempotency conflict"
          },
          "503": {
            "description": "Service temporarily unavailable"
          },
          "401": {
            "description": "Sandbox token required"
          },
          "404": {
            "description": "Sandbox disabled or booking not found"
          }
        },
        "security": [
          {
            "SandboxToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "bookingId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "SandboxToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Private operator-supplied sandbox token; never place it in a public client."
      }
    },
    "schemas": {
      "Stay": {
        "type": "object",
        "required": [
          "checkin",
          "checkout",
          "guests",
          "roomType"
        ],
        "properties": {
          "checkin": {
            "type": "string",
            "format": "date"
          },
          "checkout": {
            "type": "string",
            "format": "date"
          },
          "guests": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "roomType": {
            "type": "string",
            "enum": [
              "Economy",
              "Economy Plus"
            ]
          }
        },
        "additionalProperties": false
      }
    }
  }
}
