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: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication operations - name: favorites description: Favorite property operations - name: inquiries description: Property inquiry operations - name: contact description: Contact message operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/register: post: operationId: registerUser tags: [auth] summary: Register a new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterInput" responses: "201": description: User created content: application/json: schema: $ref: "#/components/schemas/User" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "409": description: Email already registered content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/login: post: operationId: loginUser tags: [auth] summary: Log in a user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginInput" responses: "200": description: Logged in content: application/json: schema: $ref: "#/components/schemas/User" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logoutUser tags: [auth] summary: Log out the current user responses: "204": description: Logged out /auth/me: get: operationId: getCurrentUser tags: [auth] summary: Get the currently authenticated user, if any responses: "200": description: Current auth state content: application/json: schema: $ref: "#/components/schemas/AuthState" /favorites: get: operationId: listFavorites tags: [favorites] summary: List favorite property ids for the current session responses: "200": description: Favorite property ids content: application/json: schema: $ref: "#/components/schemas/FavoriteIds" post: operationId: addFavorite tags: [favorites] summary: Add a property to favorites requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FavoriteInput" responses: "201": description: Updated favorite property ids content: application/json: schema: $ref: "#/components/schemas/FavoriteIds" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /favorites/{propertyId}: delete: operationId: removeFavorite tags: [favorites] summary: Remove a property from favorites parameters: - name: propertyId in: path required: true schema: type: string responses: "200": description: Updated favorite property ids content: application/json: schema: $ref: "#/components/schemas/FavoriteIds" /inquiries: post: operationId: createInquiry tags: [inquiries] summary: Submit a property inquiry (contact agent) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/InquiryInput" responses: "201": description: Inquiry created content: application/json: schema: $ref: "#/components/schemas/Inquiry" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /contact-messages: post: operationId: createContactMessage tags: [contact] summary: Submit a general contact us message requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ContactMessageInput" responses: "201": description: Contact message created content: application/json: schema: $ref: "#/components/schemas/ContactMessage" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object required: [error] properties: error: type: string User: type: object required: [id, name, email, phone] properties: id: type: string name: type: string email: type: string phone: type: ["string", "null"] AuthState: type: object required: [isAuthenticated, user] properties: isAuthenticated: type: boolean user: oneOf: - $ref: "#/components/schemas/User" - type: "null" RegisterInput: type: object required: [name, email, password] properties: name: type: string minLength: 1 email: type: string phone: type: string password: type: string minLength: 6 LoginInput: type: object required: [email, password] properties: email: type: string password: type: string FavoriteIds: type: array items: type: string FavoriteInput: type: object required: [propertyId] properties: propertyId: type: string Inquiry: type: object required: [id, propertyId, name, email, phone, message, inquiryType, createdAt] properties: id: type: integer propertyId: type: string name: type: string email: type: string phone: type: string message: type: string inquiryType: type: ["string", "null"] createdAt: type: string format: date-time InquiryInput: type: object required: [propertyId, name, email, phone, message] properties: propertyId: type: string name: type: string minLength: 1 email: type: string phone: type: string minLength: 1 message: type: string minLength: 1 inquiryType: type: string ContactMessage: type: object required: [id, name, email, phone, subject, message, createdAt] properties: id: type: integer name: type: string email: type: string phone: type: string subject: type: string message: type: string createdAt: type: string format: date-time ContactMessageInput: type: object required: [name, email, phone, subject, message] properties: name: type: string minLength: 1 email: type: string phone: type: string minLength: 1 subject: type: string minLength: 1 message: type: string minLength: 1