openapi: 3.0.3 info: title: Airbnb Lab Backend API version: 0.3.0 servers: - url: http://localhost:4000/api components: securitySchemes: cookieAuth: type: apiKey in: cookie name: airbnb.sid schemas: ApiResponse: type: object required: - success properties: success: type: boolean message: type: string data: nullable: true AuthUser: type: object required: - id - email - name - role properties: id: type: integer format: int32 email: type: string format: email name: type: string role: type: string enum: - TRAVELER - OWNER TravelerProfile: type: object properties: about: type: string city: type: string state: type: string country: type: string languages: type: string gender: type: string avatarUrl: type: string format: uri createdAt: type: string format: date-time updatedAt: type: string format: date-time TravelerDashboard: type: object required: - profile - summary - upcomingBookings - favoriteProperties properties: profile: type: object properties: id: type: integer email: type: string format: email name: type: string role: type: string enum: - TRAVELER travelerProfile: $ref: '#/components/schemas/TravelerProfile' summary: type: object required: - pendingRequests - upcomingTrips - pastTrips - favorites properties: pendingRequests: type: integer upcomingTrips: type: integer pastTrips: type: integer favorites: type: integer upcomingBookings: type: array items: $ref: '#/components/schemas/TravelerBookingSummary' favoriteProperties: type: array items: $ref: '#/components/schemas/TravelerFavorite' PropertySummary: type: object properties: id: type: integer title: type: string city: type: string state: type: string country: type: string pricePerNight: type: number cleaningFee: type: number nullable: true bedrooms: type: integer bathrooms: type: integer maxGuests: type: integer coverPhoto: nullable: true type: object properties: id: type: integer url: type: string format: uri caption: type: string isCover: type: boolean PropertyPhoto: type: object properties: id: type: integer url: type: string format: uri caption: type: string isCover: type: boolean PropertyAvailability: type: object properties: id: type: integer startDate: type: string format: date-time endDate: type: string format: date-time isBlocked: type: boolean reason: type: string nullable: true PropertyOwner: type: object properties: id: type: integer name: type: string email: type: string format: email ownerProfile: type: object properties: location: type: string phone: type: string avatarUrl: type: string format: uri company: type: string PropertyBlockedBooking: type: object properties: id: type: integer status: type: string startDate: type: string format: date-time endDate: type: string format: date-time guests: type: integer PropertyDetail: type: object properties: id: type: integer owner: $ref: '#/components/schemas/PropertyOwner' title: type: string description: type: string propertyType: type: string addressLine1: type: string addressLine2: type: string nullable: true city: type: string state: type: string country: type: string postalCode: type: string nullable: true latitude: type: number format: float nullable: true longitude: type: number format: float nullable: true pricePerNight: type: number cleaningFee: type: number nullable: true bedrooms: type: integer bathrooms: type: integer maxGuests: type: integer checkInTime: type: string nullable: true checkOutTime: type: string nullable: true amenities: type: array items: type: object properties: id: type: integer label: type: string photos: type: array items: $ref: '#/components/schemas/PropertyPhoto' availabilities: type: array items: $ref: '#/components/schemas/PropertyAvailability' blockedBookings: type: array items: $ref: '#/components/schemas/PropertyBlockedBooking' createdAt: type: string format: date-time updatedAt: type: string format: date-time TravelerBookingSummary: type: object properties: id: type: integer status: type: string enum: - PENDING - ACCEPTED - CANCELLED startDate: type: string format: date-time endDate: type: string format: date-time guests: type: integer totalPrice: type: number nullable: true notes: type: string nullable: true createdAt: type: string format: date-time updatedAt: type: string format: date-time property: $ref: '#/components/schemas/PropertySummary' TravelerBookings: type: object required: - bookings - counts properties: bookings: type: object properties: pending: type: array items: $ref: '#/components/schemas/TravelerBookingSummary' accepted: type: array items: $ref: '#/components/schemas/TravelerBookingSummary' cancelled: type: array items: $ref: '#/components/schemas/TravelerBookingSummary' counts: type: object properties: pending: type: integer accepted: type: integer cancelled: type: integer BookingTraveler: type: object properties: id: type: integer name: type: string email: type: string format: email BookingResponse: type: object properties: id: type: integer status: type: string enum: - PENDING - ACCEPTED - CANCELLED startDate: type: string format: date-time endDate: type: string format: date-time guests: type: integer totalPrice: type: number nullable: true notes: type: string nullable: true createdAt: type: string format: date-time updatedAt: type: string format: date-time property: $ref: '#/components/schemas/PropertySummary' traveler: $ref: '#/components/schemas/BookingTraveler' TravelerFavorite: type: object properties: id: type: integer createdAt: type: string format: date-time property: $ref: '#/components/schemas/PropertySummary' FavoriteResponse: type: object properties: id: type: integer createdAt: type: string format: date-time property: $ref: '#/components/schemas/PropertySummary' OwnerSignupRequest: type: object required: - name - email - password properties: name: type: string email: type: string format: email password: type: string minLength: 8 about: type: string location: type: string phone: type: string avatarUrl: type: string format: uri company: type: string TravelerSignupRequest: type: object required: - name - email - password properties: name: type: string email: type: string format: email password: type: string minLength: 8 about: type: string city: type: string state: type: string description: Two-letter state or region abbreviation country: type: string languages: type: string gender: type: string avatarUrl: type: string format: uri LoginRequest: type: object required: - email - password properties: email: type: string format: email password: type: string minLength: 8 OwnerPropertyRequest: type: object required: - title - description - propertyType - addressLine1 - city - state - country - pricePerNight - bedrooms - bathrooms - maxGuests properties: title: type: string description: type: string propertyType: type: string addressLine1: type: string addressLine2: type: string city: type: string state: type: string country: type: string postalCode: type: string latitude: type: number format: float longitude: type: number format: float pricePerNight: type: number cleaningFee: type: number minimum: 0 bedrooms: type: integer minimum: 1 bathrooms: type: integer minimum: 1 maxGuests: type: integer minimum: 1 checkInTime: type: string example: "15:00" checkOutTime: type: string example: "11:00" amenities: type: array items: type: string photos: type: array items: type: object required: - url properties: url: type: string format: uri caption: type: string isCover: type: boolean availabilities: type: array items: type: object required: - startDate - endDate properties: startDate: type: string format: date endDate: type: string format: date isBlocked: type: boolean reason: type: string OwnerDashboard: type: object required: - summary - properties - recentRequests - recentBookings properties: summary: type: object required: - totalProperties - totalBookings - pendingRequests - upcomingBookings properties: totalProperties: type: integer totalBookings: type: integer pendingRequests: type: integer upcomingBookings: type: integer properties: type: array items: type: object properties: id: type: integer title: type: string city: type: string state: type: string country: type: string pricePerNight: type: number bedrooms: type: integer bathrooms: type: integer maxGuests: type: integer createdAt: type: string format: date-time updatedAt: type: string format: date-time recentRequests: type: array items: $ref: '#/components/schemas/OwnerBookingSummary' recentBookings: type: array items: $ref: '#/components/schemas/OwnerBookingSummary' OwnerBookingSummary: type: object properties: id: type: integer status: type: string startDate: type: string format: date-time endDate: type: string format: date-time guests: type: integer createdAt: type: string format: date-time property: type: object properties: id: type: integer title: type: string traveler: type: object properties: id: type: integer name: type: string email: type: string format: email OwnerBookings: type: object required: - bookings - counts properties: bookings: type: object properties: pending: type: array items: $ref: '#/components/schemas/OwnerBookingSummary' accepted: type: array items: $ref: '#/components/schemas/OwnerBookingSummary' cancelled: type: array items: $ref: '#/components/schemas/OwnerBookingSummary' counts: type: object properties: pending: type: integer accepted: type: integer cancelled: type: integer OwnerProperty: allOf: - $ref: '#/components/schemas/OwnerPropertyRequest' - type: object properties: id: type: integer ownerId: type: integer amenities: type: array items: type: object properties: id: type: integer label: type: string photos: type: array items: type: object properties: id: type: integer url: type: string format: uri caption: type: string isCover: type: boolean availabilities: type: array items: type: object properties: id: type: integer startDate: type: string format: date-time endDate: type: string format: date-time isBlocked: type: boolean reason: type: string paths: /auth/traveler/signup: post: tags: - Auth summary: Traveler signup requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TravelerSignupRequest' example: name: Jane Doe email: jane@example.com password: Str0ngPass!2025 city: Lisbon country: Portugal responses: '201': description: Traveler registered content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/AuthUser' /auth/owner/signup: post: tags: - Auth summary: Owner signup requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OwnerSignupRequest' example: name: Lucas Moreno email: lucas@example.com password: Str0ngPass!2025 location: Lisbon, Portugal company: Moreno Stays responses: '201': description: Owner registered content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/AuthUser' /auth/login: post: tags: - Auth summary: Login requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/LoginRequest' example: email: lucas@example.com password: Str0ngPass!2025 responses: '200': description: Login successful headers: Set-Cookie: description: Session cookie (airbnb.sid) schema: type: string content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/AuthUser' /auth/logout: post: tags: - Auth summary: Logout current user security: - cookieAuth: [] responses: '200': description: Logout successful content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /auth/me: get: tags: - Auth summary: Get current session user security: - cookieAuth: [] responses: '200': description: Current user profile content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/AuthUser' '401': description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /traveler/dashboard: get: tags: - Traveler summary: Get traveler dashboard data security: - cookieAuth: [] responses: '200': description: Dashboard response content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/TravelerDashboard' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /traveler/bookings: get: tags: - Traveler summary: List traveler bookings grouped by status security: - cookieAuth: [] responses: '200': description: Booking lists content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/TravelerBookings' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /traveler/favorites: get: tags: - Traveler summary: List traveler favorite properties security: - cookieAuth: [] responses: '200': description: Favorite properties content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: type: array items: $ref: '#/components/schemas/TravelerFavorite' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /owner/dashboard: get: tags: - Owner summary: Get owner dashboard summary security: - cookieAuth: [] responses: '200': description: Dashboard data content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/OwnerDashboard' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /owner/bookings: get: tags: - Owner summary: List bookings for owner properties grouped by status security: - cookieAuth: [] responses: '200': description: Grouped booking list content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/OwnerBookings' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /owner/properties: post: tags: - Owner summary: Create a new property listing security: - cookieAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OwnerPropertyRequest' example: title: Oceanview Villa description: Five minutes from the beach propertyType: Villa addressLine1: 123 Coast Road city: Lisbon state: LX country: Portugal pricePerNight: 325 bedrooms: 4 bathrooms: 3 maxGuests: 8 amenities: - Pool - Wi-Fi photos: - url: https://example.com/pool.jpg isCover: true availabilities: - startDate: 2025-06-01 endDate: 2025-06-15 responses: '201': description: Property created content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/OwnerProperty' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /properties: get: tags: - Properties summary: Search available properties parameters: - in: query name: location schema: type: string description: Partial match against city, state, country, or address - in: query name: guests schema: type: integer minimum: 1 description: Minimum number of guests the property must accommodate - in: query name: minPrice schema: type: number minimum: 0 - in: query name: maxPrice schema: type: number minimum: 0 - in: query name: startDate schema: type: string format: date - in: query name: endDate schema: type: string format: date - in: query name: sort schema: type: string enum: [price-asc, price-desc, newest, updated] description: Sort order (defaults to last updated) responses: '200': description: Property search results content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: type: array items: $ref: '#/components/schemas/PropertySummary' '400': description: Invalid query parameters content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /properties/{propertyId}: get: tags: - Properties summary: Fetch detailed information about a single property parameters: - in: path name: propertyId required: true schema: type: integer minimum: 1 responses: '200': description: Property details content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/PropertyDetail' '400': description: Invalid property id content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '404': description: Property not found content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /favorites: get: tags: - Favorites summary: List traveler favorites security: - cookieAuth: [] responses: '200': description: Favorites list content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: type: array items: $ref: '#/components/schemas/FavoriteResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /favorites/{propertyId}: post: tags: - Favorites summary: Add a property to traveler favorites security: - cookieAuth: [] parameters: - in: path name: propertyId required: true schema: type: integer minimum: 1 responses: '201': description: Property marked as favorite content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/FavoriteResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '404': description: Property not found content: application/json: schema: $ref: '#/components/schemas/ApiResponse' delete: tags: - Favorites summary: Remove a property from traveler favorites security: - cookieAuth: [] parameters: - in: path name: propertyId required: true schema: type: integer minimum: 1 responses: '204': description: Favorite removed '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '404': description: Favorite not found content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /bookings: post: tags: - Bookings summary: Create a booking request security: - cookieAuth: [] requestBody: required: true content: application/json: schema: type: object required: - propertyId - startDate - endDate - guests properties: propertyId: type: integer minimum: 1 startDate: type: string format: date endDate: type: string format: date guests: type: integer minimum: 1 notes: type: string example: propertyId: 12 startDate: 2025-07-01 endDate: 2025-07-06 guests: 4 notes: Family vacation responses: '201': description: Booking created in pending state content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/BookingResponse' '400': description: Invalid payload content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '409': description: Conflicting booking content: application/json: schema: $ref: '#/components/schemas/ApiResponse' get: tags: - Bookings summary: List bookings for the current user security: - cookieAuth: [] responses: '200': description: Bookings grouped by status content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: oneOf: - $ref: '#/components/schemas/TravelerBookings' - $ref: '#/components/schemas/OwnerBookings' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /bookings/{bookingId}/accept: post: tags: - Bookings summary: Accept a pending booking (owner only) security: - cookieAuth: [] parameters: - in: path name: bookingId required: true schema: type: integer minimum: 1 responses: '200': description: Booking accepted content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/BookingResponse' '400': description: Invalid state content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '404': description: Booking not found content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '409': description: Conflicting booking content: application/json: schema: $ref: '#/components/schemas/ApiResponse' /bookings/{bookingId}/cancel: post: tags: - Bookings summary: Cancel a booking (owner or traveler) security: - cookieAuth: [] parameters: - in: path name: bookingId required: true schema: type: integer minimum: 1 responses: '200': description: Booking cancelled content: application/json: schema: allOf: - $ref: '#/components/schemas/ApiResponse' - type: object properties: data: $ref: '#/components/schemas/BookingResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ApiResponse' '404': description: Booking not found content: application/json: schema: $ref: '#/components/schemas/ApiResponse'