{"openapi":"3.1.0","info":{"title":"Stays","version":"1.0"},"servers":[{"url":"https://stays.poppysandbox.dev"}],"components":{"securitySchemes":{"poppySession":{"type":"apiKey","in":"header","name":"Poppy-Session","description":"Per-request Poppy-Session JWT (spec 5.2)."},"oauth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://authlete-as.vercel.app/oauth/authorize","tokenUrl":"https://authlete-as.vercel.app/oauth/token","scopes":{"stays:read":"See your Stays bookings.","stays:write":"Book a room on your account. Each booking needs your approval.","poppy:browser-sign-in":"Use Stays signed in, with the other access you approve."}}}}},"schemas":{"Room":{"type":"object","properties":{"id":{"type":"string","example":"sea-view"},"name":{"type":"string","example":"Sea View King"},"pricePerNight":{"type":"number","example":240},"available":{"type":"boolean","example":true}},"required":["id","name","pricePerNight","available"]},"Booking":{"type":"object","properties":{"room":{"type":"string","example":"sea-view"},"checkIn":{"type":"string","format":"date","example":"2026-02-01"},"nights":{"type":"integer","example":2},"total":{"type":"number","example":480}},"required":["room","checkIn","nights","total"]},"Error":{"type":"object","properties":{"error":{"type":"string"},"error_description":{"type":"string"}},"required":["error","error_description"]},"BookingRequest":{"type":"object","properties":{"room":{"type":"string","enum":["sea-view","garden","loft"],"example":"sea-view","description":"A room id from GET /rooms."},"checkIn":{"type":"string","format":"date","example":"2026-02-01"},"nights":{"type":"integer","minimum":1,"example":2}},"required":["room"]}},"parameters":{}},"paths":{"/rooms":{"get":{"summary":"Search available rooms.","security":[{"poppySession":[]}],"responses":{"200":{"description":"Available rooms.","content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"rooms":{"type":"array","items":{"$ref":"#/components/schemas/Room"}}},"required":["company","rooms"]}}}}}}},"/stays":{"get":{"summary":"List your bookings.","security":[{"poppySession":[],"oauth2":["stays:read"]}],"responses":{"200":{"description":"Your bookings.","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"string"},"bookings":{"type":"array","items":{"$ref":"#/components/schemas/Booking"}}},"required":["user","bookings"]}}}}}},"post":{"summary":"Book a room.","security":[{"poppySession":[],"oauth2":["stays:write"]}],"requestBody":{"description":"Room and dates to book.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingRequest"}}}},"responses":{"201":{"description":"Booking confirmed.","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"string"},"booked":{"$ref":"#/components/schemas/Booking"}},"required":["user","booked"]}}}},"400":{"description":"Unknown or unavailable room.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}