openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Traveloop API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication - name: trips description: Trip management - name: stops description: Itinerary stops - name: cities description: City discovery - name: activities description: Activity management - name: packing description: Packing checklists - name: notes description: Trip notes and journals - name: budget description: Budget management - name: ai description: AI features - name: public description: Public itinerary sharing - name: dashboard description: Dashboard stats - name: admin description: Admin analytics paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" # Auth /auth/register: post: operationId: register tags: [auth] summary: Register a new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterInput" responses: "201": description: Registered content: application/json: schema: $ref: "#/components/schemas/AuthResponse" /auth/login: post: operationId: login tags: [auth] summary: Login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginInput" responses: "200": description: Logged in content: application/json: schema: $ref: "#/components/schemas/AuthResponse" /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Get current user responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/User" patch: operationId: updateProfile tags: [auth] summary: Update user profile requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProfileUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/User" # Trips /trips: get: operationId: listTrips tags: [trips] summary: List user trips parameters: - name: status in: query schema: type: string enum: [upcoming, ongoing, completed] responses: "200": description: List of trips content: application/json: schema: type: array items: $ref: "#/components/schemas/Trip" post: operationId: createTrip tags: [trips] summary: Create a trip requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TripInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Trip" /trips/{tripId}: get: operationId: getTrip tags: [trips] summary: Get a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: Trip detail content: application/json: schema: $ref: "#/components/schemas/TripDetail" patch: operationId: updateTrip tags: [trips] summary: Update a trip parameters: - name: tripId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TripUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Trip" delete: operationId: deleteTrip tags: [trips] summary: Delete a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /trips/{tripId}/duplicate: post: operationId: duplicateTrip tags: [trips] summary: Duplicate a trip (copy) parameters: - name: tripId in: path required: true schema: type: integer responses: "201": description: Duplicated content: application/json: schema: $ref: "#/components/schemas/Trip" # Stops /trips/{tripId}/stops: get: operationId: listStops tags: [stops] summary: List stops for a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: List of stops content: application/json: schema: type: array items: $ref: "#/components/schemas/Stop" post: operationId: createStop tags: [stops] summary: Add a stop to a trip parameters: - name: tripId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StopInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Stop" /stops/{stopId}: patch: operationId: updateStop tags: [stops] summary: Update a stop parameters: - name: stopId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StopUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Stop" delete: operationId: deleteStop tags: [stops] summary: Delete a stop parameters: - name: stopId in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /stops/{stopId}/activities: post: operationId: addActivityToStop tags: [stops] summary: Add an activity to a stop parameters: - name: stopId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StopActivityInput" responses: "201": description: Added content: application/json: schema: $ref: "#/components/schemas/StopActivity" /stop-activities/{stopActivityId}: delete: operationId: removeActivityFromStop tags: [stops] summary: Remove an activity from a stop parameters: - name: stopActivityId in: path required: true schema: type: integer responses: "200": description: Removed content: application/json: schema: $ref: "#/components/schemas/MessageResponse" # Cities /cities: get: operationId: listCities tags: [cities] summary: Search and list cities parameters: - name: q in: query schema: type: string - name: country in: query schema: type: string - name: region in: query schema: type: string responses: "200": description: List of cities content: application/json: schema: type: array items: $ref: "#/components/schemas/City" /cities/{cityId}: get: operationId: getCity tags: [cities] summary: Get city detail parameters: - name: cityId in: path required: true schema: type: integer responses: "200": description: City detail content: application/json: schema: $ref: "#/components/schemas/City" /cities/{cityId}/activities: get: operationId: getCityActivities tags: [cities] summary: Get activities for a city parameters: - name: cityId in: path required: true schema: type: integer responses: "200": description: List of activities content: application/json: schema: type: array items: $ref: "#/components/schemas/Activity" # Activities /activities: get: operationId: listActivities tags: [activities] summary: Search all activities parameters: - name: q in: query schema: type: string - name: cityId in: query schema: type: integer - name: type in: query schema: type: string - name: maxCost in: query schema: type: number responses: "200": description: List of activities content: application/json: schema: type: array items: $ref: "#/components/schemas/Activity" # Packing /trips/{tripId}/packing: get: operationId: listPackingItems tags: [packing] summary: List packing items for a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: List of packing items content: application/json: schema: type: array items: $ref: "#/components/schemas/PackingItem" post: operationId: createPackingItem tags: [packing] summary: Add a packing item parameters: - name: tripId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PackingItemInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/PackingItem" /packing/{itemId}: patch: operationId: updatePackingItem tags: [packing] summary: Update a packing item (e.g. mark as packed) parameters: - name: itemId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PackingItemUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/PackingItem" delete: operationId: deletePackingItem tags: [packing] summary: Delete a packing item parameters: - name: itemId in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" # Notes /trips/{tripId}/notes: get: operationId: listNotes tags: [notes] summary: List notes for a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: List of notes content: application/json: schema: type: array items: $ref: "#/components/schemas/TripNote" post: operationId: createNote tags: [notes] summary: Create a note parameters: - name: tripId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TripNoteInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/TripNote" /notes/{noteId}: patch: operationId: updateNote tags: [notes] summary: Update a note parameters: - name: noteId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TripNoteUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/TripNote" delete: operationId: deleteNote tags: [notes] summary: Delete a note parameters: - name: noteId in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" # Budget /trips/{tripId}/budget: get: operationId: getTripBudget tags: [budget] summary: Get trip budget breakdown parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: Budget breakdown content: application/json: schema: $ref: "#/components/schemas/Budget" put: operationId: updateTripBudget tags: [budget] summary: Update trip budget parameters: - name: tripId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BudgetInput" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Budget" # AI /ai/generate-trip: post: operationId: generateTrip tags: [ai] summary: AI-generate a complete trip itinerary requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AiTripGeneratorInput" responses: "200": description: Generated itinerary content: application/json: schema: $ref: "#/components/schemas/AiGeneratedTrip" /ai/chat: post: operationId: aiChat tags: [ai] summary: Chat with the AI travel assistant requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AiChatInput" responses: "200": description: AI response content: application/json: schema: $ref: "#/components/schemas/AiChatReply" /ai/recommendations/{tripId}: get: operationId: getAiRecommendations tags: [ai] summary: Get AI recommendations for a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: AI recommendations content: application/json: schema: $ref: "#/components/schemas/AiRecommendations" /ai/optimize-route/{tripId}: post: operationId: optimizeRoute tags: [ai] summary: AI-optimize the stop order of a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: Optimized route suggestion content: application/json: schema: $ref: "#/components/schemas/OptimizedRoute" /ai/packing-suggestions/{tripId}: get: operationId: getAiPackingSuggestions tags: [ai] summary: Get AI packing suggestions for a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: Packing suggestions content: application/json: schema: $ref: "#/components/schemas/AiPackingSuggestions" /ai/trip-summary/{tripId}: get: operationId: getAiTripSummary tags: [ai] summary: AI-generate a readable summary for a trip parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: Trip summary content: application/json: schema: $ref: "#/components/schemas/AiTripSummary" # Public / sharing /public/trips/{shareToken}: get: operationId: getPublicTrip tags: [public] summary: Get a publicly shared trip itinerary parameters: - name: shareToken in: path required: true schema: type: string responses: "200": description: Public trip detail content: application/json: schema: $ref: "#/components/schemas/TripDetail" /trips/{tripId}/share: post: operationId: shareTrip tags: [trips] summary: Make a trip public and get share token parameters: - name: tripId in: path required: true schema: type: integer responses: "200": description: Share info content: application/json: schema: $ref: "#/components/schemas/ShareInfo" # Dashboard /dashboard/stats: get: operationId: getDashboardStats tags: [dashboard] summary: Get dashboard summary stats for the current user responses: "200": description: Dashboard stats content: application/json: schema: $ref: "#/components/schemas/DashboardStats" /dashboard/recommended-cities: get: operationId: getRecommendedCities tags: [dashboard] summary: Get recommended/popular cities for the user responses: "200": description: List of recommended cities content: application/json: schema: type: array items: $ref: "#/components/schemas/City" # Admin /admin/stats: get: operationId: getAdminStats tags: [admin] summary: Get admin analytics overview responses: "200": description: Admin stats content: application/json: schema: $ref: "#/components/schemas/AdminStats" /admin/users: get: operationId: listAdminUsers tags: [admin] summary: List all users responses: "200": description: Users list content: application/json: schema: type: array items: $ref: "#/components/schemas/User" /admin/popular-cities: get: operationId: getPopularCities tags: [admin] summary: Get trending / most-visited cities responses: "200": description: Popular cities content: application/json: schema: type: array items: $ref: "#/components/schemas/CityStats" components: schemas: HealthStatus: type: object required: [status] properties: status: type: string MessageResponse: type: object required: [message] properties: message: type: string # Auth RegisterInput: type: object required: [email, password, name] properties: email: type: string password: type: string name: type: string LoginInput: type: object required: [email, password] properties: email: type: string password: type: string AuthResponse: type: object required: [user] properties: user: $ref: "#/components/schemas/User" ProfileUpdate: type: object properties: name: type: string photo: type: ["string", "null"] travelStyle: type: ["string", "null"] language: type: ["string", "null"] User: type: object required: [id, email, name] properties: id: type: integer email: type: string name: type: string photo: type: ["string", "null"] travelStyle: type: ["string", "null"] language: type: ["string", "null"] isAdmin: type: boolean createdAt: type: string # Trips TripInput: type: object required: [name, startDate, endDate] properties: name: type: string startDate: type: string endDate: type: string description: type: ["string", "null"] coverPhoto: type: ["string", "null"] totalBudget: type: ["number", "null"] TripUpdate: type: object properties: name: type: string startDate: type: string endDate: type: string description: type: ["string", "null"] coverPhoto: type: ["string", "null"] totalBudget: type: ["number", "null"] isPublic: type: boolean status: type: string enum: [upcoming, ongoing, completed] Trip: type: object required: [id, name, startDate, endDate, status] properties: id: type: integer name: type: string startDate: type: string endDate: type: string description: type: ["string", "null"] coverPhoto: type: ["string", "null"] isPublic: type: boolean shareToken: type: ["string", "null"] status: type: string enum: [upcoming, ongoing, completed] totalBudget: type: ["number", "null"] stopCount: type: integer createdAt: type: string TripDetail: type: object required: [id, name, startDate, endDate, status, stops] properties: id: type: integer name: type: string startDate: type: string endDate: type: string description: type: ["string", "null"] coverPhoto: type: ["string", "null"] isPublic: type: boolean shareToken: type: ["string", "null"] status: type: string enum: [upcoming, ongoing, completed] totalBudget: type: ["number", "null"] stops: type: array items: $ref: "#/components/schemas/Stop" budget: $ref: "#/components/schemas/Budget" createdAt: type: string ShareInfo: type: object required: [shareToken, shareUrl] properties: shareToken: type: string shareUrl: type: string # Stops StopInput: type: object required: [cityId, startDate, endDate] properties: cityId: type: integer startDate: type: string endDate: type: string order: type: integer notes: type: ["string", "null"] StopUpdate: type: object properties: startDate: type: string endDate: type: string order: type: integer notes: type: ["string", "null"] Stop: type: object required: [id, tripId, city, startDate, endDate, order] properties: id: type: integer tripId: type: integer city: $ref: "#/components/schemas/City" startDate: type: string endDate: type: string order: type: integer notes: type: ["string", "null"] activities: type: array items: $ref: "#/components/schemas/StopActivity" StopActivityInput: type: object required: [activityId] properties: activityId: type: integer scheduledDate: type: ["string", "null"] scheduledTime: type: ["string", "null"] StopActivity: type: object required: [id, stopId, activity] properties: id: type: integer stopId: type: integer activity: $ref: "#/components/schemas/Activity" scheduledDate: type: ["string", "null"] scheduledTime: type: ["string", "null"] # Cities City: type: object required: [id, name, country] properties: id: type: integer name: type: string country: type: string region: type: ["string", "null"] costIndex: type: ["number", "null"] popularity: type: ["integer", "null"] image: type: ["string", "null"] description: type: ["string", "null"] CityStats: type: object required: [id, name, country, tripCount] properties: id: type: integer name: type: string country: type: string image: type: ["string", "null"] tripCount: type: integer # Activities Activity: type: object required: [id, name, cityId] properties: id: type: integer name: type: string cityId: type: integer cityName: type: ["string", "null"] type: type: ["string", "null"] cost: type: ["number", "null"] duration: type: ["number", "null"] description: type: ["string", "null"] image: type: ["string", "null"] # Packing PackingItemInput: type: object required: [name] properties: name: type: string category: type: ["string", "null"] PackingItemUpdate: type: object properties: name: type: string category: type: ["string", "null"] isPacked: type: boolean PackingItem: type: object required: [id, tripId, name, isPacked] properties: id: type: integer tripId: type: integer name: type: string category: type: ["string", "null"] isPacked: type: boolean # Notes TripNoteInput: type: object required: [content] properties: content: type: string stopId: type: ["integer", "null"] title: type: ["string", "null"] TripNoteUpdate: type: object properties: content: type: string title: type: ["string", "null"] TripNote: type: object required: [id, tripId, content, createdAt] properties: id: type: integer tripId: type: integer stopId: type: ["integer", "null"] title: type: ["string", "null"] content: type: string createdAt: type: string updatedAt: type: string # Budget BudgetInput: type: object properties: totalBudget: type: ["number", "null"] transportCost: type: ["number", "null"] stayCost: type: ["number", "null"] activityCost: type: ["number", "null"] mealCost: type: ["number", "null"] otherCost: type: ["number", "null"] Budget: type: object required: [tripId] properties: tripId: type: integer totalBudget: type: ["number", "null"] transportCost: type: ["number", "null"] stayCost: type: ["number", "null"] activityCost: type: ["number", "null"] mealCost: type: ["number", "null"] otherCost: type: ["number", "null"] estimatedTotal: type: ["number", "null"] averageCostPerDay: type: ["number", "null"] isOverBudget: type: boolean # AI AiTripGeneratorInput: type: object required: [destination, durationDays, budget] properties: destination: type: string durationDays: type: integer budget: type: number interests: type: array items: type: string travelStyle: type: string groupType: type: string currency: type: string AiGeneratedTrip: type: object required: [name, summary, cities, itinerary] properties: name: type: string summary: type: string cities: type: array items: type: string itinerary: type: array items: $ref: "#/components/schemas/AiDayPlan" estimatedBudget: type: number packingSuggestions: type: array items: type: string optimizedRoute: type: array items: type: string AiDayPlan: type: object required: [day, city, activities] properties: day: type: integer city: type: string activities: type: array items: type: string estimatedCost: type: number notes: type: ["string", "null"] AiChatInput: type: object required: [message] properties: message: type: string tripId: type: ["integer", "null"] conversationHistory: type: array items: $ref: "#/components/schemas/ChatMessage" ChatMessage: type: object required: [role, content] properties: role: type: string enum: [user, assistant] content: type: string AiChatReply: type: object required: [message] properties: message: type: string suggestions: type: array items: type: string AiRecommendations: type: object required: [cities, activities] properties: cities: type: array items: type: string activities: type: array items: type: string reasoning: type: string OptimizedRoute: type: object required: [suggestedOrder, reasoning] properties: suggestedOrder: type: array items: type: string currentOrder: type: array items: type: string reasoning: type: string estimatedSavings: type: ["string", "null"] AiPackingSuggestions: type: object required: [items] properties: items: type: array items: $ref: "#/components/schemas/PackingSuggestionItem" reasoning: type: string PackingSuggestionItem: type: object required: [name, category] properties: name: type: string category: type: string AiTripSummary: type: object required: [summary] properties: summary: type: string highlights: type: array items: type: string # Dashboard DashboardStats: type: object required: [totalTrips, upcomingTrips, completedTrips, totalDestinations] properties: totalTrips: type: integer upcomingTrips: type: integer completedTrips: type: integer totalDestinations: type: integer totalBudgetAllocated: type: number recentTrips: type: array items: $ref: "#/components/schemas/Trip" # Admin AdminStats: type: object required: [totalUsers, totalTrips, totalCities] properties: totalUsers: type: integer totalTrips: type: integer totalCities: type: integer tripsThisMonth: type: integer popularCities: type: array items: $ref: "#/components/schemas/CityStats" recentSignups: type: integer