openapi: 3.1.0 info: title: Api version: 0.1.0 description: Ultrofix API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: services description: Service catalog - name: providers description: Service providers - name: bookings description: Booking operations - name: profile description: User profile - name: notifications description: Notifications - name: Auth description: Firebase phone-OTP authentication endpoints. paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /services: get: operationId: listServices tags: [services] summary: List all services parameters: - name: category in: query required: false schema: type: string responses: "200": description: List of services content: application/json: schema: type: array items: $ref: "#/components/schemas/Service" /services/{id}: get: operationId: getService tags: [services] summary: Get service by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Service content: application/json: schema: $ref: "#/components/schemas/Service" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /providers: get: operationId: listProviders tags: [providers] summary: List providers parameters: - name: category in: query required: false schema: type: string responses: "200": description: List of providers content: application/json: schema: type: array items: $ref: "#/components/schemas/Provider" /bookings: get: operationId: listBookings tags: [bookings] summary: List bookings for a user parameters: - name: userId in: query required: false schema: type: string responses: "200": description: List of bookings content: application/json: schema: type: array items: $ref: "#/components/schemas/Booking" post: operationId: createBooking tags: [bookings] summary: Create a new booking requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateBookingBody" responses: "201": description: Created booking content: application/json: schema: $ref: "#/components/schemas/Booking" "400": description: Bad request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /bookings/{id}: get: operationId: getBooking tags: [bookings] summary: Get booking by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Booking content: application/json: schema: $ref: "#/components/schemas/Booking" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" patch: operationId: updateBooking tags: [bookings] summary: Update booking status or rating parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateBookingBody" responses: "200": description: Updated booking content: application/json: schema: $ref: "#/components/schemas/Booking" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /profile/{userId}: get: operationId: getProfile tags: [profile] summary: Get user profile parameters: - name: userId in: path required: true schema: type: string responses: "200": description: User profile content: application/json: schema: $ref: "#/components/schemas/UserProfile" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: upsertProfile tags: [profile] summary: Create or update user profile parameters: - name: userId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpsertProfileBody" responses: "200": description: Upserted profile content: application/json: schema: $ref: "#/components/schemas/UserProfile" /notifications: get: operationId: listNotifications tags: [notifications] summary: List notifications for a user parameters: - name: userId in: query required: false schema: type: string responses: "200": description: List of notifications content: application/json: schema: type: array items: $ref: "#/components/schemas/Notification" /notifications/{id}: patch: operationId: markNotificationRead tags: [notifications] summary: Mark a notification as read parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Updated notification content: application/json: schema: $ref: "#/components/schemas/Notification" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /notifications/mark-all-read: post: operationId: markAllNotificationsRead tags: [notifications] summary: Mark all notifications as read for a user requestBody: required: true content: application/json: schema: type: object properties: userId: type: string required: [userId] responses: "200": description: Success content: application/json: schema: type: object properties: success: type: boolean required: [success] /auth/user: get: tags: [Auth] operationId: getCurrentAuthUser summary: Get the currently authenticated user parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' responses: '200': description: Auth status resolved successfully. content: application/json: schema: $ref: '#/components/schemas/AuthUserEnvelope' /auth/firebase-verify: post: tags: [Auth] operationId: verifyFirebaseIdToken summary: Exchange a Firebase ID token (phone-OTP verified) for a session token requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/FirebaseVerifyRequest' responses: '200': description: Session created successfully. content: application/json: schema: $ref: '#/components/schemas/FirebaseVerifySuccess' '400': description: Missing or invalid Firebase ID token. content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' '401': description: Firebase ID token verification failed. content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /auth/logout: post: tags: [Auth] operationId: logoutSession summary: Delete the current session parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' responses: '200': description: Logout processed. content: application/json: schema: $ref: '#/components/schemas/LogoutSuccess' /auth/role: patch: tags: [Auth] operationId: setUserRole summary: Set the authenticated user's role (consumer or provider) parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SetRoleBody' responses: '200': description: Role updated. content: application/json: schema: $ref: '#/components/schemas/AuthUserEnvelope' '400': description: Invalid role. content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' '401': description: Not authenticated. content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object properties: error: type: string required: - error Service: type: object properties: id: type: integer slug: type: string name: type: string category: type: string description: type: string startingPrice: type: integer rating: type: number reviewCount: type: integer duration: type: string imageKey: type: string popular: type: boolean required: - id - slug - name - category - description - startingPrice - rating - reviewCount - duration - imageKey - popular Provider: type: object properties: id: type: integer slug: type: string name: type: string initials: type: string rating: type: number reviewCount: type: integer jobsCompleted: type: integer specializations: type: array items: type: string experience: type: string verified: type: boolean category: type: string required: - id - slug - name - initials - rating - reviewCount - jobsCompleted - specializations - experience - verified - category Booking: type: object properties: id: type: integer userId: type: string serviceId: type: integer serviceName: type: string providerId: type: integer providerName: type: string providerInitials: type: string date: type: string time: type: string status: type: string enum: [upcoming, completed, cancelled] price: type: integer address: type: string rating: type: ["integer", "null"] createdAt: type: string required: - id - userId - serviceId - serviceName - providerId - providerName - providerInitials - date - time - status - price - address - createdAt CreateBookingBody: type: object properties: userId: type: string serviceId: type: integer providerId: type: integer date: type: string time: type: string address: type: string price: type: integer required: - userId - serviceId - providerId - date - time - address - price UpdateBookingBody: type: object properties: status: type: string enum: [upcoming, completed, cancelled] rating: type: ["integer", "null"] UserProfile: type: object properties: userId: type: string name: type: string email: type: string phone: type: string address: type: string required: - userId - name - email - phone - address UpsertProfileBody: type: object properties: name: type: string email: type: string phone: type: string address: type: string required: - name - email - phone - address Notification: type: object properties: id: type: integer userId: type: string type: type: string icon: type: string iconColor: type: string title: type: string body: type: string read: type: boolean bookingId: type: ["integer", "null"] createdAt: type: string required: - id - userId - type - icon - iconColor - title - body - read - createdAt AuthUser: type: object required: [id] properties: id: type: string phoneNumber: type: ['string', 'null'] email: type: ['string', 'null'] firstName: type: ['string', 'null'] lastName: type: ['string', 'null'] profileImageUrl: type: ['string', 'null'] role: type: ['string', 'null'] enum: ['consumer', 'provider', null] AuthUserEnvelope: type: object required: [user] properties: user: oneOf: - $ref: '#/components/schemas/AuthUser' - type: 'null' FirebaseVerifyRequest: type: object required: [idToken] properties: idToken: type: string minLength: 1 FirebaseVerifySuccess: type: object required: [token, user] properties: token: type: string user: $ref: '#/components/schemas/AuthUser' LogoutSuccess: type: object required: [success] properties: success: type: boolean const: true ErrorEnvelope: type: object required: [error] properties: error: type: string SetRoleBody: type: object required: [role] properties: role: type: string enum: ['consumer', 'provider'] parameters: AuthorizationSessionHeader: name: Authorization in: header required: false schema: type: string pattern: '^Bearer .+' description: Bearer token for mobile session auth.