{"openapi":"3.2.0","info":{"title":"HomeLink Hub API","version":"1.0.0","description":"REST API of the HomeLink Hub platform. Paths, parameters and auth flags are extracted from the Express routes; descriptions and response examples are maintained in openapi/overlay."},"servers":[{"url":"http://localhost:4000","description":"Local development"},{"url":"https://homelinkhub-prod-service.onrender.com","description":"Production"}],"tags":[{"name":"auth","x-displayName":"Authentication","description":"Sign up, sign in, tokens, password reset, social sign-in and KYC."},{"name":"user","x-displayName":"Users & Profile","description":"The signed-in user: profile, security, preferences, bank details and account deletion."},{"name":"property","x-displayName":"Properties","description":"Create, search, read and manage listings, their photos, reviews and availability."},{"name":"review","x-displayName":"Reviews","description":"Stand-alone review endpoints."},{"name":"wishlist","x-displayName":"Wishlist","description":"Saved listings of the signed-in user."},{"name":"inspection","x-displayName":"Inspections","description":"Site-visit requests, availability and review."},{"name":"booking","x-displayName":"Bookings","description":"Booking requests and landlord payment requests."},{"name":"transaction","x-displayName":"Transactions & Payments","description":"Payment initialisation, verification and history."},{"name":"escrow","x-displayName":"Escrow","description":"Escrow-protected payments: initialise, report payment, release and track."},{"name":"earnings","x-displayName":"Earnings & Payouts","description":"Landlord and agent earnings, wallet, bank validation and withdrawals."},{"name":"dashboard","x-displayName":"Agent Dashboard","description":"Aggregates behind the agent and landlord dashboard."},{"name":"legal","x-displayName":"Legal Verification","description":"Lawyer partnerships, assignments, documents and decisions."},{"name":"chat","x-displayName":"Chat","description":"Chat rooms and messages between tenants and agents."},{"name":"stream","x-displayName":"Notification Stream","description":"Server-sent events for realtime notifications."},{"name":"calendar","x-displayName":"Calendar","description":"Google Calendar connection used to sync inspections."},{"name":"settings","x-displayName":"Platform Settings","description":"Global settings: payment mode, fees and map type."},{"name":"admin","x-displayName":"Admin","description":"Admin panel endpoints: users, oversight, platform earnings and duplicate listings."},{"name":"og","x-displayName":"Link Previews","description":"Open Graph pages and images for shared listing links."},{"name":"webhooks","x-displayName":"Webhooks","description":"Callbacks from payment and verification providers."},{"name":"system","x-displayName":"System","description":"Service health."}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Access token returned by sign-in. Send it as `Authorization: Bearer <token>`."},"tokenQuery":{"type":"apiKey","in":"query","name":"token","description":"The same access token as a query parameter, for EventSource clients that cannot set headers."}},"schemas":{"ErrorResponse":{"type":"object","description":"The envelope every error uses.","required":["status","success","message","data"],"properties":{"status":{"type":"integer","description":"HTTP status code, repeated in the body."},"success":{"type":"boolean","description":"Always `false` for errors."},"message":{"type":"string","description":"Human-readable reason. Safe to show to the user."},"data":{"nullable":true,"description":"Always `null` for errors."},"code":{"type":"string","description":"Machine-readable error code, present on some errors."},"errorData":{"type":"object","description":"Extra details, present on some errors."}}}}},"paths":{"/api/v1/health-check":{"get":{"tags":["system"],"operationId":"system_get_health_check","summary":"Check service health","description":"**Access:** Public, no token needed.\n\nLiveness probe for the API. It always answers 200 with a fixed message as long as the Express process is serving requests. It does not touch MongoDB or any third-party provider, so a 200 here does not prove the database is reachable.","security":[],"x-doc-slug":"system/get-health-check","x-short":"Liveness probe for the API.","responses":{"200":{"description":"The service process is up.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Home Link Hub Service is up and running...","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/users":{"get":{"tags":["admin"],"operationId":"admin_get_users","summary":"List users","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nReturns **every** user on the platform, newest first (`createdAt` descending). There is no pagination, search or filtering: the whole collection comes back in one array, including deactivated (`isActive: false`) and soft-deleted (`isDeleted: true`) accounts. `password` and `__v` are stripped, and fields the User model marks `select: false` (KYC numbers, tokens, sessions, push tokens, `bankDetails.accountNumber`, `bankDetails.swiftIban`, Google Calendar connection) are never included. Optional profile fields (`phone`, `avatar`, `businessName`, `bio`, `gender`, `agentAvailability`, `notificationPreferencesConfirmedAt`, parts of `kyc`) are simply absent when unset.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-users","x-short":"Returns every user on the platform, newest first (createdAt descending).","responses":{"200":{"description":"All users, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"authProviders":{"type":"array","items":{"type":"string"}},"phone":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"isEmailVerified":{"type":"boolean"},"isKYCVerified":{"type":"boolean"},"isActive":{"type":"boolean"},"isDeleted":{"type":"boolean"},"kyc":{"type":"object","properties":{"status":{"type":"string"},"verifiedType":{"type":"string"},"verifiedAt":{"type":"string","format":"date-time"},"ninVerifiedAt":{"type":"string","format":"date-time"},"livenessVerifiedAt":{"type":"string","format":"date-time"}},"required":["status","verifiedType","verifiedAt","ninVerifiedAt","livenessVerifiedAt"]},"linkedAccounts":{"type":"array","items":{}},"businessName":{"type":"string"},"bio":{"type":"string"},"twoFactorEnabled":{"type":"boolean"},"theme":{"type":"string"},"language":{"type":"string"},"notificationPreferences":{"type":"object","properties":{"newMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"propertyInquiries":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"inspectionBookings":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"paymentConfirmations":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"systemUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"newPropertyMatches":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"escrowUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"agentMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"priceDropAlerts":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"promotionalEmails":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"lawyerVerificationUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]}},"required":["newMessages","propertyInquiries","inspectionBookings","paymentConfirmations","systemUpdates","newPropertyMatches","escrowUpdates","agentMessages","priceDropAlerts","promotionalEmails","lawyerVerificationUpdates"]},"privacySettings":{"type":"object","properties":{"publicProfileSearch":{"type":"boolean"},"transactionHistoryVisibility":{"type":"boolean"}},"required":["publicProfileSearch","transactionHistoryVisibility"]},"bankDetails":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountHolderName":{"type":"string"}},"required":["bankName","bankCode","accountHolderName"]},"inspectionFee":{"type":"integer"},"address":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"}},"country":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["addresses","country","state","postalCode"]},"wishlist":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","firstName","lastName","email","authProviders","phone","avatar","role","isEmailVerified","isKYCVerified","isActive","isDeleted","kyc","linkedAccounts","businessName","bio","twoFactorEnabled","theme","language","notificationPreferences","privacySettings","bankDetails","inspectionFee","address","wishlist","createdAt","updatedAt"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Users fetched successfully","data":[{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","authProviders":["LOCAL"],"phone":"+2348031234567","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT","isEmailVerified":true,"isKYCVerified":true,"isActive":true,"isDeleted":false,"kyc":{"status":"VERIFIED","verifiedType":"NIN","verifiedAt":"2026-05-20T11:04:09.000Z","ninVerifiedAt":"2026-05-20T10:58:41.000Z","livenessVerifiedAt":"2026-05-20T11:04:09.000Z"},"linkedAccounts":[],"businessName":"Okafor Realty","bio":"Lekki and Ikoyi lettings specialist.","twoFactorEnabled":false,"theme":"SYSTEM","language":"ENGLISH","notificationPreferences":{"newMessages":{"inApp":true,"email":true,"sms":false},"propertyInquiries":{"inApp":true,"email":true,"sms":true},"inspectionBookings":{"inApp":true,"email":true,"sms":false},"paymentConfirmations":{"inApp":true,"email":true,"sms":true},"systemUpdates":{"inApp":false,"email":true,"sms":false},"newPropertyMatches":{"inApp":true,"email":true,"sms":false},"escrowUpdates":{"inApp":true,"email":true,"sms":false},"agentMessages":{"inApp":true,"email":true,"sms":false},"priceDropAlerts":{"inApp":true,"email":true,"sms":false},"promotionalEmails":{"inApp":false,"email":true,"sms":false},"lawyerVerificationUpdates":{"inApp":true,"email":true,"sms":false}},"privacySettings":{"publicProfileSearch":true,"transactionHistoryVisibility":false},"bankDetails":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountHolderName":"CHINEDU OKAFOR"},"inspectionFee":5000,"address":{"addresses":["14 Admiralty Way, Lekki Phase 1"],"country":"Nigeria","state":"Lagos","postalCode":"105102"},"wishlist":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z"}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/users/{id}/status":{"patch":{"tags":["admin"],"operationId":"admin_patch_users_id_status","summary":"Activate or deactivate a user","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nSets the user's `isActive` flag to the value sent (it is a set, not a toggle). Deactivated users are refused at sign-in by the auth controller with `403 Your account has been deactivated. Please contact support.`, but `authenticateUser` does not check `isActive`, so access tokens the user already holds keep working until they expire. No email or notification is sent and nothing stops an admin deactivating their own account. A malformed `id` is not caught: it surfaces as a 500 (Mongoose cast error) rather than a 404.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/patch-users-id-status","x-short":"Sets the user's isActive flag to the value sent (it is a set, not a toggle).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the user to update."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"isActive":{"type":"boolean","description":"`true` to activate, `false` to deactivate. Must be a real JSON boolean; strings are rejected."}},"required":["isActive"]},"examples":{"default":{"value":{"isActive":false}}}}}},"responses":{"200":{"description":"Flag updated. The message ends in `active` or `inactive` to match the value sent; `data` is the updated user (same shape as List users).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"authProviders":{"type":"array","items":{"type":"string"}},"phone":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"isEmailVerified":{"type":"boolean"},"isKYCVerified":{"type":"boolean"},"isActive":{"type":"boolean"},"isDeleted":{"type":"boolean"},"kyc":{"type":"object","properties":{"status":{"type":"string"},"verifiedType":{"type":"string"},"verifiedAt":{"type":"string","format":"date-time"},"ninVerifiedAt":{"type":"string","format":"date-time"},"livenessVerifiedAt":{"type":"string","format":"date-time"}},"required":["status","verifiedType","verifiedAt","ninVerifiedAt","livenessVerifiedAt"]},"linkedAccounts":{"type":"array","items":{}},"businessName":{"type":"string"},"bio":{"type":"string"},"twoFactorEnabled":{"type":"boolean"},"theme":{"type":"string"},"language":{"type":"string"},"notificationPreferences":{"type":"object","properties":{"newMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"propertyInquiries":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"inspectionBookings":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"paymentConfirmations":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"systemUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"newPropertyMatches":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"escrowUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"agentMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"priceDropAlerts":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"promotionalEmails":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"lawyerVerificationUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]}},"required":["newMessages","propertyInquiries","inspectionBookings","paymentConfirmations","systemUpdates","newPropertyMatches","escrowUpdates","agentMessages","priceDropAlerts","promotionalEmails","lawyerVerificationUpdates"]},"privacySettings":{"type":"object","properties":{"publicProfileSearch":{"type":"boolean"},"transactionHistoryVisibility":{"type":"boolean"}},"required":["publicProfileSearch","transactionHistoryVisibility"]},"bankDetails":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountHolderName":{"type":"string"}},"required":["bankName","bankCode","accountHolderName"]},"inspectionFee":{"type":"integer"},"address":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"}},"country":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["addresses","country","state","postalCode"]},"wishlist":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","firstName","lastName","email","authProviders","phone","avatar","role","isEmailVerified","isKYCVerified","isActive","isDeleted","kyc","linkedAccounts","businessName","bio","twoFactorEnabled","theme","language","notificationPreferences","privacySettings","bankDetails","inspectionFee","address","wishlist","createdAt","updatedAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"User status updated to inactive","data":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","authProviders":["LOCAL"],"phone":"+2348031234567","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT","isEmailVerified":true,"isKYCVerified":true,"isActive":false,"isDeleted":false,"kyc":{"status":"VERIFIED","verifiedType":"NIN","verifiedAt":"2026-05-20T11:04:09.000Z","ninVerifiedAt":"2026-05-20T10:58:41.000Z","livenessVerifiedAt":"2026-05-20T11:04:09.000Z"},"linkedAccounts":[],"businessName":"Okafor Realty","bio":"Lekki and Ikoyi lettings specialist.","twoFactorEnabled":false,"theme":"SYSTEM","language":"ENGLISH","notificationPreferences":{"newMessages":{"inApp":true,"email":true,"sms":false},"propertyInquiries":{"inApp":true,"email":true,"sms":true},"inspectionBookings":{"inApp":true,"email":true,"sms":false},"paymentConfirmations":{"inApp":true,"email":true,"sms":true},"systemUpdates":{"inApp":false,"email":true,"sms":false},"newPropertyMatches":{"inApp":true,"email":true,"sms":false},"escrowUpdates":{"inApp":true,"email":true,"sms":false},"agentMessages":{"inApp":true,"email":true,"sms":false},"priceDropAlerts":{"inApp":true,"email":true,"sms":false},"promotionalEmails":{"inApp":false,"email":true,"sms":false},"lawyerVerificationUpdates":{"inApp":true,"email":true,"sms":false}},"privacySettings":{"publicProfileSearch":true,"transactionHistoryVisibility":false},"bankDetails":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountHolderName":"CHINEDU OKAFOR"},"inspectionFee":5000,"address":{"addresses":["14 Admiralty Way, Lekki Phase 1"],"country":"Nigeria","state":"Lagos","postalCode":"105102"},"wishlist":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z"}}}}}}},"400":{"description":"`isActive` is missing or not a boolean","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"isActive must be a boolean","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"404":{"description":"No user with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/users/{id}/role":{"patch":{"tags":["admin"],"operationId":"admin_patch_users_id_role","summary":"Change a user's role","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nOverwrites the user's `role` with one of the `UserRole` values: `TENANT`, `LANDLORD`, `AGENT`, `LAWYER`, `DEVELOPER`, `ADMIN`. The change is immediate for new requests because `authenticateUser` reloads the user (and role) from the database on every call. No email or notification is sent, no KYC state is touched, and an admin can change their own role. A malformed `id` surfaces as a 500 (Mongoose cast error) rather than a 404.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/patch-users-id-role","x-short":"Overwrites the user's role with one of the UserRole values: TENANT, LANDLORD, AGENT, LAWYER, DEVELOPER, ADMIN.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the user to update."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","description":"New role. One of `TENANT`, `LANDLORD`, `AGENT`, `LAWYER`, `DEVELOPER`, `ADMIN` (case-sensitive)."}},"required":["role"]},"examples":{"default":{"value":{"role":"LAWYER"}}}}}},"responses":{"200":{"description":"Role updated. The message ends with the new role; `data` is the updated user (same shape as List users).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"authProviders":{"type":"array","items":{"type":"string"}},"phone":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"isEmailVerified":{"type":"boolean"},"isKYCVerified":{"type":"boolean"},"isActive":{"type":"boolean"},"isDeleted":{"type":"boolean"},"kyc":{"type":"object","properties":{"status":{"type":"string"},"verifiedType":{"type":"string"},"verifiedAt":{"type":"string","format":"date-time"},"ninVerifiedAt":{"type":"string","format":"date-time"},"livenessVerifiedAt":{"type":"string","format":"date-time"}},"required":["status","verifiedType","verifiedAt","ninVerifiedAt","livenessVerifiedAt"]},"linkedAccounts":{"type":"array","items":{}},"businessName":{"type":"string"},"bio":{"type":"string"},"twoFactorEnabled":{"type":"boolean"},"theme":{"type":"string"},"language":{"type":"string"},"notificationPreferences":{"type":"object","properties":{"newMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"propertyInquiries":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"inspectionBookings":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"paymentConfirmations":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"systemUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"newPropertyMatches":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"escrowUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"agentMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"priceDropAlerts":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"promotionalEmails":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"lawyerVerificationUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]}},"required":["newMessages","propertyInquiries","inspectionBookings","paymentConfirmations","systemUpdates","newPropertyMatches","escrowUpdates","agentMessages","priceDropAlerts","promotionalEmails","lawyerVerificationUpdates"]},"privacySettings":{"type":"object","properties":{"publicProfileSearch":{"type":"boolean"},"transactionHistoryVisibility":{"type":"boolean"}},"required":["publicProfileSearch","transactionHistoryVisibility"]},"bankDetails":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountHolderName":{"type":"string"}},"required":["bankName","bankCode","accountHolderName"]},"inspectionFee":{"type":"integer"},"address":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"}},"country":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["addresses","country","state","postalCode"]},"wishlist":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","firstName","lastName","email","authProviders","phone","avatar","role","isEmailVerified","isKYCVerified","isActive","isDeleted","kyc","linkedAccounts","businessName","bio","twoFactorEnabled","theme","language","notificationPreferences","privacySettings","bankDetails","inspectionFee","address","wishlist","createdAt","updatedAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"User role updated to LAWYER","data":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","authProviders":["LOCAL"],"phone":"+2348031234567","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"LAWYER","isEmailVerified":true,"isKYCVerified":true,"isActive":true,"isDeleted":false,"kyc":{"status":"VERIFIED","verifiedType":"NIN","verifiedAt":"2026-05-20T11:04:09.000Z","ninVerifiedAt":"2026-05-20T10:58:41.000Z","livenessVerifiedAt":"2026-05-20T11:04:09.000Z"},"linkedAccounts":[],"businessName":"Okafor Realty","bio":"Lekki and Ikoyi lettings specialist.","twoFactorEnabled":false,"theme":"SYSTEM","language":"ENGLISH","notificationPreferences":{"newMessages":{"inApp":true,"email":true,"sms":false},"propertyInquiries":{"inApp":true,"email":true,"sms":true},"inspectionBookings":{"inApp":true,"email":true,"sms":false},"paymentConfirmations":{"inApp":true,"email":true,"sms":true},"systemUpdates":{"inApp":false,"email":true,"sms":false},"newPropertyMatches":{"inApp":true,"email":true,"sms":false},"escrowUpdates":{"inApp":true,"email":true,"sms":false},"agentMessages":{"inApp":true,"email":true,"sms":false},"priceDropAlerts":{"inApp":true,"email":true,"sms":false},"promotionalEmails":{"inApp":false,"email":true,"sms":false},"lawyerVerificationUpdates":{"inApp":true,"email":true,"sms":false}},"privacySettings":{"publicProfileSearch":true,"transactionHistoryVisibility":false},"bankDetails":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountHolderName":"CHINEDU OKAFOR"},"inspectionFee":5000,"address":{"addresses":["14 Admiralty Way, Lekki Phase 1"],"country":"Nigeria","state":"Lagos","postalCode":"105102"},"wishlist":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z"}}}}}}},"400":{"description":"`role` is missing or not a `UserRole` value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid role specified","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"404":{"description":"No user with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/users/{id}/properties":{"get":{"tags":["admin"],"operationId":"admin_get_users_id_properties","summary":"List a user's properties with their legal review","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nEvery property where the user is the `landlordId` **or** the `agentId`, newest first, with no pagination. Soft-deleted properties are included and flagged with `isDeleted: true`; drafts are included too. Each property carries `legalReview`: the most recent `PropertyVerificationAssignment` for that property (or `null` if none exists), with the lawyer, the decision and checklist, `documents` (the media snapshot frozen when the lawyer was assigned) and `submittedDocuments` (files the lister sent the lawyer, oldest first). `legalReview.status` is one of `assigned`, `accepted`, `in_review`, `changes_requested`, `verified`, `rejected`, `reassigned`. `reviewedAt` and `dueDate` are omitted when unset. The user's role is not checked; a user with no listings returns an empty array.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-users-id-properties","x-short":"Every property where the user is the landlordId or the agentId, newest first, with no pagination.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the landlord or agent."}],"responses":{"200":{"description":"Properties with their latest legal review","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"legalStatus":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"},"verificationNotes":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy","verificationNotes"]},"activeLegalAssignmentId":{"type":"string"},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"isDeleted":{"type":"boolean"},"legalReview":{"type":"object","properties":{"_id":{"type":"string"},"status":{"type":"string"},"lawyer":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar"]},"dueDate":{"type":"string","format":"date-time"},"decision":{"type":"object","properties":{"outcome":{"type":"string"},"notes":{"type":"string"},"checklist":{"type":"array","items":{"type":"object","properties":{"item":{"type":"string"},"status":{"type":"string"},"comment":{"type":"string"},"_id":{"type":"string"}},"required":["item","status","comment","_id"]}},"decidedAt":{"type":"string","format":"date-time"}},"required":["outcome","notes","checklist","decidedAt"]},"documents":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"submittedDocuments":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"documents":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"name":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"integer"}},"required":["url","name","mimeType","size"]}},"note":{"type":"string"},"submittedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar","role"]},"submittedAt":{"type":"string","format":"date-time"}},"required":["_id","documents","note","submittedBy","submittedAt"]}},"reviewedAt":{"type":"string","format":"date-time"}},"required":["_id","status","lawyer","dueDate","decision","documents","submittedDocuments","reviewedAt"]}},"required":["_id","title","type","status","legalStatus","location","pricing","media","verification","activeLegalAssignmentId","deletedAt","createdAt","isDeleted","legalReview"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"User properties fetched successfully","data":[{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","type":"APARTMENT","status":"listed","legalStatus":"legally_verified","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-06-06T10:30:00.000Z","verifiedBy":"665f1c2e9b1d4a0012ab34c3","verificationNotes":"Certificate of Occupancy and survey plan confirmed against the Lagos State Lands Registry."},"activeLegalAssignmentId":"6660a7d49b1d4a0012ab3501","deletedAt":null,"createdAt":"2026-06-04T09:15:22.481Z","isDeleted":false,"legalReview":{"_id":"6660a7d49b1d4a0012ab3501","status":"verified","lawyer":{"_id":"665f1c2e9b1d4a0012ab34c3","firstName":"Folake","lastName":"Adeyemi","email":"folake.adeyemi@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/folake.jpg"},"dueDate":"2026-06-12T17:00:00.000Z","decision":{"outcome":"verified","notes":"Certificate of Occupancy and survey plan confirmed against the Lagos State Lands Registry.","checklist":[{"item":"Certificate of Occupancy","status":"pass","comment":"Registered, no encumbrance","_id":"6660a7d49b1d4a0012ab3580"}],"decidedAt":"2026-06-06T10:30:00.000Z"},"documents":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"submittedDocuments":[{"_id":"6660a7d49b1d4a0012ab3505","documents":[{"url":"https://res.cloudinary.com/example/raw/upload/v1717600000/homelinkhub/media/certificate-of-occupancy.pdf","name":"certificate-of-occupancy.pdf","mimeType":"application/pdf","size":482113}],"note":"C of O attached as requested.","submittedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT"},"submittedAt":"2026-06-05T14:02:10.107Z"}],"reviewedAt":"2026-06-06T10:30:00.000Z"}}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"404":{"description":"No user with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/users/{id}/legal-assignments":{"get":{"tags":["admin"],"operationId":"admin_get_users_id_legal_assignments","summary":"List a lawyer's assignments and counterparties","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nEvery `PropertyVerificationAssignment` whose `lawyerId` is this user, newest first, with the property (and its landlord and agent), the assigner and document submitters populated. `counterparties` is derived from those assignments: one entry per distinct landlord or agent behind the assigned properties, with `propertyCount` (how many of the lawyer's assignments involve them) and `hasOpenWork` (`true` when any of those assignments is not `verified`, `rejected` or `reassigned`). Assignments whose property no longer resolves keep `propertyId: null` and are skipped when building counterparties. The handler does not check that the user is actually a `LAWYER`; any other user simply returns empty lists. No pagination.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-users-id-legal-assignments","x-short":"Every PropertyVerificationAssignment whose lawyerId is this user, newest first, with the property (and its landlord and agent), the assigner and document submitters populated.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the lawyer."}],"responses":{"200":{"description":"Assignments plus the landlords/agents behind them","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"assignments":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar","role"]},"agentId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar","role"]},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"legalStatus":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","landlordId","agentId","title","type","status","legalStatus","location","pricing","media","deletedAt","createdAt"]},"lawyerId":{"type":"string"},"assignedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"}},"required":["_id","firstName","lastName","email"]},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"documents":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"name":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"integer"}},"required":["url","name","mimeType","size"]}},"note":{"type":"string"},"submittedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar","role"]},"submittedAt":{"type":"string","format":"date-time"}},"required":["_id","documents","note","submittedBy","submittedAt"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"counterparties":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar","role"]},"propertyCount":{"type":"integer"},"hasOpenWork":{"type":"boolean"}},"required":["user","propertyCount","hasOpenWork"]}}},"required":["assignments","counterparties"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Legal assignments fetched successfully","data":{"assignments":[{"_id":"6660a7d49b1d4a0012ab3501","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":{"_id":"665f1c2e9b1d4a0012ab34c2","firstName":"Ngozi","lastName":"Balogun","email":"ngozi.balogun@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/ngozi.jpg","role":"LANDLORD"},"agentId":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT"},"title":"3-Bedroom Flat, Lekki Phase 1","type":"APARTMENT","status":"pending_verification","legalStatus":"under_legal_review","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"deletedAt":null,"createdAt":"2026-06-04T09:15:22.481Z"},"lawyerId":"665f1c2e9b1d4a0012ab34c3","assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"in_review","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[{"_id":"6660a7d49b1d4a0012ab3505","documents":[{"url":"https://res.cloudinary.com/example/raw/upload/v1717600000/homelinkhub/media/certificate-of-occupancy.pdf","name":"certificate-of-occupancy.pdf","mimeType":"application/pdf","size":482113}],"note":"C of O attached as requested.","submittedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT"},"submittedAt":"2026-06-05T14:02:10.107Z"}],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":1}],"counterparties":[{"user":{"_id":"665f1c2e9b1d4a0012ab34c2","firstName":"Ngozi","lastName":"Balogun","email":"ngozi.balogun@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/ngozi.jpg","role":"LANDLORD"},"propertyCount":1,"hasOpenWork":true}]}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"404":{"description":"No user with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/dashboard/stats":{"get":{"tags":["admin"],"operationId":"admin_get_dashboard_stats","summary":"Get dashboard statistics","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nPlatform-wide counters for the admin dashboard, computed live on each call. `totalUsers` counts every user document; `newUsersThisMonth` counts sign-ups since the first of the current month (UTC). `totalProperties` excludes soft-deleted properties; `activeListings` is properties with status `listed`; `pendingVerification` is status `pending_verification`; `duplicateFlagsOpen` is duplicate flags still `open`. Money figures come from escrow transactions with status `completed` only: `totalRevenue` is the sum of their `platformFee`, `transactionVolume` the sum of their `amount`, `completedDeals` their count. `escrowsInFlight` counts escrows that are `pending` or `funded`. `userGrowth` always has 12 entries (`JAN` to `DEC`) for the current UTC year; `usersByRole` always has all six roles.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-dashboard-stats","x-short":"Platform-wide counters for the admin dashboard, computed live on each call.","responses":{"200":{"description":"Counters (`userGrowth` trimmed to one of its 12 months)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"totalUsers":{"type":"integer"},"newUsersThisMonth":{"type":"integer"},"totalProperties":{"type":"integer"},"activeListings":{"type":"integer"},"pendingVerification":{"type":"integer"},"duplicateFlagsOpen":{"type":"integer"},"totalRevenue":{"type":"integer"},"transactionVolume":{"type":"integer"},"completedDeals":{"type":"integer"},"escrowsInFlight":{"type":"integer"},"userGrowth":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"users":{"type":"integer"}},"required":["month","users"]}},"usersByRole":{"type":"object","properties":{"TENANT":{"type":"integer"},"LANDLORD":{"type":"integer"},"AGENT":{"type":"integer"},"LAWYER":{"type":"integer"},"DEVELOPER":{"type":"integer"},"ADMIN":{"type":"integer"}},"required":["TENANT","LANDLORD","AGENT","LAWYER","DEVELOPER","ADMIN"]}},"required":["totalUsers","newUsersThisMonth","totalProperties","activeListings","pendingVerification","duplicateFlagsOpen","totalRevenue","transactionVolume","completedDeals","escrowsInFlight","userGrowth","usersByRole"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Dashboard stats fetched successfully","data":{"totalUsers":1284,"newUsersThisMonth":97,"totalProperties":412,"activeListings":288,"pendingVerification":41,"duplicateFlagsOpen":3,"totalRevenue":6450000,"transactionVolume":645000000,"completedDeals":152,"escrowsInFlight":17,"userGrowth":[{"month":"JAN","users":84}],"usersByRole":{"TENANT":941,"LANDLORD":112,"AGENT":187,"LAWYER":31,"DEVELOPER":9,"ADMIN":4}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/dashboard/activity":{"get":{"tags":["admin"],"operationId":"admin_get_dashboard_activity","summary":"Get recent platform activity","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nA merged feed of the 5 most recent sign-ups and the 5 most recently created properties, sorted by time descending and cut to **8** items. Each item has a synthetic `id` (`u_<userId>` or `p_<propertyId>`), a `type` (`signup` or `listing`), an `actor` name, a human-readable `description` and the `time` (the document's `createdAt`). For listings the actor is the property's landlord, or the literal `Unknown` if that user no longer resolves. The property query has no filter, so drafts and soft-deleted properties can appear. Nothing else (payments, inspections, legal decisions) feeds this list.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-dashboard-activity","x-short":"A merged feed of the 5 most recent sign-ups and the 5 most recently created properties, sorted by time descending and cut to 8 items.","responses":{"200":{"description":"Up to 8 items (one of each type shown)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"actor":{"type":"string"},"description":{"type":"string"},"time":{"type":"string","format":"date-time"}},"required":["id","type","actor","description","time"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Recent activity fetched successfully","data":[{"id":"p_665f1c2e9b1d4a0012ab34cd","type":"listing","actor":"Ngozi Balogun","description":"Listed a new apartment — 3-Bedroom Flat, Lekki Phase 1","time":"2026-06-05T14:02:10.107Z"},{"id":"u_665f1c2e9b1d4a0012ab34c4","type":"signup","actor":"Amaka Eze","description":"New tenant signed up","time":"2026-06-04T09:15:22.481Z"}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/inspections":{"get":{"tags":["admin"],"operationId":"admin_get_inspections","summary":"List site visits","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nEvery inspection (site-visit request) on the platform, sorted by `scheduledDate` descending, with no pagination or filters. Cancelled visits and visits on soft-deleted properties are included (`property.isDeleted`). `status` is one of `pending_review`, `in_progress`, `scheduled`, `completed`, `cancelled`; `approval.status` is `pending`, `approved` or `rejected`; `paymentStatus` is `unpaid` or `paid`. `visitor` is the user who requested the visit. `host` is the agent stamped on the inspection once it is paid, falling back to the property's agent, then its landlord. The stored `cancellationReason` field is overloaded: for a non-cancelled visit it is exposed as `visitorNote` (the note the visitor sent with the request) and `cancellationReason` is `null`; for a cancelled visit `visitorNote` is `null` and `cancellationReason` is the stored reason or the approval's `rejectionReason`. `property`, `visitor` and `host` are `null` when the reference no longer resolves; `findings` is `{}` when nothing was recorded.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-inspections","x-short":"Every inspection (site-visit request) on the platform, sorted by scheduledDate descending, with no pagination or filters.","responses":{"200":{"description":"All site visits, latest scheduled date first","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"status":{"type":"string"},"scheduledDate":{"type":"string","format":"date-time"},"completedDate":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"paymentStatus":{"type":"string"},"paymentReference":{"type":"string"},"agentFee":{"type":"integer"},"property":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"coverImage":{"type":"string"},"isDeleted":{"type":"boolean"}},"required":["_id","title","type","location","coverImage","isDeleted"]},"visitor":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"phone":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar","role","phone"]},"host":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"phone":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar","role","phone"]},"approval":{"type":"object","properties":{"status":{"type":"string"},"decidedAt":{"type":"string","format":"date-time"},"notes":{"type":"string"},"rejectionReason":{"nullable":true}},"required":["status","decidedAt","notes","rejectionReason"]},"visitorNote":{"type":"string"},"cancellationReason":{"nullable":true},"cancellationDate":{"nullable":true},"findings":{"type":"object"}},"required":["_id","status","scheduledDate","completedDate","createdAt","updatedAt","paymentStatus","paymentReference","agentFee","property","visitor","host","approval","visitorNote","cancellationReason","cancellationDate","findings"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Site visits fetched successfully","data":[{"_id":"6660a7d49b1d4a0012ab3540","status":"scheduled","scheduledDate":"2026-06-13T10:00:00.000Z","completedDate":null,"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","paymentStatus":"paid","paymentReference":"ps_ref_8f2k1q9x7c","agentFee":5000,"property":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","type":"APARTMENT","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"coverImage":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","isDeleted":false},"visitor":{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","email":"amaka.eze@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg","role":"TENANT","phone":"+2348051112233"},"host":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT","phone":"+2348031234567"},"approval":{"status":"approved","decidedAt":"2026-06-05T14:02:10.107Z","notes":"Gate pass will be left with security.","rejectionReason":null},"visitorNote":"I can only come after 10am.","cancellationReason":null,"cancellationDate":null,"findings":{}}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/earnings":{"get":{"tags":["admin"],"operationId":"admin_get_earnings","summary":"Get platform earnings","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nPlatform revenue overview. `wallet` is the platform ledger: `earned.escrowFees` is the sum of `platformFee` over `completed` escrows and `totalEarned` equals it; `earned.inspectionFees` is the inspection part of that figure, reported as a breakdown and **not** added again. `pending` is the fee on escrows still `pending` or `funded`; `withdrawn` is the total of platform payouts with status `success`; `processing` is platform payouts still `pending` or `processing`; `available = max(totalEarned - withdrawn - processing, 0)`. `currency` is always `NGN`. `revenueTrend` always has 12 entries (`JAN` to `DEC`) for completed escrows created in the current UTC year. `byTransactionType` groups all completed escrows by `transactionType` (`rent`, `purchase`, `inspection`). `payoutAccount` is the configured platform bank account with the number masked to its last four digits, or `null` when none is set.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-earnings","x-short":"Platform revenue overview.","responses":{"200":{"description":"Earnings summary (`revenueTrend` trimmed to one of its 12 months)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"wallet":{"type":"object","properties":{"currency":{"type":"string"},"earned":{"type":"object","properties":{"escrowFees":{"type":"integer"},"inspectionFees":{"type":"integer"}},"required":["escrowFees","inspectionFees"]},"totalEarned":{"type":"integer"},"pending":{"type":"integer"},"withdrawn":{"type":"integer"},"processing":{"type":"integer"},"available":{"type":"integer"}},"required":["currency","earned","totalEarned","pending","withdrawn","processing","available"]},"revenueTrend":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"fees":{"type":"integer"},"volume":{"type":"integer"},"count":{"type":"integer"}},"required":["month","fees","volume","count"]}},"byTransactionType":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"fees":{"type":"integer"},"volume":{"type":"integer"},"count":{"type":"integer"}},"required":["type","fees","volume","count"]}},"payoutAccount":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountName":{"type":"string"},"accountNumberMasked":{"type":"string"}},"required":["bankName","bankCode","accountName","accountNumberMasked"]}},"required":["wallet","revenueTrend","byTransactionType","payoutAccount"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Platform earnings fetched successfully","data":{"wallet":{"currency":"NGN","earned":{"escrowFees":6450000,"inspectionFees":185000},"totalEarned":6450000,"pending":320000,"withdrawn":4000000,"processing":0,"available":2450000},"revenueTrend":[{"month":"JAN","fees":540000,"volume":54000000,"count":12}],"byTransactionType":[{"type":"rent","fees":4100000,"volume":410000000,"count":96}],"payoutAccount":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountName":"HOMELINK HUB LIMITED","accountNumberMasked":"••••6789"}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/payouts":{"get":{"tags":["admin"],"operationId":"admin_get_payouts","summary":"List payouts","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nEvery outbound bank transfer the platform has recorded (agent commissions, seller proceeds, inspection fees, wallet withdrawals, platform fee sweeps and manual platform withdrawals), newest first, for reconciliation. `providerResponse` and `bank.accountNumber` are stripped from each record. `beneficiaryId` is populated with the user's name, email and avatar, and is `null` for platform payouts. `status` is one of `pending`, `processing`, `success`, `failed`; `purpose` is one of `agent_commission`, `platform_fee`, `wallet_withdrawal`, `platform_withdrawal`, `seller_proceeds`, `inspection_fee`; `sourceType` is `escrow`, `inspection`, `booking` or `manual`. Filter values are passed to the query without validation, so an unknown value returns an empty page rather than a 400. `limit` has no upper bound.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-payouts","x-short":"Every outbound bank transfer the platform has recorded (agent commissions, seller proceeds, inspection fees, wallet withdrawals, platform fee sweeps and manual platform withdraw...","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Non-numeric or `0` falls back to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size. Non-numeric or `0` falls back to 20. Not capped."},{"name":"beneficiaryType","in":"query","required":false,"schema":{"type":"string"},"description":"Exact-match filter: `agent` or `platform`."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Exact-match filter: `pending`, `processing`, `success` or `failed`."}],"responses":{"200":{"description":"One page of payouts","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"payouts":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"beneficiaryType":{"type":"string"},"beneficiaryId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar"]},"purpose":{"type":"string"},"sourceType":{"type":"string"},"sourceId":{"type":"string"},"amount":{"type":"integer"},"currency":{"type":"string"},"status":{"type":"string"},"idempotencyKey":{"type":"string"},"bank":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"transactionRef":{"type":"string"},"providerFee":{"type":"integer"},"failureReason":{"nullable":true},"initiatedBy":{"nullable":true},"processedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","beneficiaryType","beneficiaryId","purpose","sourceType","sourceId","amount","currency","status","idempotencyKey","bank","transactionRef","providerFee","failureReason","initiatedBy","processedAt","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["payouts","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Payouts fetched successfully","data":{"payouts":[{"_id":"6660a7d49b1d4a0012ab3530","beneficiaryType":"agent","beneficiaryId":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg"},"purpose":"agent_commission","sourceType":"escrow","sourceId":"6660a7d49b1d4a0012ab3535","amount":225000,"currency":"NGN","status":"success","idempotencyKey":"escrow:6660a7d49b1d4a0012ab3535:agent_commission","bank":{"accountName":"CHINEDU OKAFOR","bankCode":"058","bankName":"Guaranty Trust Bank"},"transactionRef":"TRF_9f2c1a7b4e","providerFee":50,"failureReason":null,"initiatedBy":null,"processedAt":"2026-06-05T14:02:10.107Z","createdAt":"2026-06-05T14:02:10.107Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0}],"pagination":{"page":1,"limit":20,"total":57,"pages":3}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/banks":{"get":{"tags":["admin"],"operationId":"admin_get_banks","summary":"List supported banks","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nProxies the payment provider's (Pandascrow) bank list, for the payout-account form. Each item has `bankName`, `bankCode` (the value to send as `bankCode` when configuring the payout account) and, when the provider supplies it, `nibssBankCode`. The list is fetched from the provider on every call and is not cached server-side. If the provider returns no list, `data` is an empty array.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-banks","x-short":"Proxies the payment provider's (Pandascrow) bank list, for the payout-account form.","responses":{"200":{"description":"Bank list from the provider","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"nibssBankCode":{"type":"string"}},"required":["bankName","bankCode","nibssBankCode"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Banks fetched successfully","data":[{"bankName":"Guaranty Trust Bank","bankCode":"058","nibssBankCode":"000013"}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"The provider request failed. The text after the colon is the provider's own message, or the HTTP client's error message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch banks: <provider message>","data":null}}}}}}}}},"/api/v1/admin/payout-account":{"get":{"tags":["admin"],"operationId":"admin_get_payout_account","summary":"Get the platform payout account","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nThe bank account platform revenue is paid into, read from the singleton settings document, plus the `autoSweepPlatformFees` switch. The account number is never returned in full: `accountNumberMasked` is four bullet characters followed by the last four digits. `account` is `null` until an account number has been configured. When `autoSweepPlatformFees` is `true` the platform fee is transferred to this account as soon as an escrow completes; when `false` (the default) fees accrue and an admin withdraws them with `POST /api/v1/admin/withdraw`.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-payout-account","x-short":"The bank account platform revenue is paid into, read from the singleton settings document, plus the autoSweepPlatformFees switch.","responses":{"200":{"description":"- Configured account\n- No account configured yet","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"account":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountName":{"type":"string"},"accountNumberMasked":{"type":"string"}},"required":["bankName","bankCode","accountName","accountNumberMasked"]},"autoSweepPlatformFees":{"type":"boolean"}},"required":["account","autoSweepPlatformFees"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Configured account","value":{"status":200,"success":true,"message":"Payout account fetched successfully","data":{"account":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountName":"HOMELINK HUB LIMITED","accountNumberMasked":"••••6789"},"autoSweepPlatformFees":false}}},"example2":{"summary":"No account configured yet","value":{"status":200,"success":true,"message":"Payout account fetched successfully","data":{"account":null,"autoSweepPlatformFees":false}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"put":{"tags":["admin"],"operationId":"admin_put_payout_account","summary":"Set the platform payout account","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nCreates or replaces the platform bank account on the singleton settings document (upsert). Before saving, the account number is resolved against the payment provider (Pandascrow `/bank/validate`); if a holder name comes back it **overrides** any `accountName` you sent. Resolution is best-effort: if the provider call fails, the request still succeeds and the supplied `accountName` (or `null`) is stored. `bankName` is stored as sent and is reset to `null` when omitted. `autoSweepPlatformFees` is only changed when the field is present, and it is coerced with JavaScript `Boolean()`, so send a real JSON boolean (the string `\"false\"` would be stored as `true`). The response masks the account number.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/put-payout-account","x-short":"Creates or replaces the platform bank account on the singleton settings document (upsert).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountNumber":{"type":"string","description":"Bank account number (NUBAN). Stored as a string."},"bankCode":{"type":"string","description":"Bank code from `GET /api/v1/admin/banks`."},"bankName":{"type":"string","description":"Display name of the bank. Stored as `null` when omitted."},"accountName":{"type":"string","description":"Account holder name. Used only when the provider cannot resolve the name itself."},"autoSweepPlatformFees":{"type":"boolean","description":"When `true`, platform fees are transferred to this account automatically as each escrow completes. Left unchanged when omitted."}},"required":["accountNumber","bankCode"]},"examples":{"default":{"value":{"accountNumber":"0123456789","bankCode":"058","bankName":"Guaranty Trust Bank","autoSweepPlatformFees":false}}}}}},"responses":{"200":{"description":"Account saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"account":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountName":{"type":"string"},"accountNumberMasked":{"type":"string"}},"required":["bankName","bankCode","accountName","accountNumberMasked"]},"autoSweepPlatformFees":{"type":"boolean"}},"required":["account","autoSweepPlatformFees"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Payout account updated successfully","data":{"account":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountName":"HOMELINK HUB LIMITED","accountNumberMasked":"••••6789"},"autoSweepPlatformFees":false}}}}}}},"400":{"description":"`accountNumber` or `bankCode` is missing or empty","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Missing required fields: accountNumber and bankCode","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/withdraw":{"post":{"tags":["admin"],"operationId":"admin_post_withdraw","summary":"Withdraw platform revenue","description":"**Access:** Bearer token required. **Roles:** `ADMIN`. **Also requires:** Requested amount must not exceed the available platform balance; A platform payout account must be configured unless a one-off destination is supplied.\n\nSends platform revenue to a bank account through the payment provider. `amount` is rounded to the nearest whole number and must not exceed `wallet.available` from `GET /api/v1/admin/earnings`. By default the money goes to the configured platform payout account; sending `accountNumber` (with `bankCode`) in the body redirects this one withdrawal to another account without changing the stored one. A `Payout` record is written first (`beneficiaryType: platform`, `purpose: platform_withdrawal`, `sourceType: manual`, `initiatedBy` = the calling admin, a random idempotency key) and the transfer is then dispatched synchronously: the payout moves `pending` -> `processing` -> `success` or `failed`. On `failed` the endpoint answers **502**, but the failed payout record remains and is visible in `GET /api/v1/admin/payouts`. Each call uses a fresh idempotency key, so retrying after a failure creates a new payout. No email or notification is sent.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/post-withdraw","x-short":"Sends platform revenue to a bank account through the payment provider.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"number","description":"Amount to withdraw in NGN. Coerced with `Number()` and rounded; must be greater than zero."},"accountNumber":{"type":"string","description":"One-off destination account number. When present, the stored payout account is ignored for this withdrawal."},"bankCode":{"type":"string","description":"Bank code for the one-off destination. Effectively required when `accountNumber` is sent; omitting it produces the 'No platform payout account configured' error."},"accountName":{"type":"string","description":"Holder name for the one-off destination."},"bankName":{"type":"string","description":"Bank name for the one-off destination."}},"required":["amount"]},"examples":{"default":{"value":{"amount":1500000}}}}}},"responses":{"200":{"description":"The provider accepted the transfer","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"amount":{"type":"integer"},"currency":{"type":"string"},"status":{"type":"string"},"transactionRef":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","amount","currency","status","transactionRef","createdAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Withdrawal submitted successfully","data":{"_id":"6660a7d49b1d4a0012ab3530","amount":1500000,"currency":"NGN","status":"success","transactionRef":"TRF_9f2c1a7b4e","createdAt":"2026-06-06T10:30:00.000Z"}}}}}}},"400":{"description":"- `amount` is missing, not a number, or rounds to zero or less\n- `amount` is more than the available platform balance. The number in the message is the current `wallet.available`.\n- No stored payout account and no one-off destination, or the destination has no bank code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`amount` is missing, not a number, or rounds to zero or less","value":{"status":400,"success":false,"message":"Withdrawal amount must be greater than zero","data":null}},"example2":{"summary":"`amount` is more than the available platform balance. The number in the message is the current `wallet.available`.","value":{"status":400,"success":false,"message":"Insufficient platform balance. Available: 2450000","data":null}},"example3":{"summary":"No stored payout account and no one-off destination, or the destination has no bank code","value":{"status":400,"success":false,"message":"No platform payout account configured. Set one under payout settings first.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}},"502":{"description":"The provider rejected the transfer or the provider call failed. The message is the payout's `failureReason`: the provider's own message, `Failed to transfer to bank account: <provider message>`, `Transfer was rejected by the provider`, or the fallback shown here.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":502,"success":false,"message":"Withdrawal failed","data":null}}}}}}}}},"/api/v1/admin/duplicate-flags":{"get":{"tags":["admin"],"operationId":"admin_get_duplicate_flags","summary":"List duplicate-listing flags","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nThe admin review queue of listings that the duplicate detector scored as probably the same property as an existing listing (score 60 or more), newest first. A listing has at most one flag, and while its flag is `open` it cannot go live even after legal verification. Each flag has the flagged listing in `propertyId` and the listings it resembles in `matches` (best first), both populated with the review fields plus landlord and agent contact details; each listing's `media.images` is cut to its first 6. `status` is `open` (awaiting an admin), `dismissed` (ruled not a duplicate) or `confirmed` (ruled a duplicate and taken down). `resolvedBy` is populated with the admin's name and email once resolved. `reasons` are human-readable strings produced by the scorer.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-duplicate-flags","x-short":"The admin review queue of listings that the duplicate detector scored as probably the same property as an existing listing (score 60 or more), newest first.","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by flag status: `open`, `dismissed` or `confirmed`. Omit for all."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Values below 1 or non-numeric fall back to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size, clamped to 1-100."}],"responses":{"200":{"description":"One page of flags","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"flags":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"legalStatus":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}}},"required":["images"]},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"agentId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","title","type","status","legalStatus","location","details","pricing","media","landlordId","agentId","deletedAt","createdAt"]},"matches":{"type":"array","items":{"type":"object","properties":{"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"legalStatus":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}}},"required":["images"]},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"agentId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","title","type","status","legalStatus","location","details","pricing","media","landlordId","agentId","deletedAt","createdAt"]},"score":{"type":"integer"},"distanceMeters":{"type":"integer"},"addressSimilarity":{"type":"number"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["propertyId","score","distanceMeters","addressSimilarity","reasons"]}},"topScore":{"type":"integer"},"status":{"type":"string"},"resolvedBy":{"nullable":true},"resolvedAt":{"nullable":true},"resolutionNotes":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","matches","topScore","status","resolvedBy","resolvedAt","resolutionNotes","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["page","limit","total","totalPages"]}},"required":["flags","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Duplicate flags fetched successfully","data":{"flags":[{"_id":"6660a7d49b1d4a0012ab3520","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","type":"APARTMENT","status":"pending_verification","legalStatus":"under_legal_review","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":[]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}]},"landlordId":{"_id":"665f1c2e9b1d4a0012ab34c2","firstName":"Ngozi","lastName":"Balogun","email":"ngozi.balogun@example.com","phone":"+2348029876543","role":"LANDLORD"},"agentId":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","phone":"+2348031234567","role":"AGENT"},"deletedAt":null,"createdAt":"2026-06-04T09:15:22.481Z"},"matches":[{"propertyId":{"_id":"665f1c2e9b1d4a0012ab34ce","title":"Luxury 3 Bed Apartment, Admiralty Way","type":"APARTMENT","status":"listed","legalStatus":"legally_verified","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":[]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}]},"landlordId":{"_id":"665f1c2e9b1d4a0012ab34c2","firstName":"Ngozi","lastName":"Balogun","email":"ngozi.balogun@example.com","phone":"+2348029876543","role":"LANDLORD"},"agentId":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","phone":"+2348031234567","role":"AGENT"},"deletedAt":null,"createdAt":"2026-04-18T08:00:00.000Z"},"score":85,"distanceMeters":12,"addressSimilarity":0.92,"reasons":["Pinned 12 m away","Street address matches","Same property type","Both 3 bedrooms"]}],"topScore":85,"status":"open","resolvedBy":null,"resolvedAt":null,"resolutionNotes":null,"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}],"pagination":{"page":1,"limit":20,"total":3,"totalPages":1}}}}}}}},"400":{"description":"`status` is not one of the allowed values","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"status must be one of: open, dismissed, confirmed","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/duplicate-flags/{id}":{"get":{"tags":["admin"],"operationId":"admin_get_duplicate_flags_id","summary":"Get a duplicate-listing flag","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nOne flag with the flagged listing and every matched listing populated, in the same shape as an item of the list endpoint (images cut to the first 6 per listing, landlord and agent contact details included). A malformed `id` is treated as not found (404), not as a validation error.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-duplicate-flags-id","x-short":"One flag with the flagged listing and every matched listing populated, in the same shape as an item of the list endpoint (images cut to the first 6 per listing, landlord and age...","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the duplicate flag."}],"responses":{"200":{"description":"The flag","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"legalStatus":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}}},"required":["images"]},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"agentId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","title","type","status","legalStatus","location","details","pricing","media","landlordId","agentId","deletedAt","createdAt"]},"matches":{"type":"array","items":{"type":"object","properties":{"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"legalStatus":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}}},"required":["images"]},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"agentId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","email","phone","role"]},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","title","type","status","legalStatus","location","details","pricing","media","landlordId","agentId","deletedAt","createdAt"]},"score":{"type":"integer"},"distanceMeters":{"type":"integer"},"addressSimilarity":{"type":"number"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["propertyId","score","distanceMeters","addressSimilarity","reasons"]}},"topScore":{"type":"integer"},"status":{"type":"string"},"resolvedBy":{"nullable":true},"resolvedAt":{"nullable":true},"resolutionNotes":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","matches","topScore","status","resolvedBy","resolvedAt","resolutionNotes","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Duplicate flag fetched successfully","data":{"_id":"6660a7d49b1d4a0012ab3520","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","type":"APARTMENT","status":"pending_verification","legalStatus":"under_legal_review","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":[]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}]},"landlordId":{"_id":"665f1c2e9b1d4a0012ab34c2","firstName":"Ngozi","lastName":"Balogun","email":"ngozi.balogun@example.com","phone":"+2348029876543","role":"LANDLORD"},"agentId":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","phone":"+2348031234567","role":"AGENT"},"deletedAt":null,"createdAt":"2026-06-04T09:15:22.481Z"},"matches":[{"propertyId":{"_id":"665f1c2e9b1d4a0012ab34ce","title":"Luxury 3 Bed Apartment, Admiralty Way","type":"APARTMENT","status":"listed","legalStatus":"legally_verified","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":[]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}]},"landlordId":{"_id":"665f1c2e9b1d4a0012ab34c2","firstName":"Ngozi","lastName":"Balogun","email":"ngozi.balogun@example.com","phone":"+2348029876543","role":"LANDLORD"},"agentId":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","phone":"+2348031234567","role":"AGENT"},"deletedAt":null,"createdAt":"2026-04-18T08:00:00.000Z"},"score":85,"distanceMeters":12,"addressSimilarity":0.92,"reasons":["Pinned 12 m away","Street address matches","Same property type","Both 3 bedrooms"]}],"topScore":85,"status":"open","resolvedBy":null,"resolvedAt":null,"resolutionNotes":null,"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"404":{"description":"`id` is malformed or no flag has that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Duplicate flag not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/duplicate-flags/{id}/resolve":{"post":{"tags":["admin"],"operationId":"admin_post_duplicate_flags_id_resolve","summary":"Resolve a duplicate-listing flag","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nRecords the admin's decision on an `open` flag; a flag can only be resolved once. **`not_duplicate`** moves the flag `open` -> `dismissed` and lifts the hold: if the listing is `pending_verification` and its `legalStatus` is already `legally_verified` it becomes `listed` immediately, otherwise it goes live when the lawyer verifies it. **`duplicate`** moves the flag `open` -> `confirmed` and takes the listing down: any non-draft, non-deleted listing is set to `unlisted`, `verification.isVerified` becomes `false` and `verification.verificationNotes` is set to `Removed as a duplicate of listing <id of the best match>`. `resolvedBy`, `resolvedAt` and `resolutionNotes` are stored on the flag. `data.flag` is the updated flag with **unpopulated** ids; `data.listingStatus` is the listing's status after the change (`null` if the listing no longer exists). The lister is not emailed or notified.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/post-duplicate-flags-id-resolve","x-short":"Records the admin's decision on an open flag; a flag can only be resolved once.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the duplicate flag."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","description":"`not_duplicate` to dismiss the flag and release the listing, or `duplicate` to confirm it and unlist the listing."},"notes":{"type":"string","description":"Free-text reason, at most 1000 characters. Trimmed; stored as `null` when empty."}},"required":["decision"]},"examples":{"default":{"value":{"decision":"duplicate","notes":"Same flat as the Admiralty Way listing; photos are identical."}}}}}},"responses":{"200":{"description":"- `decision` was `duplicate`\n- `decision` was `not_duplicate`","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"flag":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"matches":{"type":"array","items":{"type":"object","properties":{"propertyId":{"type":"string"},"score":{"type":"integer"},"distanceMeters":{"type":"integer"},"addressSimilarity":{"type":"number"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["propertyId","score","distanceMeters","addressSimilarity","reasons"]}},"topScore":{"type":"integer"},"status":{"type":"string"},"resolvedBy":{"type":"string"},"resolvedAt":{"type":"string","format":"date-time"},"resolutionNotes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","matches","topScore","status","resolvedBy","resolvedAt","resolutionNotes","createdAt","updatedAt","__v"]},"listingStatus":{"type":"string"}},"required":["flag","listingStatus"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"`decision` was `duplicate`","value":{"status":200,"success":true,"message":"Listing removed as a duplicate","data":{"flag":{"_id":"6660a7d49b1d4a0012ab3520","propertyId":"665f1c2e9b1d4a0012ab34cd","matches":[{"propertyId":"665f1c2e9b1d4a0012ab34ce","score":85,"distanceMeters":12,"addressSimilarity":0.92,"reasons":["Pinned 12 m away","Street address matches","Same property type","Both 3 bedrooms"]}],"topScore":85,"status":"confirmed","resolvedBy":"665f1c2e9b1d4a0012ab34c0","resolvedAt":"2026-06-06T10:30:00.000Z","resolutionNotes":"Same flat as the Admiralty Way listing; photos are identical.","createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-06T10:30:00.000Z","__v":0},"listingStatus":"unlisted"}}},"example2":{"summary":"`decision` was `not_duplicate`","value":{"status":200,"success":true,"message":"Flag dismissed; the listing is no longer held","data":{"flag":{"_id":"6660a7d49b1d4a0012ab3520","propertyId":"665f1c2e9b1d4a0012ab34cd","matches":[{"propertyId":"665f1c2e9b1d4a0012ab34ce","score":85,"distanceMeters":12,"addressSimilarity":0.92,"reasons":["Pinned 12 m away","Street address matches","Same property type","Both 3 bedrooms"]}],"topScore":85,"status":"dismissed","resolvedBy":"665f1c2e9b1d4a0012ab34c0","resolvedAt":"2026-06-06T10:30:00.000Z","resolutionNotes":null,"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-06T10:30:00.000Z","__v":0},"listingStatus":"listed"}}}}}}},"400":{"description":"- `decision` is missing or not an allowed value\n- `notes` is not a string or is longer than 1000 characters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`decision` is missing or not an allowed value","value":{"status":400,"success":false,"message":"decision must be one of: not_duplicate, duplicate","data":null}},"example2":{"summary":"`notes` is not a string or is longer than 1000 characters","value":{"status":400,"success":false,"message":"notes must be text of at most 1000 characters","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"404":{"description":"`id` is malformed or no flag has that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Duplicate flag not found","data":null}}}}}},"409":{"description":"The flag is no longer `open` (another admin resolved it first)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":409,"success":false,"message":"This flag has already been resolved","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/featured-collections":{"get":{"tags":["admin"],"operationId":"admin_get_featured_collections","summary":"list","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-featured-collections","x-short":"list","responses":{"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"post":{"tags":["admin"],"operationId":"admin_post_featured_collections","summary":"create","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/post-featured-collections","x-short":"create","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["location","property_type","promotion"]},"location":{"type":"object","properties":{"state":{"oneOf":[{"type":"string","maxLength":80,"x-required":true},{"type":"string","maxLength":80}]},"lga":{"type":"string","maxLength":80},"community":{"type":"string","maxLength":80}},"additionalProperties":false,"oneOf":[{"x-required":true},{}]},"propertyTypes":{"type":"array","items":{"type":"string","enum":["APARTMENT","HOUSE","VILLA","LAND","COMMERCIAL","SHORTLET","OFFICE"]},"uniqueItems":true,"oneOf":[{"type":"array","items":{},"minItems":1,"x-required":true},{}]},"propertyIds":{"type":"array","items":{"type":"string","minLength":24,"maxLength":24},"maxItems":24,"uniqueItems":true,"oneOf":[{"type":"array","items":{},"minItems":1,"x-required":true},{}]},"sortBy":{"type":"string","enum":["newest","top_rated","price_low","price_high"]},"maxItems":{"type":"integer","minimum":1,"maximum":24},"title":{"type":"string","minLength":2,"maxLength":80},"subtitle":{"type":"string","maxLength":200},"badge":{"type":"string","maxLength":30},"isActive":{"type":"boolean"},"startsAt":{"type":["string","null"],"format":"date-time"},"endsAt":{"oneOf":[{"type":["string","null"],"format":"date-time"}]}},"required":["kind","title"],"additionalProperties":false}}}},"responses":{"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"kind\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/featured-collections/options":{"get":{"tags":["admin"],"operationId":"admin_get_featured_collections_options","summary":"options","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-featured-collections-options","x-short":"options","responses":{"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/featured-collections/candidates":{"get":{"tags":["admin"],"operationId":"admin_get_featured_collections_candidates","summary":"candidates","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/get-featured-collections-candidates","x-short":"candidates","responses":{"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/featured-collections/preview":{"post":{"tags":["admin"],"operationId":"admin_post_featured_collections_preview","summary":"preview","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/post-featured-collections-preview","x-short":"preview","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["location","property_type","promotion"]},"location":{"type":"object","properties":{"state":{"oneOf":[{"type":"string","maxLength":80,"x-required":true},{"type":"string","maxLength":80}]},"lga":{"type":"string","maxLength":80},"community":{"type":"string","maxLength":80}},"additionalProperties":false,"oneOf":[{"x-required":true},{}]},"propertyTypes":{"type":"array","items":{"type":"string","enum":["APARTMENT","HOUSE","VILLA","LAND","COMMERCIAL","SHORTLET","OFFICE"]},"uniqueItems":true,"oneOf":[{"type":"array","items":{},"minItems":1,"x-required":true},{}]},"propertyIds":{"type":"array","items":{"type":"string","minLength":24,"maxLength":24},"maxItems":24,"uniqueItems":true,"oneOf":[{"type":"array","items":{},"minItems":1,"x-required":true},{}]},"sortBy":{"type":"string","enum":["newest","top_rated","price_low","price_high"]},"maxItems":{"type":"integer","minimum":1,"maximum":24}},"required":["kind"]}}}},"responses":{"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"kind\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/featured-collections/order":{"put":{"tags":["admin"],"operationId":"admin_put_featured_collections_order","summary":"reorder","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/put-featured-collections-order","x-short":"reorder","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","minLength":24,"maxLength":24},"minItems":1,"uniqueItems":true}},"required":["ids"],"additionalProperties":false}}}},"responses":{"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"ids\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/featured-collections/{id}":{"put":{"tags":["admin"],"operationId":"admin_put_featured_collections_id","summary":"update","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/put-featured-collections-id","x-short":"update","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":24,"maxLength":24}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["location","property_type","promotion"]},"location":{"type":"object","properties":{"state":{"oneOf":[{"type":"string","maxLength":80,"x-required":true},{"type":"string","maxLength":80}]},"lga":{"type":"string","maxLength":80},"community":{"type":"string","maxLength":80}},"additionalProperties":false,"oneOf":[{"x-required":true},{}]},"propertyTypes":{"type":"array","items":{"type":"string","enum":["APARTMENT","HOUSE","VILLA","LAND","COMMERCIAL","SHORTLET","OFFICE"]},"uniqueItems":true,"oneOf":[{"type":"array","items":{},"minItems":1,"x-required":true},{}]},"propertyIds":{"type":"array","items":{"type":"string","minLength":24,"maxLength":24},"maxItems":24,"uniqueItems":true,"oneOf":[{"type":"array","items":{},"minItems":1,"x-required":true},{}]},"sortBy":{"type":"string","enum":["newest","top_rated","price_low","price_high"]},"maxItems":{"type":"integer","minimum":1,"maximum":24},"title":{"type":"string","minLength":2,"maxLength":80},"subtitle":{"type":"string","maxLength":200},"badge":{"type":"string","maxLength":30},"isActive":{"type":"boolean"},"startsAt":{"type":["string","null"],"format":"date-time"},"endsAt":{"oneOf":[{"type":["string","null"],"format":"date-time"}]}},"required":["kind","title"],"additionalProperties":false}}}},"responses":{"400":{"description":"Request validation failed (params, body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"kind\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"delete":{"tags":["admin"],"operationId":"admin_delete_featured_collections_id","summary":"remove","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/delete-featured-collections-id","x-short":"remove","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":24,"maxLength":24}}],"responses":{"400":{"description":"Request validation failed (params). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"id\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/admin/featured-collections/{id}/status":{"patch":{"tags":["admin"],"operationId":"admin_patch_featured_collections_id_status","summary":"setActive","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"admin/patch-featured-collections-id-status","x-short":"setActive","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":24,"maxLength":24}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"isActive":{"type":"boolean"}},"required":["isActive"],"additionalProperties":false}}}},"responses":{"400":{"description":"Request validation failed (params, body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"isActive\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/signup":{"post":{"tags":["auth"],"operationId":"auth_post_signup","summary":"Create an account with email and password","description":"**Access:** Public, no token needed.\n\nCreates an unverified account and emails a verification message (subject \"Verify your HomeLink Hub account\"). Web sign-ups receive a link to `/auth/verify-email?token=...` on the frontend that matches the role (the client app for `AGENT`, `LANDLORD`, `LAWYER` and `DEVELOPER`, the consumer site otherwise); the link token is a JWT that lives as long as an access token (`JWT_ACCESS_EXPIRY`, 15 minutes by default, so production should set a longer value). When `isMobile` is `true` a 4-digit code valid for 15 minutes is sent instead, to be submitted to `POST /auth/verify-email-otp`.\n\n`role` defaults to `TENANT`; `ADMIN` cannot be chosen. `LANDLORD` and `AGENT` accounts are created with a KYC record in `PENDING` status. The password is stored as a bcrypt hash. The email is sent **after** the response and a delivery failure is only logged, so a `201` does not guarantee the email arrived: use `POST /auth/resend-verification` if it does not. No tokens are returned; the user must verify the email and then sign in.","security":[],"x-doc-slug":"auth/post-signup","x-short":"Creates an unverified account and emails a verification message (subject \"Verify your HomeLink Hub account\").","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","minLength":2,"maxLength":50,"description":"Given name, 2-50 characters (trimmed)."},"lastName":{"type":"string","minLength":2,"maxLength":50,"description":"Family name, 2-50 characters (trimmed)."},"email":{"type":"string","format":"email","description":"Email address. Lower-cased and trimmed before it is stored; must be unique."},"password":{"type":"string","minLength":8,"maxLength":128,"description":"Password, 8-128 characters."},"phone":{"type":"string","pattern":"^[\\d+\\-\\s()]+$","description":"Optional phone number. Digits, `+`, `-`, spaces and parentheses only."},"role":{"type":"string","enum":["TENANT","LANDLORD","AGENT","LAWYER","DEVELOPER"],"description":"Account type: `TENANT` (default), `LANDLORD`, `AGENT`, `LAWYER` or `DEVELOPER`."},"isMobile":{"type":"boolean","description":"Send `true` from the mobile app to receive a 4-digit verification code instead of a link."}},"required":["firstName","lastName","email","password"],"additionalProperties":false},"examples":{"default":{"value":{"firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@example.com","password":"S3cure-Passw0rd","phone":"+2348031234567","role":"AGENT","isMobile":false}}}}}},"responses":{"201":{"description":"- Account created; verification link emailed (web)\n- Account created; 4-digit verification code emailed (`isMobile: true`)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"isEmailVerified":{"type":"boolean"}},"required":["firstName","lastName","email","role","isEmailVerified"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Account created; verification link emailed (web)","value":{"status":201,"success":true,"message":"Account created successfully. Please check your email to verify your account.","data":{"firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@example.com","role":"AGENT","isEmailVerified":false}}},"example2":{"summary":"Account created; 4-digit verification code emailed (`isMobile: true`)","value":{"status":201,"success":true,"message":"Account created successfully. Enter the code sent to your email to verify your account.","data":{"firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@example.com","role":"AGENT","isEmailVerified":false}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"firstName\" is required","data":null}}}}}},"403":{"description":"`role` is `ADMIN`. In practice request validation rejects `ADMIN` with a 400 before this check runs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Admin accounts cannot be created","data":null}}}}}},"409":{"description":"An account already uses this email (this includes soft-deleted accounts)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":409,"success":false,"message":"An account with this email already exists.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/verify-email":{"get":{"tags":["auth"],"operationId":"auth_get_verify_email","summary":"Verify an email address with the emailed link token","description":"**Access:** Public, no token needed.\n\nConfirms the email address using the JWT from the verification link and marks the account as verified. The token must be the most recently issued one for the account: requesting a new link or code invalidates earlier ones, and a token cannot be reused after it succeeds. Returns JSON, not a redirect; the frontend page that the link opens is expected to call this endpoint. 4-digit mobile codes are not accepted here (use `POST /auth/verify-email-otp`).\n\nNote that a token that is expired or not a valid JWT is answered with **500**, not 400, because the verification helper throws a plain error.","security":[],"x-doc-slug":"auth/get-verify-email","x-short":"Confirms the email address using the JWT from the verification link and marks the account as verified.","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string"},"description":"The verification token from the `token` query parameter of the emailed link."}],"responses":{"200":{"description":"- Email verified\n- The account was already verified by another route (for example by linking Google or Apple) while this token was still stored","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Email verified","value":{"status":200,"success":true,"message":"Email verified successfully. You can now sign in.","data":null}},"example2":{"summary":"The account was already verified by another route (for example by linking Google or Apple) while this token was still stored","value":{"status":200,"success":true,"message":"Email is already verified.","data":null}}}}}},"400":{"description":"- The token is a valid JWT but is not the one stored for the user (already used, or superseded by a newer link or code)\n- Request validation failed (query). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The token is a valid JWT but is not the one stored for the user (already used, or superseded by a newer link or code)","value":{"status":400,"success":false,"message":"Invalid or expired verification token.","data":null}},"example2":{"summary":"Request validation failed (query). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"token\" is required","data":null}}}}}},"500":{"description":"- The token's JWT expiry has passed\n- The token is not a valid JWT. The message is the `jsonwebtoken` library's own text, for example `jwt malformed` or `invalid signature`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The token's JWT expiry has passed","value":{"status":500,"success":false,"message":"Token has expired","data":null}},"example2":{"summary":"The token is not a valid JWT. The message is the `jsonwebtoken` library's own text, for example `jwt malformed` or `invalid signature`.","value":{"status":500,"success":false,"message":"jwt malformed","data":null}}}}}}}}},"/api/v1/auth/verify-email-otp":{"post":{"tags":["auth"],"operationId":"auth_post_verify_email_otp","summary":"Verify an email address with the 4-digit code","description":"**Access:** Public, no token needed.\n\nMobile counterpart of `GET /auth/verify-email`. Marks the account as verified when the email belongs to an unverified account and the code matches the most recently issued one and is less than 15 minutes old. Codes come from `POST /auth/signup` or `POST /auth/resend-verification` with `isMobile: true`. A wrong code, an expired code, an unknown email and an already-verified account all produce the same 400. No tokens are returned; sign in afterwards.","security":[],"x-doc-slug":"auth/post-verify-email-otp","x-short":"Mobile counterpart of GET /auth/verify-email.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email address the code was sent to."},"code":{"type":"string","pattern":"^[0-9]{4}$","description":"The 4-digit code from the email, as a string."}},"required":["email","code"],"additionalProperties":false},"examples":{"default":{"value":{"email":"adaeze.okonkwo@example.com","code":"4821"}}}}}},"responses":{"200":{"description":"Email verified","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Email verified successfully. You can now sign in.","data":null}}}}}},"400":{"description":"- Wrong or expired code, unknown email, or the account is already verified\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"Wrong or expired code, unknown email, or the account is already verified","value":{"status":400,"success":false,"message":"Invalid or expired verification code.","data":null}},"example2":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"email\" is required","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/signin":{"post":{"tags":["auth"],"operationId":"auth_post_signin","summary":"Sign in with email and password","description":"**Access:** Public, no token needed. **Also requires:** Email verified; Account active.\n\nChecks the credentials and returns an access token, a refresh token and a short user summary. The access token is a JWT carrying `user_id`, `email`, `session_id`, `username` and `role`; send it as `Authorization: Bearer <token>`. The access token lasts `JWT_ACCESS_EXPIRY` (15 minutes by default) and the refresh token `JWT_REFRESH_EXPIRY` (7 days by default).\n\nA session record is stored for the device (device name and browser are derived from the `User-Agent` header, location is the first `X-Forwarded-For` address or the request IP); only the 10 most recent sessions are kept. The account holds **one** refresh token, so signing in overwrites the previous one and refresh tokens issued to other devices stop working. If the account already had at least one session, a `new_device_login` notification (\"New Login Detected\") is created: it is delivered over the `notifications:new` socket event and as a push only if the user's `systemUpdates.inApp` preference is on (off by default), and by email if `systemUpdates.email` is on (on by default).\n\nThe `twoFactorEnabled` flag is **not** consulted here: there is no second step. Accounts created through Google or Apple have no password; signing in to one with a password fails with a 500 (see responses). Soft-deleted accounts are inactive and get the 403 \"deactivated\" response.","security":[],"x-doc-slug":"auth/post-signin","x-short":"Checks the credentials and returns an access token, a refresh token and a short user summary.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Account email (lower-cased and trimmed before lookup)."},"password":{"type":"string","description":"Account password."}},"required":["email","password"],"additionalProperties":false},"examples":{"default":{"value":{"email":"adaeze.okonkwo@example.com","password":"S3cure-Passw0rd"}}}}}},"responses":{"200":{"description":"Signed in","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"avatar":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["id","firstName","lastName","email","role","avatar","isKYCVerified"]}},"required":["accessToken","refreshToken","user"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Sign in successful.","data":{"accessToken":"eyJhbGciOiJIUzI1NiIs...","refreshToken":"eyJhbGciOiJIUzI1NiIs...","user":{"id":"665f1c2e9b1d4a0012ab34cd","firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@example.com","role":"AGENT","avatar":"https://cdn.example.com/avatars/adaeze-okonkwo.jpg","isKYCVerified":true}}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"email\" is required","data":null}}}}}},"401":{"description":"Unknown email or wrong password","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":401,"success":false,"message":"Invalid email or password.","data":null}}}}}},"403":{"description":"- Credentials are correct but the email is not verified. `errorData.code` lets clients detect this case without matching the message.\n- The account is inactive (deactivated or soft-deleted)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"Credentials are correct but the email is not verified. `errorData.code` lets clients detect this case without matching the message.","value":{"status":403,"success":false,"message":"Please verify your email address before signing in.","data":null,"errorData":{"code":"EMAIL_NOT_VERIFIED"}}},"example2":{"summary":"The account is inactive (deactivated or soft-deleted)","value":{"status":403,"success":false,"message":"Your account has been deactivated. Please contact support.","data":null}}}}}},"500":{"description":"The account has no password (created with Google or Apple). The message comes from the bcrypt library.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"data and hash arguments required","data":null}}}}}}}}},"/api/v1/auth/refresh-token":{"post":{"tags":["auth"],"operationId":"auth_post_refresh_token","summary":"Exchange a refresh token for a new access token","description":"**Access:** Public, no token needed.\n\nReturns a new access token for the session encoded in the refresh token. The refresh token is **not** rotated: keep using the same one until it expires or is replaced. It must equal the single refresh token stored on the account, so it stops working after a sign-in on any other device, `POST /auth/signout` with that token, `POST /user/logout-all-devices`, a password reset, or account deletion. The handler does not re-check `isActive` or email verification.\n\nA refresh token that is expired or malformed is answered with **500**, not 401; only a well-formed token that no longer matches the stored one gets 401.","security":[],"x-doc-slug":"auth/post-refresh-token","x-short":"Returns a new access token for the session encoded in the refresh token.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string","description":"The refresh token returned by a sign-in endpoint."}},"required":["refreshToken"],"additionalProperties":false},"examples":{"default":{"value":{"refreshToken":"eyJhbGciOiJIUzI1NiIs..."}}}}}},"responses":{"200":{"description":"New access token issued","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"accessToken":{"type":"string"}},"required":["accessToken"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Access token refreshed.","data":{"accessToken":"eyJhbGciOiJIUzI1NiIs..."}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"refreshToken\" is required","data":null}}}}}},"401":{"description":"The token is a valid JWT but is not the refresh token currently stored for the user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":401,"success":false,"message":"Invalid or expired refresh token.","data":null}}}}}},"500":{"description":"- The refresh token's JWT expiry has passed\n- The refresh token is malformed or has a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The refresh token's JWT expiry has passed","value":{"status":500,"success":false,"message":"Refresh token has expired","data":null}},"example2":{"summary":"The refresh token is malformed or has a bad signature","value":{"status":500,"success":false,"message":"Invalid refresh token","data":null}}}}}}}}},"/api/v1/auth/forgot-password":{"post":{"tags":["auth"],"operationId":"auth_post_forgot_password","summary":"Request a password reset link or code","description":"**Access:** Public, no token needed.\n\nStarts a password reset. Always answers 200, whether or not the email belongs to an account, to prevent email enumeration. For an existing account it emails (subject \"Reset your HomeLink Hub password\") either a link to `/auth/reset-password?token=...` on the frontend matching the user's role (the client app for `AGENT`, `LANDLORD`, `LAWYER` and `DEVELOPER`, the consumer site otherwise) or, when `isMobile` is `true`, a 4-digit code valid for 15 minutes. The link token is a JWT that lives as long as an access token (`JWT_ACCESS_EXPIRY`, 15 minutes by default, so production should set a longer value). Each request replaces the previously issued token or code. Unlike sign-up, the email is sent before the response, so a mail-server failure surfaces as a 500.","security":[],"x-doc-slug":"auth/post-forgot-password","x-short":"Starts a password reset.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email address of the account."},"isMobile":{"type":"boolean","description":"Send `true` from the mobile app to receive a 4-digit code instead of a link."}},"required":["email"],"additionalProperties":false},"examples":{"default":{"value":{"email":"adaeze.okonkwo@example.com","isMobile":false}}}}}},"responses":{"200":{"description":"- Web request (link flow), whether or not the account exists\n- Mobile request (`isMobile: true`, code flow), whether or not the account exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Web request (link flow), whether or not the account exists","value":{"status":200,"success":true,"message":"If that email exists, a password reset link has been sent.","data":null}},"example2":{"summary":"Mobile request (`isMobile: true`, code flow), whether or not the account exists","value":{"status":200,"success":true,"message":"If that email exists, a password reset code has been sent.","data":null}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"email\" is required","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/reset-password":{"post":{"tags":["auth"],"operationId":"auth_post_reset_password","summary":"Set a new password with a reset token or code","description":"**Access:** Public, no token needed.\n\nCompletes a password reset. If `token` is exactly 4 characters long it is treated as the mobile code and `email` is required; otherwise it is treated as the JWT from the reset link and `email` is ignored. The token or code must be the most recently issued one for the account.\n\nOn success the password is replaced, the reset token is cleared and the stored refresh token is removed, so `POST /auth/refresh-token` fails until the user signs in again. Access tokens that were already issued stay valid until they expire, and the session list is not cleared. A `password_changed` notification (\"Password Changed\") is created, delivered in-app, by push and by email according to the user's `systemUpdates` preferences. No tokens are returned.\n\nError statuses for a bad link token are inconsistent: a malformed token gives 400, an expired one gives 500.","security":[],"x-doc-slug":"auth/post-reset-password","x-short":"Completes a password reset.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"Either the JWT from the reset link, or the 4-digit code from the mobile reset email."},"password":{"type":"string","minLength":8,"maxLength":128,"description":"The new password, 8-128 characters."},"email":{"type":"string","format":"email","description":"Account email. Required when `token` is a 4-digit code; ignored for link tokens."}},"required":["token","password"],"additionalProperties":false},"examples":{"default":{"value":{"token":"4821","password":"N3w-S3cure-Passw0rd","email":"adaeze.okonkwo@example.com"}}}}}},"responses":{"200":{"description":"Password changed","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Password reset successfully. Please sign in with your new password.","data":null}}}}}},"400":{"description":"- `token` is a 4-digit code but `email` was not sent\n- The code is wrong, older than 15 minutes, superseded, or does not belong to this email\n- The link token is a valid JWT but is not the one stored for the user (already used or superseded)\n- The link token is malformed or has a bad signature\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`token` is a 4-digit code but `email` was not sent","value":{"status":400,"success":false,"message":"Email is required for password reset via code.","data":null}},"example2":{"summary":"The code is wrong, older than 15 minutes, superseded, or does not belong to this email","value":{"status":400,"success":false,"message":"Invalid or expired password reset code.","data":null}},"example3":{"summary":"The link token is a valid JWT but is not the one stored for the user (already used or superseded)","value":{"status":400,"success":false,"message":"Invalid or expired password reset token.","data":null}},"example4":{"summary":"The link token is malformed or has a bad signature","value":{"status":400,"success":false,"message":"Invalid token","data":null}},"example5":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"token\" is required","data":null}}}}}},"500":{"description":"- The link token's JWT expiry has passed\n- The link token verifies but carries no email claim","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The link token's JWT expiry has passed","value":{"status":500,"success":false,"message":"Token has expired","data":null}},"example2":{"summary":"The link token verifies but carries no email claim","value":{"status":500,"success":false,"message":"An error occurred while verifying the token","data":null}}}}}}}}},"/api/v1/auth/resend-verification":{"post":{"tags":["auth"],"operationId":"auth_post_resend_verification","summary":"Resend the email verification link or code","description":"**Access:** Public, no token needed.\n\nIssues a fresh verification link, or a fresh 4-digit code valid for 15 minutes when `isMobile` is `true`, and emails it. Always answers 200 with a generic message, whether the email is unknown, already verified, or actually sent, to prevent email enumeration. The new token or code replaces the previous one, which stops working. The email is sent before the response, so a mail-server failure surfaces as a 500. The mobile app calls this after a sign-in is rejected with `errorData.code` = `EMAIL_NOT_VERIFIED`.","security":[],"x-doc-slug":"auth/post-resend-verification","x-short":"Issues a fresh verification link, or a fresh 4-digit code valid for 15 minutes when isMobile is true, and emails it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email address of the account to verify."},"isMobile":{"type":"boolean","description":"Send `true` from the mobile app to receive a 4-digit code instead of a link."}},"required":["email"],"additionalProperties":false},"examples":{"default":{"value":{"email":"adaeze.okonkwo@example.com","isMobile":true}}}}}},"responses":{"200":{"description":"- Web request (link flow)\n- Mobile request (`isMobile: true`, code flow)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Web request (link flow)","value":{"status":200,"success":true,"message":"If that email exists and is unverified, a new verification link has been sent.","data":null}},"example2":{"summary":"Mobile request (`isMobile: true`, code flow)","value":{"status":200,"success":true,"message":"If that email exists and is unverified, a new verification code has been sent.","data":null}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"email\" is required","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/signout":{"post":{"tags":["auth"],"operationId":"auth_post_signout","summary":"Sign out of the current session","description":"**Access:** Public. Sending a bearer token is optional and personalises the result.\n\nEnds a session. The route has no auth middleware and is idempotent: it **always** answers 200, even with no body, an invalid token or an expired token. The user and session are taken from `refreshToken` in the body if it verifies, otherwise from an `Authorization: Bearer <access token>` header if one is sent.\n\nWith a valid `refreshToken` that matches the one stored on the account, the stored refresh token is removed and the session is deleted from the session list. With only a bearer access token, the session is removed from the list but the stored refresh token is left in place. The access token itself is not revoked and keeps working until it expires. `session_id` is accepted by validation but ignored. Push tokens are not touched: call `DELETE /user/push-tokens` to stop pushes to the device.","security":[{},{"bearerAuth":[]}],"x-doc-slug":"auth/post-signout","x-short":"Ends a session.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string","description":"The session's refresh token. Recommended: without it the stored refresh token is not invalidated."},"session_id":{"type":"string","description":"Accepted but not used by the handler."}},"additionalProperties":false},"examples":{"default":{"value":{"refreshToken":"eyJhbGciOiJIUzI1NiIs..."}}}}}},"responses":{"200":{"description":"Always, whether or not a session was actually found and removed","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Signed out successfully.","data":null}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"field\" is required","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/google":{"get":{"tags":["auth"],"operationId":"auth_get_google","summary":"Get the Google OAuth consent URL","description":"**Access:** Public, no token needed.\n\nBuilds the Google OAuth 2.0 authorisation URL for the web sign-in flow and returns it as JSON; it does not redirect. Send the browser to `data.authUrl`. Google then redirects to the redirect URI configured for the chosen frontend with a `code` and a `state` (`web`, or `app` when `app=true` was passed), which the frontend forwards to `GET /auth/google/callback`. The requested scopes are the user's email and basic profile, with `access_type=offline` and `prompt=consent`.","security":[],"x-doc-slug":"auth/get-google","x-short":"Builds the Google OAuth 2.0 authorisation URL for the web sign-in flow and returns it as JSON; it does not redirect.","parameters":[{"name":"app","in":"query","required":false,"schema":{"type":"string"},"description":"Pass `true` to use the OAuth client (and redirect URI) of the client app for agents and landlords; any other value or omission uses the consumer web app."}],"responses":{"200":{"description":"URL generated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"authUrl":{"type":"string"}},"required":["authUrl"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Google OAuth URL generated.","data":{"authUrl":"https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&prompt=consent&state=web&response_type=code&client_id=<google-client-id>&redirect_uri=<configured-redirect-uri>"}}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/google/callback":{"get":{"tags":["auth"],"operationId":"auth_get_google_callback","summary":"Complete Google sign-in with an authorisation code","description":"**Access:** Public, no token needed.\n\nExchanges the authorisation code from Google's redirect for the user's Google profile, then signs the user in. Returns JSON in the same shape as `POST /auth/signin`; it does not redirect, so the frontend page that receives Google's redirect must call it with the `code` and `state`.\n\nThe account is matched by Google ID first, then by email. An existing account with the same email gets Google linked to it, is marked email-verified and has its avatar replaced by the Google picture. If no account exists, a new `TENANT` account is created, already email-verified, with no password. A session record is stored for the device (device name and browser are derived from the `User-Agent` header, location is the first `X-Forwarded-For` address or the request IP); only the 10 most recent sessions are kept. The account holds **one** refresh token, so signing in overwrites the previous one and refresh tokens issued to other devices stop working. If the account already had at least one session, a `new_device_login` notification (\"New Login Detected\") is created: it is delivered over the `notifications:new` socket event and as a push only if the user's `systemUpdates.inApp` preference is on (off by default), and by email if `systemUpdates.email` is on (on by default).\n\nUnlike password and Apple sign-in, this handler does not check whether the account is active. If Google rejects the code (already used, expired, wrong redirect URI) the error from the Google client library is passed through; the response uses the HTTP status Google answered with and the library's message (for example `invalid_grant`), so treat any non-200 here as a failed sign-in rather than matching on a fixed message.","security":[],"x-doc-slug":"auth/get-google-callback","x-short":"Exchanges the authorisation code from Google's redirect for the user's Google profile, then signs the user in.","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string"},"description":"The one-time authorisation code Google appended to the redirect URI."},{"name":"state","in":"query","required":false,"schema":{"type":"string"},"description":"The `state` value Google returned. `app` selects the client-app OAuth client; anything else (normally `web`) selects the consumer web app. Must match the client used to start the flow."}],"responses":{"200":{"description":"Signed in (existing, newly linked or newly created account)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["id","firstName","lastName","email","avatar","role","isKYCVerified"]}},"required":["accessToken","refreshToken","user"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Google sign-in successful.","data":{"accessToken":"eyJhbGciOiJIUzI1NiIs...","refreshToken":"eyJhbGciOiJIUzI1NiIs...","user":{"id":"665f1c2e9b1d4a0012ab34cd","firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@gmail.com","avatar":"https://lh3.googleusercontent.com/a/ACg8ocK...=s96-c","role":"TENANT","isKYCVerified":false}}}}}}}},"400":{"description":"- Google returned a profile without an email or ID\n- Request validation failed (query). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"Google returned a profile without an email or ID","value":{"status":400,"success":false,"message":"Failed to retrieve user information from Google.","data":null}},"example2":{"summary":"Request validation failed (query). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"code\" is required","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/google/native":{"post":{"tags":["auth"],"operationId":"auth_post_google_native","summary":"Sign in with a Google ID token (mobile)","description":"**Access:** Public, no token needed.\n\nNative Google Sign-In for the mobile app. Verifies the ID token against the server's configured Google client IDs, then signs the user in and returns the same body as `POST /auth/signin`. There is no request validation schema on this route; the handler checks only that `idToken` is a non-empty string.\n\nThe account is matched by Google ID first, then by email. An existing account with the same email gets Google linked, is marked email-verified and has its avatar replaced by the Google picture. Otherwise a new account is created, already email-verified and with no password, with the requested `role` (`TENANT` or `AGENT`; anything else becomes `TENANT`). New `AGENT` accounts start with a `PENDING` KYC record. `role` is ignored for existing accounts. A session record is stored for the device (device name and browser are derived from the `User-Agent` header, location is the first `X-Forwarded-For` address or the request IP); only the 10 most recent sessions are kept. The account holds **one** refresh token, so signing in overwrites the previous one and refresh tokens issued to other devices stop working. If the account already had at least one session, a `new_device_login` notification (\"New Login Detected\") is created: it is delivered over the `notifications:new` socket event and as a push only if the user's `systemUpdates.inApp` preference is on (off by default), and by email if `systemUpdates.email` is on (on by default).\n\nThis handler does not check whether the account is active. An ID token that fails verification (bad signature, wrong audience, expired) is answered with a 500 whose message is the Google library's own text.","security":[],"x-doc-slug":"auth/post-google-native","x-short":"Native Google Sign-In for the mobile app.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"idToken":{"type":"string","description":"The ID token returned by the Google Sign-In SDK on the device."},"role":{"type":"string","description":"Account type to create if this Google account is new: `TENANT` (default) or `AGENT`. Any other value is treated as `TENANT`. Ignored when the account already exists."}},"required":["idToken"]},"examples":{"default":{"value":{"idToken":"eyJhbGciOiJSUzI1NiIs...","role":"TENANT"}}}}}},"responses":{"200":{"description":"Signed in (existing, newly linked or newly created account)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["id","firstName","lastName","email","avatar","role","isKYCVerified"]}},"required":["accessToken","refreshToken","user"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Google sign-in successful.","data":{"accessToken":"eyJhbGciOiJIUzI1NiIs...","refreshToken":"eyJhbGciOiJIUzI1NiIs...","user":{"id":"665f1c2e9b1d4a0012ab34cd","firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@gmail.com","avatar":"https://lh3.googleusercontent.com/a/ACg8ocK...=s96-c","role":"TENANT","isKYCVerified":false}}}}}}}},"400":{"description":"- `idToken` is missing or not a string\n- The token verified but carries no email or subject","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`idToken` is missing or not a string","value":{"status":400,"success":false,"message":"Google idToken is required.","data":null}},"example2":{"summary":"The token verified but carries no email or subject","value":{"status":400,"success":false,"message":"Failed to verify Google ID token.","data":null}}}}}},"500":{"description":"The server has no Google client IDs configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Google sign-in is not configured.","data":null}}}}}}}}},"/api/v1/auth/apple/native":{"post":{"tags":["auth"],"operationId":"auth_post_apple_native","summary":"Sign in with Apple (mobile)","description":"**Access:** Public, no token needed. **Also requires:** Account active.\n\nNative Sign in with Apple. Verifies the identity token (signature against Apple's published keys, issuer, audience and expiry), then signs the user in and returns the same body as `POST /auth/signin`.\n\nThe account is matched by Apple's stable user ID first. Otherwise Apple must have shared a **verified** email: an existing account with that email gets Apple linked and is marked email-verified; if none exists a new account is created, already email-verified and with no password, with the requested `role` (`TENANT` by default, or `AGENT`, which starts with a `PENDING` KYC record). Apple only provides the user's name on the very first authorisation and never in the token, so the app should forward `firstName` and `lastName` then; when they are missing the first name falls back to the email's local part (not for Hide My Email relay addresses) or `Apple`, and the last name to `User`. `role` and the names are ignored for existing accounts.\n\nIf `authorizationCode` is sent and the server has an Apple key configured, it is exchanged for an Apple refresh token that is stored so the link can be revoked when the account is deleted; a failure there is logged and does not block sign-in. A session record is stored for the device (device name and browser are derived from the `User-Agent` header, location is the first `X-Forwarded-For` address or the request IP); only the 10 most recent sessions are kept. The account holds **one** refresh token, so signing in overwrites the previous one and refresh tokens issued to other devices stop working. If the account already had at least one session, a `new_device_login` notification (\"New Login Detected\") is created: it is delivered over the `notifications:new` socket event and as a push only if the user's `systemUpdates.inApp` preference is on (off by default), and by email if `systemUpdates.email` is on (on by default). Accounts created this way have no avatar, so `user.avatar` is omitted.","security":[],"x-doc-slug":"auth/post-apple-native","x-short":"Native Sign in with Apple.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identityToken":{"type":"string","description":"The identity token (JWT) returned by Sign in with Apple on the device."},"authorizationCode":{"type":["string","null"],"description":"The one-time authorisation code from the same Apple response. Optional; may be empty or null."},"firstName":{"type":["string","null"],"maxLength":100,"description":"Given name from Apple's first-authorisation response. Optional, up to 100 characters; only used when the account is created."},"lastName":{"type":["string","null"],"maxLength":100,"description":"Family name from Apple's first-authorisation response. Optional, up to 100 characters; only used when the account is created."},"role":{"type":"string","enum":["TENANT","AGENT"],"description":"Account type to create if this Apple ID is new: `TENANT` (default) or `AGENT`. Ignored when the account already exists."}},"required":["identityToken"],"additionalProperties":false},"examples":{"default":{"value":{"identityToken":"eyJraWQiOiJXNldjT0tCIiwiYWxnIjoiUlMyNTYifQ...","authorizationCode":"c6a1f2b3d4e5f67890ab.0.rrtw.Xy1Zq2Wv3Ut4Sr5Qp6On7M","firstName":"Adaeze","lastName":"Okonkwo","role":"TENANT"}}}}}},"responses":{"200":{"description":"Signed in (existing, newly linked or newly created account)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["id","firstName","lastName","email","role","isKYCVerified"]}},"required":["accessToken","refreshToken","user"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Apple sign-in successful.","data":{"accessToken":"eyJhbGciOiJIUzI1NiIs...","refreshToken":"eyJhbGciOiJIUzI1NiIs...","user":{"id":"665f1c2e9b1d4a0012ab34cd","firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@icloud.com","role":"TENANT","isKYCVerified":false}}}}}}}},"400":{"description":"- No account is linked to this Apple ID yet and the token carries no verified email\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No account is linked to this Apple ID yet and the token carries no verified email","value":{"status":400,"success":false,"message":"Apple did not share a verified email address. Please sign up with email instead.","data":null}},"example2":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"identityToken\" is required","data":null}}}}}},"401":{"description":"The identity token failed verification (malformed, bad signature, wrong audience or issuer, expired, or Apple sign-in is not configured on the server)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":401,"success":false,"message":"Failed to verify Apple sign-in. Please try again.","data":null}}}}}},"403":{"description":"The account is inactive (deactivated or soft-deleted)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Your account has been deactivated. Please contact support.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/kyc/status":{"get":{"tags":["auth"],"operationId":"auth_get_kyc_status","summary":"Get the signed-in user's KYC status","description":"**Access:** Bearer token required.\n\nReports where the user stands in identity verification so a client can resume the flow instead of restarting it. `status` is one of `PENDING`, `AWAITING_LIVENESS`, `VERIFIED` or `REJECTED`, and is `PENDING` when the account has no KYC record. `ninVerifiedAt` and `livenessVerifiedAt` are `null` until those steps have passed. `legacyVerification` is `true` when the account is KYC-verified but has no liveness timestamp; because the liveness step is currently switched off, that is the case for every account verified through `POST /auth/kyc/verify`.","security":[{"bearerAuth":[]}],"x-doc-slug":"auth/get-kyc-status","x-short":"Reports where the user stands in identity verification so a client can resume the flow instead of restarting it.","responses":{"200":{"description":"Status returned","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"status":{"type":"string"},"isKYCVerified":{"type":"boolean"},"ninVerifiedAt":{"type":"string","format":"date-time"},"livenessVerifiedAt":{"nullable":true},"legacyVerification":{"type":"boolean"}},"required":["status","isKYCVerified","ninVerifiedAt","livenessVerifiedAt","legacyVerification"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"KYC status fetched successfully.","data":{"status":"VERIFIED","isKYCVerified":true,"ninVerifiedAt":"2026-03-14T10:22:31.000Z","livenessVerifiedAt":null,"legacyVerification":true}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/auth/kyc/nin":{"post":{"tags":["auth"],"operationId":"auth_post_kyc_nin","summary":"Verify a NIN (step one of the two-step KYC flow)","description":"**Access:** Bearer token required. **Also requires:** KYC not already verified.\n\nLooks the NIN up with the identity provider (PandaScrow) and compares the name on the record with the name on the account: every word of the account's first and last name must appear among the record's first, middle and last names (case, accents and order are ignored). On a match the NIN is stored and the KYC status moves to `AWAITING_LIVENESS`. This does **not** set `isKYCVerified`; the step was designed to be followed by a liveness check.\n\nNo liveness endpoint is currently exposed by this API, so an account that only completes this step stays in `AWAITING_LIVENESS`. The path that completes verification today is `POST /auth/kyc/verify` with `kycType: \"NIN\"`. The names returned in `data` are the ones on the NIN record, not the account.","security":[{"bearerAuth":[]}],"x-doc-slug":"auth/post-kyc-nin","x-short":"Looks the NIN up with the identity provider (PandaScrow) and compares the name on the record with the name on the account: every word of the account's first and last name must a...","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"nin":{"type":"string","pattern":"^[0-9]{11}$","description":"National Identification Number: exactly 11 digits."}},"required":["nin"],"additionalProperties":false},"examples":{"default":{"value":{"nin":"12345678901"}}}}}},"responses":{"200":{"description":"NIN found and the name matches","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"status":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["status","firstName","lastName"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"NIN verified. One step left.","data":{"status":"AWAITING_LIVENESS","firstName":"ADAEZE","lastName":"OKONKWO"}}}}}}},"400":{"description":"- The account is already KYC-verified\n- The NIN exists but the names on the record do not contain every word of the account's first and last name\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The account is already KYC-verified","value":{"status":400,"success":false,"message":"KYC is already verified for this account.","data":null}},"example2":{"summary":"The NIN exists but the names on the record do not contain every word of the account's first and last name","value":{"status":400,"success":false,"message":"The name on this NIN does not match the name on your account.","data":null}},"example3":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"nin\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"- The provider returned no record for this NIN\n- The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The provider returned no record for this NIN","value":{"status":404,"success":false,"message":"That NIN could not be found. Please check and try again.","data":null}},"example2":{"summary":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"The identity provider answered 2xx but flagged the lookup as unsuccessful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"PandaScrow NIN lookup returned unsuccessful status.","data":null}}}}}},"502":{"description":"The identity provider (PandaScrow) request failed (network error, bad credentials, billing, any non-2xx)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":502,"success":false,"message":"Identity verification is temporarily unavailable. Please try again later.","data":null}}}}}}}}},"/api/v1/auth/kyc/verify":{"post":{"tags":["auth"],"operationId":"auth_post_kyc_verify","summary":"Verify identity or record a KYC document","description":"**Access:** Bearer token required. **Also requires:** KYC not already verified.\n\nRuns a provider lookup (PandaScrow) for the chosen `kycType` and records the result on the account.\n\n- `NIN`: the NIN must exist and the name on the record must contain every word of the account's first and last name (case, accents and order ignored). On success the account is marked **KYC-verified** immediately (`kyc.status` = `VERIFIED`, `isKYCVerified` = `true`) because the liveness step is temporarily disabled. The account's `gender` is also set from the record when it is male or female.\n- `DRIVERS_LICENSE`: the licence is looked up and the number stored. This does **not** verify the account.\n- `CAC`: the company name is searched and stored if at least one match is found. This does **not** verify the account.\n- `BVN`: accepted by request validation but rejected by the handler as unsupported.\n\nOnly the field that matches `kycType` is required. Unlike `POST /auth/kyc/nin`, `nin` is not checked for the 11-digit format here. Stored document numbers are never returned by the API. Failed driver's-licence and CAC provider calls surface as 500 with the provider's message appended.","security":[{"bearerAuth":[]}],"x-doc-slug":"auth/post-kyc-verify","x-short":"Runs a provider lookup (PandaScrow) for the chosen kycType and records the result on the account.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kycType":{"type":"string","enum":["NIN","BVN","DRIVERS_LICENSE","CAC"],"description":"Document type: `NIN`, `DRIVERS_LICENSE` or `CAC`. `BVN` passes validation but is rejected with a 400."},"nin":{"oneOf":[{"type":"string","x-required":true},{"type":"string"}],"description":"National Identification Number. Required when `kycType` is `NIN`."},"licenseNumber":{"oneOf":[{"type":"string","x-required":true},{"type":"string"}],"description":"Driver's licence number. Required when `kycType` is `DRIVERS_LICENSE`."},"companyName":{"oneOf":[{"type":"string","x-required":true},{"type":"string"}],"description":"Registered company name to search the CAC registry for. Required when `kycType` is `CAC`."}},"required":["kycType"],"additionalProperties":false},"examples":{"default":{"value":{"kycType":"NIN","nin":"12345678901"}}}}}},"responses":{"200":{"description":"- `kycType` = `NIN`: identity verified\n- `kycType` = `DRIVERS_LICENSE` or `CAC`: document stored, account not verified","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"status":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["status","isKYCVerified"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"`kycType` = `NIN`: identity verified","value":{"status":200,"success":true,"message":"Identity verified.","data":{"status":"VERIFIED","isKYCVerified":true}}},"example2":{"summary":"`kycType` = `DRIVERS_LICENSE` or `CAC`: document stored, account not verified","value":{"status":200,"success":true,"message":"Document recorded successfully.","data":null}}}}}},"400":{"description":"- `kycType` is `BVN`\n- The account is already KYC-verified\n- NIN: The NIN exists but the names on the record do not contain every word of the account's first and last name\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`kycType` is `BVN`","value":{"status":400,"success":false,"message":"BVN verification is not currently supported. Supported types: NIN, DRIVERS_LICENSE, CAC.","data":null}},"example2":{"summary":"The account is already KYC-verified","value":{"status":400,"success":false,"message":"KYC is already verified for this account.","data":null}},"example3":{"summary":"NIN: The NIN exists but the names on the record do not contain every word of the account's first and last name","value":{"status":400,"success":false,"message":"The name on this NIN does not match the name on your account.","data":null}},"example4":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"kycType\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"- NIN: The provider returned no record for this NIN\n- CAC: the registry search returned no companies\n- The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"NIN: The provider returned no record for this NIN","value":{"status":404,"success":false,"message":"That NIN could not be found. Please check and try again.","data":null}},"example2":{"summary":"CAC: the registry search returned no companies","value":{"status":404,"success":false,"message":"No company found matching the provided name.","data":null}},"example3":{"summary":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"- NIN: The identity provider answered 2xx but flagged the lookup as unsuccessful\n- DRIVERS_LICENSE: the provider request failed. The provider's own message follows the colon.\n- CAC: the provider request failed. The provider's own message follows the colon.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"NIN: The identity provider answered 2xx but flagged the lookup as unsuccessful","value":{"status":500,"success":false,"message":"PandaScrow NIN lookup returned unsuccessful status.","data":null}},"example2":{"summary":"DRIVERS_LICENSE: the provider request failed. The provider's own message follows the colon.","value":{"status":500,"success":false,"message":"Driver's License lookup request failed: <provider message>","data":null}},"example3":{"summary":"CAC: the provider request failed. The provider's own message follows the colon.","value":{"status":500,"success":false,"message":"CAC lookup request failed: <provider message>","data":null}}}}}},"502":{"description":"NIN: The identity provider (PandaScrow) request failed (network error, bad credentials, billing, any non-2xx)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":502,"success":false,"message":"Identity verification is temporarily unavailable. Please try again later.","data":null}}}}}}}}},"/api/v1/user/profile":{"get":{"tags":["user"],"operationId":"user_get_profile","summary":"Get the signed-in user's profile","description":"**Access:** Bearer token required.\n\nReturns the authenticated user's own profile, including preferences and their payout bank details with the full account number (this is the only place, with `PUT /user/bank-details`, where `accountNumber` and `swiftIban` are returned). Fields that have never been set (`phone`, `avatar`, `bio`, `businessName`, `gender`, `agentAvailability`, `notificationPreferencesConfirmedAt`, individual bank fields) are omitted from the JSON rather than sent as `null`. KYC details are not included beyond `isKYCVerified`: use `GET /auth/kyc/status`. Sessions, push tokens and the wishlist are not included either.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/get-profile","x-short":"Returns the authenticated user's own profile, including preferences and their payout bank details with the full account number (this is the only place, with PUT /user/bank-detai...","responses":{"200":{"description":"Profile returned","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"bio":{"type":"string"},"businessName":{"type":"string"},"authProviders":{"type":"array","items":{"type":"string"}},"isEmailVerified":{"type":"boolean"},"isKYCVerified":{"type":"boolean"},"isActive":{"type":"boolean"},"twoFactorEnabled":{"type":"boolean"},"theme":{"type":"string"},"language":{"type":"string"},"notificationPreferences":{"type":"object","properties":{"newMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"propertyInquiries":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"inspectionBookings":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"paymentConfirmations":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"systemUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"newPropertyMatches":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"escrowUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"agentMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"priceDropAlerts":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"promotionalEmails":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"lawyerVerificationUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]}},"required":["newMessages","propertyInquiries","inspectionBookings","paymentConfirmations","systemUpdates","newPropertyMatches","escrowUpdates","agentMessages","priceDropAlerts","promotionalEmails","lawyerVerificationUpdates"]},"notificationPreferencesConfirmedAt":{"type":"string","format":"date-time"},"privacySettings":{"type":"object","properties":{"publicProfileSearch":{"type":"boolean"},"transactionHistoryVisibility":{"type":"boolean"}},"required":["publicProfileSearch","transactionHistoryVisibility"]},"bankDetails":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountHolderName":{"type":"string"},"accountNumber":{"type":"string"}},"required":["bankName","bankCode","accountHolderName","accountNumber"]},"agentAvailability":{"type":"object","properties":{"availableDays":{"type":"array","items":{"type":"string"}},"dayStartTime":{"type":"string"},"dayEndTime":{"type":"string"},"slotDurationMinutes":{"type":"integer"}},"required":["availableDays","dayStartTime","dayEndTime","slotDurationMinutes"]},"inspectionFee":{"type":"integer"},"gender":{"type":"string"},"address":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"}},"country":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["addresses","country","state","postalCode"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","firstName","lastName","email","phone","avatar","role","bio","businessName","authProviders","isEmailVerified","isKYCVerified","isActive","twoFactorEnabled","theme","language","notificationPreferences","notificationPreferencesConfirmedAt","privacySettings","bankDetails","agentAvailability","inspectionFee","gender","address","createdAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"User profile retrieved successfully.","data":{"id":"665f1c2e9b1d4a0012ab34cd","firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@example.com","phone":"+2348031234567","avatar":"https://cdn.example.com/avatars/adaeze-okonkwo.jpg","role":"AGENT","bio":"Lekki and Ikoyi rentals specialist with eight years of experience.","businessName":"Okonkwo Realty","authProviders":["LOCAL"],"isEmailVerified":true,"isKYCVerified":true,"isActive":true,"twoFactorEnabled":false,"theme":"SYSTEM","language":"ENGLISH","notificationPreferences":{"newMessages":{"inApp":true,"email":true,"sms":false},"propertyInquiries":{"inApp":true,"email":true,"sms":true},"inspectionBookings":{"inApp":true,"email":true,"sms":false},"paymentConfirmations":{"inApp":true,"email":true,"sms":true},"systemUpdates":{"inApp":false,"email":true,"sms":false},"newPropertyMatches":{"inApp":true,"email":true,"sms":false},"escrowUpdates":{"inApp":true,"email":true,"sms":false},"agentMessages":{"inApp":true,"email":true,"sms":false},"priceDropAlerts":{"inApp":true,"email":true,"sms":false},"promotionalEmails":{"inApp":false,"email":false,"sms":false},"lawyerVerificationUpdates":{"inApp":true,"email":true,"sms":false}},"notificationPreferencesConfirmedAt":"2026-03-15T09:12:44.000Z","privacySettings":{"publicProfileSearch":true,"transactionHistoryVisibility":false},"bankDetails":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountHolderName":"ADAEZE OKONKWO","accountNumber":"0123456789"},"agentAvailability":{"availableDays":["MON","TUE","WED","THU","FRI"],"dayStartTime":"09:00","dayEndTime":"17:00","slotDurationMinutes":60},"inspectionFee":5000,"gender":"FEMALE","address":{"addresses":["14 Admiralty Way, Lekki Phase 1"],"country":"Nigeria","state":"Lagos","postalCode":"106104"},"createdAt":"2026-02-03T08:15:27.000Z"}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"put":{"tags":["user"],"operationId":"user_put_profile","summary":"Update phone number and avatar","description":"**Access:** Bearer token required.\n\nSets the user's `phone` and/or `avatar`. Only these two fields are read; anything else in the body is ignored, and a field that is omitted is left unchanged. There is no request validation on this route, and it does not accept a file upload: `avatar` is stored exactly as sent, so upload the image elsewhere first and send its URL. Use `PUT /user/personal-info` for names, email, bio, business name and gender.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-profile","x-short":"Sets the user's phone and/or avatar.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string","description":"Phone number. Stored trimmed; the format is not validated here."},"avatar":{"type":"string","description":"URL of the profile picture. Stored as sent."}}},"examples":{"default":{"value":{"phone":"+2348031234567","avatar":"https://cdn.example.com/avatars/adaeze-okonkwo.jpg"}}}}}},"responses":{"200":{"description":"Profile updated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"phone":{"type":"string"},"avatar":{"type":"string"}},"required":["id","firstName","lastName","phone","avatar"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Profile updated successfully.","data":{"id":"665f1c2e9b1d4a0012ab34cd","firstName":"Adaeze","lastName":"Okonkwo","phone":"+2348031234567","avatar":"https://cdn.example.com/avatars/adaeze-okonkwo.jpg"}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/personal-info":{"put":{"tags":["user"],"operationId":"user_put_personal_info","summary":"Update personal information","description":"**Access:** Bearer token required.\n\nPartially updates the user's name, email, phone, bio, business name and gender; only the fields sent are changed. A new email must not belong to another account. Changing the email takes effect immediately: it does **not** reset `isEmailVerified` and no verification email is sent. Names can be changed after KYC; the change is not re-checked against the verified identity. Fields that are unset are omitted from `data`.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-personal-info","x-short":"Partially updates the user's name, email, phone, bio, business name and gender; only the fields sent are changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","minLength":2,"maxLength":50,"description":"Given name, 2-50 characters."},"lastName":{"type":"string","minLength":2,"maxLength":50,"description":"Family name, 2-50 characters."},"email":{"type":"string","format":"email","description":"New email address (lower-cased and trimmed). Must not be used by another account."},"phone":{"type":"string","pattern":"^[\\d+\\-\\s()]+$","description":"Phone number. Digits, `+`, `-`, spaces and parentheses only."},"bio":{"type":"string","maxLength":500,"description":"Short biography, up to 500 characters."},"businessName":{"type":"string","maxLength":100,"description":"Business or agency name, up to 100 characters."},"gender":{"type":"string","enum":["MALE","FEMALE","OTHER","PREFER_NOT_TO_SAY"],"description":"One of `MALE`, `FEMALE`, `OTHER`, `PREFER_NOT_TO_SAY`."}},"additionalProperties":false},"examples":{"default":{"value":{"firstName":"Adaeze","lastName":"Okonkwo","phone":"+2348031234567","bio":"Lekki and Ikoyi rentals specialist with eight years of experience.","businessName":"Okonkwo Realty","gender":"FEMALE"}}}}}},"responses":{"200":{"description":"Personal information updated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"bio":{"type":"string"},"businessName":{"type":"string"},"gender":{"type":"string"}},"required":["id","firstName","lastName","email","phone","bio","businessName","gender"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Personal information updated successfully.","data":{"id":"665f1c2e9b1d4a0012ab34cd","firstName":"Adaeze","lastName":"Okonkwo","email":"adaeze.okonkwo@example.com","phone":"+2348031234567","bio":"Lekki and Ikoyi rentals specialist with eight years of experience.","businessName":"Okonkwo Realty","gender":"FEMALE"}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"field\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"409":{"description":"Another account already uses the requested email","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":409,"success":false,"message":"Email already in use.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/change-password":{"post":{"tags":["user"],"operationId":"user_post_change_password","summary":"Change the account password","description":"**Access:** Bearer token required.\n\nReplaces the password after checking the current one. Accounts created with Google or Apple have no password and cannot use this endpoint. On success a `password_changed` notification (\"Password Changed\") is created and delivered in-app, by push and by email according to the user's `systemUpdates` preferences. Existing sessions, access tokens and the refresh token are **not** revoked; call `POST /user/logout-all-devices` to do that.\n\nA wrong current password is answered with **401**. Clients that treat every 401 as an expired session should special-case this endpoint so the user is not signed out.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/post-change-password","x-short":"Replaces the password after checking the current one.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currentPassword":{"type":"string","description":"The password currently set on the account."},"newPassword":{"type":"string","minLength":8,"maxLength":128,"description":"The new password, 8-128 characters."}},"required":["currentPassword","newPassword"],"additionalProperties":false},"examples":{"default":{"value":{"currentPassword":"S3cure-Passw0rd","newPassword":"N3w-S3cure-Passw0rd"}}}}}},"responses":{"200":{"description":"Password changed","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Password changed successfully.","data":null}}}}}},"400":{"description":"- The account has no password (created with Google or Apple)\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The account has no password (created with Google or Apple)","value":{"status":400,"success":false,"message":"Password change not allowed for OAuth accounts.","data":null}},"example2":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"currentPassword\" is required","data":null}}}}}},"401":{"description":"- `currentPassword` does not match\n- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`currentPassword` does not match","value":{"status":401,"success":false,"message":"Current password is incorrect.","data":null}},"example2":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example3":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example4":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/enable-2fa":{"post":{"tags":["user"],"operationId":"user_post_enable_2fa","summary":"Turn on the two-factor authentication flag","description":"**Access:** Bearer token required.\n\nSets `twoFactorEnabled` to `true` on the account. No request body is read. This is only a stored preference today: no secret or code is generated or verified, and none of the sign-in endpoints check the flag, so signing in is unchanged. Idempotent.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/post-enable-2fa","x-short":"Sets twoFactorEnabled to true on the account.","responses":{"200":{"description":"Flag set","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"twoFactorEnabled":{"type":"boolean"}},"required":["twoFactorEnabled"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Two-factor authentication enabled.","data":{"twoFactorEnabled":true}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/disable-2fa":{"post":{"tags":["user"],"operationId":"user_post_disable_2fa","summary":"Turn off the two-factor authentication flag","description":"**Access:** Bearer token required.\n\nSets `twoFactorEnabled` to `false` on the account. No request body is read and no password or code confirmation is required. As with `POST /user/enable-2fa`, the flag is only a stored preference and is not consulted at sign-in. Idempotent.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/post-disable-2fa","x-short":"Sets twoFactorEnabled to false on the account.","responses":{"200":{"description":"Flag cleared","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"twoFactorEnabled":{"type":"boolean"}},"required":["twoFactorEnabled"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Two-factor authentication disabled.","data":{"twoFactorEnabled":false}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/active-sessions":{"get":{"tags":["user"],"operationId":"user_get_active_sessions","summary":"List the user's active sessions","description":"**Access:** Bearer token required.\n\nReturns the sessions recorded at sign-in, newest first; at most 10 are kept per account. `data` is a bare array, not an object. `id` is the session ID embedded in that session's tokens, `device` is derived from the `User-Agent` (`iPhone`, `iPad`, `Android Device`, `Mac`, `Windows PC`, `Linux Device` or `Unknown Device`), and `location` is the IP address seen at sign-in rather than a place name. `lastActive` is the sign-in time: it is not refreshed as the session is used. The stored browser name and the current-session marker are not returned, and there is no endpoint to revoke a single session other than `POST /auth/signout` from that session.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/get-active-sessions","x-short":"Returns the sessions recorded at sign-in, newest first; at most 10 are kept per account.","responses":{"200":{"description":"Sessions returned","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"device":{"type":"string"},"location":{"type":"string"},"lastActive":{"type":"string","format":"date-time"}},"required":["id","device","location","lastActive"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Active sessions retrieved.","data":[{"id":"3f2b1c9e-7a4d-4e1b-9c2f-5d8a6b7c0e1f","device":"iPhone","location":"102.89.34.17","lastActive":"2026-11-24T18:42:09.000Z"}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/logout-all-devices":{"post":{"tags":["user"],"operationId":"user_post_logout_all_devices","summary":"Sign out of every device","description":"**Access:** Bearer token required.\n\nRemoves the account's stored refresh token and clears the whole session list, including the session making the request. No request body is read. After this, `POST /auth/refresh-token` fails on every device until the user signs in again. Access tokens that were already issued are **not** revoked: they keep working until they expire (`JWT_ACCESS_EXPIRY`, 15 minutes by default). Push tokens are left registered.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/post-logout-all-devices","x-short":"Removes the account's stored refresh token and clears the whole session list, including the session making the request.","responses":{"200":{"description":"All sessions cleared","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Logged out from all devices.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/appearance":{"put":{"tags":["user"],"operationId":"user_put_appearance","summary":"Set the theme preference","description":"**Access:** Bearer token required.\n\nStores the user's preferred theme. There is no request validation schema on this route; the handler itself requires `theme` to be one of `SYSTEM`, `LIGHT` or `DARK` (upper case) and rejects anything else, including a missing value. New accounts default to `SYSTEM`.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-appearance","x-short":"Stores the user's preferred theme.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"theme":{"type":"string","description":"One of `SYSTEM`, `LIGHT`, `DARK`."}},"required":["theme"]},"examples":{"default":{"value":{"theme":"DARK"}}}}}},"responses":{"200":{"description":"Theme saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"theme":{"type":"string"}},"required":["theme"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Appearance settings updated.","data":{"theme":"DARK"}}}}}}},"400":{"description":"`theme` is missing or not one of the allowed values","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid theme. Must be one of: SYSTEM, LIGHT, DARK","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/language":{"put":{"tags":["user"],"operationId":"user_put_language","summary":"Set the language preference","description":"**Access:** Bearer token required.\n\nStores the user's preferred language. There is no request validation schema on this route; the handler itself requires `language` to be one of the supported values (upper case) and rejects anything else, including a missing value. New accounts default to `ENGLISH`. The value is only stored on the profile; API messages are not translated.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-language","x-short":"Stores the user's preferred language.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","description":"One of `ENGLISH`, `FRENCH`, `SPANISH`, `PORTUGUESE`, `GERMAN`, `CHINESE`, `ITALIAN`, `DUTCH`, `SWEDISH`, `RUSSIAN`."}},"required":["language"]},"examples":{"default":{"value":{"language":"FRENCH"}}}}}},"responses":{"200":{"description":"Language saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"language":{"type":"string"}},"required":["language"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Language preference updated.","data":{"language":"FRENCH"}}}}}}},"400":{"description":"`language` is missing or not one of the allowed values","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid language. Must be one of: ENGLISH, FRENCH, SPANISH, PORTUGUESE, GERMAN, CHINESE, ITALIAN, DUTCH, SWEDISH, RUSSIAN","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/notification-preferences":{"put":{"tags":["user"],"operationId":"user_put_notification_preferences","summary":"Update notification preferences","description":"**Access:** Bearer token required.\n\nPartially updates which channels each notification category uses. Send only the categories and channels you want to change; everything else keeps its current value. Each category is an object with optional booleans `inApp`, `email` and `sms`. `inApp` controls both the in-app notification feed and push notifications. `sms` is stored, but SMS is only sent when the server has SMS notifications enabled.\n\nEvery call, even with an empty body, stamps `notificationPreferencesConfirmedAt` with the current time; agent onboarding uses that timestamp to treat the notifications step as done. The response returns the complete preference set.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-notification-preferences","x-short":"Partially updates which channels each notification category uses.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"newMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"New chat messages. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"propertyInquiries":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Enquiries about the user's listings. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"inspectionBookings":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Inspection and tour bookings. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"paymentConfirmations":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Payment confirmations. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"systemUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"System and security notices, including new-device sign-ins and password changes. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"newPropertyMatches":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"New listings that match the user's interests. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"escrowUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Escrow status changes. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"agentMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Messages from agents. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"priceDropAlerts":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Price drops on followed listings. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"promotionalEmails":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Marketing and promotional messages. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."},"lawyerVerificationUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false,"description":"Lawyer verification progress. Object with optional booleans `inApp` (notification feed and push), `email` and `sms`; only the channels you send are changed."}},"additionalProperties":false},"examples":{"default":{"value":{"promotionalEmails":{"email":false},"systemUpdates":{"inApp":true}}}}}}},"responses":{"200":{"description":"Preferences saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"notificationPreferences":{"type":"object","properties":{"newMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"propertyInquiries":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"inspectionBookings":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"paymentConfirmations":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"systemUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"newPropertyMatches":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"escrowUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"agentMessages":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"priceDropAlerts":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"promotionalEmails":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]},"lawyerVerificationUpdates":{"type":"object","properties":{"inApp":{"type":"boolean"},"email":{"type":"boolean"},"sms":{"type":"boolean"}},"required":["inApp","email","sms"]}},"required":["newMessages","propertyInquiries","inspectionBookings","paymentConfirmations","systemUpdates","newPropertyMatches","escrowUpdates","agentMessages","priceDropAlerts","promotionalEmails","lawyerVerificationUpdates"]},"notificationPreferencesConfirmedAt":{"type":"string","format":"date-time"}},"required":["notificationPreferences","notificationPreferencesConfirmedAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Notification preferences updated.","data":{"notificationPreferences":{"newMessages":{"inApp":true,"email":true,"sms":false},"propertyInquiries":{"inApp":true,"email":true,"sms":true},"inspectionBookings":{"inApp":true,"email":true,"sms":false},"paymentConfirmations":{"inApp":true,"email":true,"sms":true},"systemUpdates":{"inApp":true,"email":true,"sms":false},"newPropertyMatches":{"inApp":true,"email":true,"sms":false},"escrowUpdates":{"inApp":true,"email":true,"sms":false},"agentMessages":{"inApp":true,"email":true,"sms":false},"priceDropAlerts":{"inApp":true,"email":true,"sms":false},"promotionalEmails":{"inApp":false,"email":false,"sms":false},"lawyerVerificationUpdates":{"inApp":true,"email":true,"sms":false}},"notificationPreferencesConfirmedAt":"2026-11-25T09:30:12.418Z"}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"field\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/push-tokens":{"post":{"tags":["user"],"operationId":"user_post_push_tokens","summary":"Register a device's Expo push token","description":"**Access:** Bearer token required.\n\nRegisters the device's Expo push token for the signed-in user so push notifications reach it. It is an upsert, so the app can call it on every launch: an existing entry for the same token is refreshed rather than duplicated. A token belongs to one account at a time, so registering it first removes it from any other account that had it (for example the previous user of the phone). Only the 10 most recently registered devices are kept per account.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/post-push-tokens","x-short":"Registers the device's Expo push token for the signed-in user so push notifications reach it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","pattern":"^Expo(nent)?PushToken\\[.+\\]$","description":"Expo push token, in the form `ExponentPushToken[...]` or `ExpoPushToken[...]`."},"platform":{"type":"string","enum":["ios","android"],"description":"Device platform: `ios` or `android`."},"deviceName":{"type":"string","maxLength":100,"description":"Optional human-readable device name, up to 100 characters."}},"required":["token","platform"],"additionalProperties":false},"examples":{"default":{"value":{"token":"ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]","platform":"ios","deviceName":"Adaeze's iPhone 15"}}}}}},"responses":{"200":{"description":"Token registered or refreshed","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Push token registered.","data":null}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"token\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"delete":{"tags":["user"],"operationId":"user_delete_push_tokens","summary":"Unregister a device's push token","description":"**Access:** Bearer token required.\n\nRemoves the given Expo push token from the signed-in user so the device stops receiving their push notifications. Call it on sign-out, **before** discarding the access token, because `POST /auth/signout` does not remove push tokens. The token is sent in a JSON body on a `DELETE` request. Idempotent: it answers 200 even if the token was not registered.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/delete-push-tokens","x-short":"Removes the given Expo push token from the signed-in user so the device stops receiving their push notifications.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"The Expo push token to remove."}},"required":["token"],"additionalProperties":false},"examples":{"default":{"value":{"token":"ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]"}}}}}},"responses":{"200":{"description":"Token removed, or was not registered","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Push token removed.","data":null}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"token\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/privacy-settings":{"put":{"tags":["user"],"operationId":"user_put_privacy_settings","summary":"Update privacy settings","description":"**Access:** Bearer token required.\n\nPartially updates the user's privacy settings; only boolean values that are sent are changed. `publicProfileSearch` defaults to `true` and `transactionHistoryVisibility` to `false` on new accounts. The response returns both settings.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-privacy-settings","x-short":"Partially updates the user's privacy settings; only boolean values that are sent are changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"publicProfileSearch":{"type":"boolean","description":"Whether the profile may appear in public search."},"transactionHistoryVisibility":{"type":"boolean","description":"Whether the user's transaction history is visible to others."}},"additionalProperties":false},"examples":{"default":{"value":{"publicProfileSearch":false}}}}}},"responses":{"200":{"description":"Settings saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"privacySettings":{"type":"object","properties":{"publicProfileSearch":{"type":"boolean"},"transactionHistoryVisibility":{"type":"boolean"}},"required":["publicProfileSearch","transactionHistoryVisibility"]}},"required":["privacySettings"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Privacy settings updated.","data":{"privacySettings":{"publicProfileSearch":false,"transactionHistoryVisibility":false}}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"field\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/bank-details":{"put":{"tags":["user"],"operationId":"user_put_bank_details","summary":"Save payout bank details","description":"**Access:** Bearer token required.\n\nPartially updates the bank account the user is paid out to; only the fields sent are changed. The values are stored as given: this endpoint does **not** verify the account with the bank. The intended flow is `GET /user/banks` to pick a bank, `POST /user/bank-details/verify` to resolve the account name, then this call with the confirmed values. Payouts are routed on `bankCode`, not `bankName`, so always send the code from the bank list. The response echoes the full saved details including the account number; fields never set are omitted.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-bank-details","x-short":"Partially updates the bank account the user is paid out to; only the fields sent are changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bankName":{"type":"string","maxLength":100,"description":"Display name of the bank, up to 100 characters."},"bankCode":{"type":"string","maxLength":10,"description":"The bank's code from `GET /user/banks`, up to 10 characters. Required for payouts to be routable."},"accountHolderName":{"type":"string","maxLength":100,"description":"Name on the account, ideally as returned by `POST /user/bank-details/verify`. Up to 100 characters."},"accountNumber":{"type":"string","maxLength":50,"description":"Bank account number (10-digit NUBAN for Nigerian banks). Up to 50 characters."},"swiftIban":{"type":"string","maxLength":34,"description":"SWIFT code or IBAN, up to 34 characters. Optional."}},"additionalProperties":false},"examples":{"default":{"value":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountHolderName":"ADAEZE OKONKWO","accountNumber":"0123456789"}}}}}},"responses":{"200":{"description":"Bank details saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"bankDetails":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountHolderName":{"type":"string"},"accountNumber":{"type":"string"}},"required":["bankName","bankCode","accountHolderName","accountNumber"]}},"required":["bankDetails"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Bank details updated.","data":{"bankDetails":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountHolderName":"ADAEZE OKONKWO","accountNumber":"0123456789"}}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"field\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/banks":{"get":{"tags":["user"],"operationId":"user_get_banks","summary":"List banks supported for payouts","description":"**Access:** Bearer token required.\n\nReturns the banks the payout provider (PandaScrow) can pay out to, fetched live from the provider on every call; the list changes rarely, so clients may cache it. `code` is the value to send as `bankCode` to `POST /user/bank-details/verify` and `PUT /user/bank-details`. `slug` is derived from the bank name by the API (lower-cased, non-alphanumerics replaced with hyphens) for use as a stable key in pickers. If the provider call fails the error is a 500 whose message includes the provider's own text.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/get-banks","x-short":"Returns the banks the payout provider (PandaScrow) can pay out to, fetched live from the provider on every call; the list changes rarely, so clients may cache it.","responses":{"200":{"description":"Bank list returned","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"banks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"slug":{"type":"string"}},"required":["name","code","slug"]}}},"required":["banks"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Banks fetched successfully","data":{"banks":[{"name":"Guaranty Trust Bank","code":"058","slug":"guaranty-trust-bank"}]}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"The payout provider request failed. The provider's own message follows the colon.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch banks: <provider message>","data":null}}}}}}}}},"/api/v1/user/bank-details/verify":{"post":{"tags":["user"],"operationId":"user_post_bank_details_verify","summary":"Resolve a bank account number to its account name","description":"**Access:** Bearer token required.\n\nAsks the payout provider (PandaScrow) for the name registered on a bank account so the user can confirm the destination before saving it. Nothing is stored: follow up with `PUT /user/bank-details` to save. There is no request validation schema on this route; the handler only checks that both fields are present, and converts them to strings.\n\nA provider-side failure, which includes the provider rejecting a wrong account number or bank code, is answered with **500**, not a 4xx, with the provider's message appended.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/post-bank-details-verify","x-short":"Asks the payout provider (PandaScrow) for the name registered on a bank account so the user can confirm the destination before saving it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountNumber":{"type":"string","description":"The bank account number to resolve (10-digit NUBAN)."},"bankCode":{"type":"string","description":"The bank's `code` from `GET /user/banks`."}},"required":["accountNumber","bankCode"]},"examples":{"default":{"value":{"accountNumber":"0123456789","bankCode":"058"}}}}}},"responses":{"200":{"description":"Account resolved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"accountNumber":{"type":"string"},"bankCode":{"type":"string"},"accountHolderName":{"type":"string"}},"required":["accountNumber","bankCode","accountHolderName"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Account resolved successfully","data":{"accountNumber":"0123456789","bankCode":"058","accountHolderName":"ADAEZE OKONKWO"}}}}}}},"400":{"description":"`accountNumber` or `bankCode` is missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Missing required fields: accountNumber and bankCode","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"422":{"description":"The provider answered but returned no account name","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":422,"success":false,"message":"We couldn't get the account name from your bank. Check the number and bank, or try again.","data":null}}}}}},"500":{"description":"The provider request failed or the account could not be resolved. The provider's own message follows the colon.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to validate bank account: <provider message>","data":null}}}}}}}}},"/api/v1/user/address":{"put":{"tags":["user"],"operationId":"user_put_address","summary":"Update the user's address","description":"**Access:** Bearer token required.\n\nPartially updates the user's address; only the fields sent are changed. `addresses` replaces the whole list of address lines (it is not appended to) and may hold up to 10 entries. The response returns the complete address object.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-address","x-short":"Partially updates the user's address; only the fields sent are changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string","maxLength":255},"maxItems":10,"description":"Array of address lines, up to 10 entries of at most 255 characters each. Replaces the existing list."},"country":{"type":"string","maxLength":100,"description":"Country, up to 100 characters."},"state":{"type":"string","maxLength":100,"description":"State or region, up to 100 characters."},"postalCode":{"type":"string","maxLength":20,"description":"Postal code, up to 20 characters."}},"additionalProperties":false},"examples":{"default":{"value":{"addresses":["14 Admiralty Way, Lekki Phase 1"],"country":"Nigeria","state":"Lagos","postalCode":"106104"}}}}}},"responses":{"200":{"description":"Address saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"address":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"}},"country":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["addresses","country","state","postalCode"]}},"required":["address"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Address updated successfully.","data":{"address":{"addresses":["14 Admiralty Way, Lekki Phase 1"],"country":"Nigeria","state":"Lagos","postalCode":"106104"}}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"field\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/agent-availability":{"put":{"tags":["user"],"operationId":"user_put_agent_availability","summary":"Set availability for inspections and tours","description":"**Access:** Bearer token required.\n\nPartially updates the days and daily time window in which the user can be booked for inspections, and the length of each slot; only the fields sent are changed. Times are 24-hour `HH:mm` strings with no time zone. Defaults when nothing has been saved are `09:00` to `17:00` with 60-minute slots and no available days. The handler does not check that `dayStartTime` is earlier than `dayEndTime`, and although the setting is meant for agents the route does not restrict by role: any signed-in user can set it. The response returns the complete availability object.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-agent-availability","x-short":"Partially updates the days and daily time window in which the user can be booked for inspections, and the length of each slot; only the fields sent are changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"availableDays":{"type":"array","items":{"type":"string","enum":["MON","TUE","WED","THU","FRI","SAT","SUN"]},"description":"Days the user accepts bookings: any of `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, `SUN`. Replaces the existing list."},"dayStartTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Start of the daily window, `HH:mm` (24-hour), for example `09:00`."},"dayEndTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"End of the daily window, `HH:mm` (24-hour), for example `17:00`."},"slotDurationMinutes":{"type":"number","format":"float","enum":[15,30,45,60,90,120],"description":"Length of one bookable slot in minutes: `15`, `30`, `45`, `60`, `90` or `120`."}},"additionalProperties":false},"examples":{"default":{"value":{"availableDays":["MON","TUE","WED","THU","FRI"],"dayStartTime":"09:00","dayEndTime":"17:00","slotDurationMinutes":60}}}}}},"responses":{"200":{"description":"Availability saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"agentAvailability":{"type":"object","properties":{"availableDays":{"type":"array","items":{"type":"string"}},"dayStartTime":{"type":"string"},"dayEndTime":{"type":"string"},"slotDurationMinutes":{"type":"integer"}},"required":["availableDays","dayStartTime","dayEndTime","slotDurationMinutes"]}},"required":["agentAvailability"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Availability settings updated.","data":{"agentAvailability":{"availableDays":["MON","TUE","WED","THU","FRI"],"dayStartTime":"09:00","dayEndTime":"17:00","slotDurationMinutes":60}}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"field\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/inspection-fee":{"put":{"tags":["user"],"operationId":"user_put_inspection_fee","summary":"Set the inspection fee","description":"**Access:** Bearer token required.\n\nSets the fee, in naira, that is charged when someone books an inspection with this user as the agent. It must be a whole number of zero or more; new accounts start at 5000 (NGN 5,000). The inspection and transaction flows read this value when pricing a booking and fall back to the platform default when it is not set. The route does not restrict by role: any signed-in user can set it, though it only matters for agents.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/put-inspection-fee","x-short":"Sets the fee, in naira, that is charged when someone books an inspection with this user as the agent.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inspectionFee":{"type":"integer","minimum":0,"description":"Fee in naira as a non-negative integer, for example `7500`."}},"required":["inspectionFee"],"additionalProperties":false},"examples":{"default":{"value":{"inspectionFee":7500}}}}}},"responses":{"200":{"description":"Fee saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"inspectionFee":{"type":"integer"}},"required":["inspectionFee"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Inspection fee updated.","data":{"inspectionFee":7500}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"inspectionFee\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/reviews":{"get":{"tags":["user"],"operationId":"user_get_reviews","summary":"List reviews written by the signed-in user","description":"**Access:** Bearer token required.\n\nReturns the reviews the authenticated user has **written** (not reviews about them), newest first, with offset pagination. Each review's `propertyId` is populated with the property's `_id`, `title` and `media` (the full media object as stored on the property; the example trims it). `total` is the number of reviews the user has written and `pages` is `total / limit` rounded up. `page` and `limit` are not validated: non-numeric or zero values fall back to the defaults, and there is no upper bound on `limit`.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/get-reviews","x-short":"Returns the reviews the authenticated user has written (not reviews about them), newest first, with offset pagination.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10},"description":"Number of reviews per page. Defaults to 10."}],"responses":{"200":{"description":"Reviews returned","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"reviews":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","media"]},"reviewerId":{"type":"string"},"transactionId":{"nullable":true},"rating":{"type":"integer"},"title":{"type":"string"},"comment":{"type":"string"},"categories":{"type":"object","properties":{"cleanliness":{"type":"integer"},"communication":{"type":"integer"},"accuracy":{"type":"integer"},"location":{"type":"integer"}},"required":["cleanliness","communication","accuracy","location"]},"verified":{"type":"boolean"},"helpful":{"type":"integer"},"unhelpful":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","reviewerId","transactionId","rating","title","comment","categories","verified","helpful","unhelpful","createdAt","updatedAt","__v"]}},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["reviews","total","pages"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"User reviews fetched successfully","data":{"reviews":[{"_id":"66a1d4f09b1d4a0012ab77e1","propertyId":{"_id":"6660a7b39b1d4a0012ab45f2","title":"3 Bedroom Apartment in Lekki Phase 1","media":{"images":[{"url":"https://cdn.example.com/properties/lekki-3bed/living-room.jpg"}],"videos":[]}},"reviewerId":"665f1c2e9b1d4a0012ab34cd","transactionId":null,"rating":4,"title":"Clean, quiet and close to everything","comment":"The apartment matched the listing photos and the agent was responsive throughout. Power supply was steady during the viewing.","categories":{"cleanliness":5,"communication":4,"accuracy":4,"location":5},"verified":false,"helpful":2,"unhelpful":0,"createdAt":"2026-07-25T11:04:16.000Z","updatedAt":"2026-07-25T11:04:16.000Z","__v":0}],"total":1,"pages":1}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/user/account":{"delete":{"tags":["user"],"operationId":"user_delete_account","summary":"Delete the signed-in user's account","description":"**Access:** Bearer token required.\n\nSoft-deletes the account: it is flagged `isDeleted` and `isActive: false`, and the stored refresh token is removed. Nothing is erased; the user's listings, bookings, reviews and other records are left as they are. No request body or password confirmation is required. If the account signed in with Apple and a refresh token was stored, the API asks Apple to revoke it; a failure there is logged and does not stop the deletion.\n\nAfterwards, password and Apple sign-in are refused with 403 (\"Your account has been deactivated. Please contact support.\") and refreshing fails, but the email address stays reserved, so signing up again with it returns 409. Access tokens that were already issued are not revoked and keep authenticating until they expire, and the session list and push tokens are not cleared, so clients should unregister the push token first and discard their tokens immediately. The user cannot restore the account themselves.","security":[{"bearerAuth":[]}],"x-doc-slug":"user/delete-account","x-short":"Soft-deletes the account: it is flagged isDeleted and isActive: false, and the stored refresh token is removed.","responses":{"200":{"description":"Account soft-deleted","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Account deleted successfully.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The user record no longer exists. Only reachable if the account is removed between the bearer check and the handler; normally the bearer check answers 401 first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/create":{"post":{"tags":["property"],"operationId":"property_post_create","summary":"Create a listing or save a draft","description":"**Access:** Bearer token required. **Also requires:** KYC verified.\n\nCreates a property owned by the authenticated user (`landlordId` is always the caller). The route has no role check: the only gate is that the caller's account is KYC-verified, and that applies to drafts as well.\n\nSend `multipart/form-data` with photos in `images` (max 20) and `videos` (max 5); files are uploaded to Cloudinary and stored as `media.images[]` / `media.videos[]`. Nested fields (`location`, `details`, `pricing`, `availability`, `shortLet`, `amenities`, `imagesMetadata`, `videosMetadata`) must be JSON-encoded strings in multipart; a plain `application/json` body with real objects also works when there are no files. A `media` key in the body is rejected by validation.\n\n**Two validation modes.** With `status: \"draft\"` only shape and upper bounds are checked (`type` is still required) and the listing is saved as `draft`, invisible to public search. Without `status`, the full ruleset applies and the listing is saved as `pending_verification` with `verification.isVerified: false`; any `status` other than `draft` is a 400. `shortLet` is required when `type` is `SHORTLET` and forbidden for every other type.\n\n**Side effects for non-drafts.** The listing is compared with nearby listings and, if it looks like a duplicate, a duplicate flag is opened for the admin queue (this never fails the request and nothing about it is returned). If an admin has set a default legal partner, a legal verification assignment is created, the listing moves to `legalStatus: under_legal_review`, and that lawyer gets an in-app notification (socket event `notifications:new`), push and email. The response body is the document as first saved, so it still shows `legalStatus: pending_verification` even when a lawyer was auto-assigned.\n\n**Gotchas.** `location` and its sub-fields are optional in request validation but required by the model for non-drafts, so leaving them out produces a 500 (`Property validation failed: ...`) rather than a 400. `details.bedrooms` and `details.bathrooms` are required by request validation for every type, including `LAND`.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/post-create","x-short":"Creates a property owned by the authenticated user (landlordId is always the caller).","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"images":{"contentMediaType":"application/octet-stream","description":"Listing photos, up to 20 files of at most 10 MB each. Accepted extensions for photos: jpg, jpeg, png, gif. The first image is the cover. Stored in upload order as `media.images[]`."},"videos":{"contentMediaType":"application/octet-stream","description":"Up to 5 files of at most 10 MB each. The shared upload filter only allows jpg, jpeg, png, gif, pdf, doc, docx, xls, xlsx, ppt, pptx and txt, so ordinary video files (mp4, mov) are currently rejected with a 500."},"status":{"type":"string","description":"Only `draft` is accepted. Omit it to submit the listing for verification."},"title":{"type":"string","description":"5-200 characters. For a draft: optional, may be empty, max 200."},"description":{"type":"string","description":"20-5000 characters. For a draft: optional, may be empty, max 5000."},"type":{"type":"string","description":"One of `APARTMENT`, `HOUSE`, `VILLA`, `LAND`, `COMMERCIAL`, `SHORTLET`, `OFFICE`. Required for drafts too."},"location":{"type":"object","description":"JSON string in multipart. `{ state, lga, community, street, nearestLandmark?, coordinates: [longitude, latitude] }`. Optional in request validation, but `state`, `lga`, `community`, `street` and `coordinates` are required by the model for a non-draft (missing ones give a 500). `coordinates` of `[0, 0]` is rejected for a non-draft. Extra keys are allowed but not stored."},"details":{"type":"object","description":"JSON string in multipart. `{ bedrooms: 0-50, bathrooms: 0-50, squareFeet: >= 100, features?: string[] }`; all three numbers are required for a non-draft. For a draft the object and every field are optional (`squareFeet` >= 0)."},"pricing":{"type":"object","description":"JSON string in multipart. `{ rentPrice?: number >= 0, salePrice?: number >= 0, currency?: NGN | USD | GHS | KES | ZAR (default NGN), rentDurationYears?: integer 1-3 (default 1) }`. `rentPrice` is always the per-year figure; `rentDurationYears` is how many years are collected up front."},"availability":{"type":"object","description":"JSON string in multipart. `{ availableFrom: date }`. Required for a non-draft; optional for a draft."},"shortLet":{"type":"object","description":"JSON string in multipart. `{ maxNights: 1-365, nightlyPrice: number >= 0, minNights?: >= 1 (default 1) }`. Required when `type` is `SHORTLET` (fields optional on a draft); forbidden for any other type."},"amenities":{"type":"array","items":{},"description":"JSON string in multipart. Up to 40 strings of 1-40 characters each: preset keys such as `wifi` or the lister's own labels such as `Borehole`."},"imagesMetadata":{"type":"array","items":{},"description":"JSON string in multipart. One entry per uploaded image, matched by index. Only `address` (string), `coordinates` ([longitude, latitude]), `gps` ([longitude, latitude] the photo was taken at, read from EXIF by the client) and `tag` (room label, trimmed to 30 characters) are kept; anything else is dropped."},"videosMetadata":{"type":"array","items":{},"description":"JSON string in multipart. One entry per uploaded video, matched by index and stored as sent (the model keeps `address` and `coordinates`)."}},"required":["title","description","type","details","availability"]},"examples":{"default":{"value":{"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":[3.4723,6.4474]},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01"},"amenities":["wifi","parking","Borehole"],"imagesMetadata":[{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"}]}}}}}},"responses":{"201":{"description":"Listing created. `status` is `pending_verification` (or `draft` when `status: \"draft\"` was sent). `data` is the full property document; `views` is only present on this create response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"}},"required":["isVerified"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"views":{"type":"array","items":{}}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v","views"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":201,"success":true,"message":"Property created successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":"664a0b7e2f8c3d0011aa22bb","agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"pending_verification","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":false},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"pending_verification","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-25T09:30:00.000Z","updatedAt":"2026-11-25T09:30:00.000Z","__v":0,"views":[]}}}}}}},"400":{"description":"Only when an admin has switched on image geotagging (see `GET /api/v1/settings` -> `imageGeotagging`) and the listing is not a draft. A photo's reported GPS position is further from the listing's pin than `maxDistanceMeters`; in strict mode a photo with no GPS position, or a listing with no pin, is refused too. The message is built per request and names the offending photos (numbered from 1 in upload order).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Photos must be taken within 500 m of the listing's address or landmark: photo 2 (3.4 km away).","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller's account is not KYC-verified. Applies to drafts too.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Landlord must complete KYC verification before listing properties","data":null}}}}}},"500":{"description":"- The request passed request validation but the model rejected it, for example a non-draft with no `location.street`. The message is Mongoose's and lists every failing path; `errorData` is the serialized Mongoose error (trimmed here).\n- An uploaded file has an extension outside the upload allow-list. The upload middleware raises a plain error with no status, so it surfaces as a 500 rather than a 400. Note that no video extension (mp4, mov, ...) and no webp/heic is on the list.\n- A file is larger than 10 MB. Multer's error has no HTTP status, so it surfaces as a 500 and carries Multer's error code.\n- More files than the field allows were sent, or a file was sent under a field name the route does not accept. Surfaces as a 500 with Multer's error code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The request passed request validation but the model rejected it, for example a non-draft with no `location.street`. The message is Mongoose's and lists every failing path; `errorData` is the serialized Mongoose error (trimmed here).","value":{"status":500,"success":false,"message":"Property validation failed: location.street: Street address is required","data":null,"errorData":{"errors":{"location.street":{"name":"ValidatorError","message":"Street address is required","kind":"required","path":"location.street"}},"_message":"Property validation failed","name":"ValidationError","message":"Property validation failed: location.street: Street address is required"}}},"example2":{"summary":"An uploaded file has an extension outside the upload allow-list. The upload middleware raises a plain error with no status, so it surfaces as a 500 rather than a 400. Note that no video extension (mp4, mov, ...) and no webp/heic is on the list.","value":{"status":500,"success":false,"message":"File type not allowed. Allowed types: jpg, jpeg, png, gif, pdf, doc, docx, xls, xlsx, ppt, pptx, txt","data":null}},"example3":{"summary":"A file is larger than 10 MB. Multer's error has no HTTP status, so it surfaces as a 500 and carries Multer's error code.","value":{"status":500,"success":false,"message":"File too large","data":null,"code":"LIMIT_FILE_SIZE"}},"example4":{"summary":"More files than the field allows were sent, or a file was sent under a field name the route does not accept. Surfaces as a 500 with Multer's error code.","value":{"status":500,"success":false,"message":"Unexpected field","data":null,"code":"LIMIT_UNEXPECTED_FILE"}}}}}}}}},"/api/v1/property/search":{"get":{"tags":["property"],"operationId":"property_get_search","summary":"Search listings","description":"**Access:** Public, no token needed.\n\nPublic search over listings that are `listed`, verified (`verification.isVerified: true`) and not deleted. Drafts, pending, unlisted, rented and sold listings never appear.\n\nAll filters are optional and combine with AND. `title` and `address` are case-insensitive regular-expression matches (the value is used as a regex as-is, so an invalid pattern fails the query with a 500 `Failed to search properties`); `state` and `type` are exact matches. `bedrooms` and `bathrooms` are minimums.\n\nThe price range is applied to the price a listing displays: `shortLet.nightlyPrice` for a short let, otherwise `pricing.rentPrice` or `pricing.salePrice` (either one in range matches). A bound of 0 is ignored.\n\nEach result has `landlordId` populated with `firstName`, `lastName`, `avatar`, `phone`, `role` and `isKYCVerified`, so the lister's phone number is public here. Unknown query parameters are rejected with a 400.","security":[],"x-doc-slug":"property/get-search","x-short":"Public search over listings that are listed, verified (verification.isVerified: true) and not deleted.","parameters":[{"name":"title","in":"query","required":false,"schema":{"type":"string"},"description":"Case-insensitive regex match on the listing title."},{"name":"address","in":"query","required":false,"schema":{"type":"string"},"description":"Case-insensitive regex match on `location.street` or `location.nearestLandmark`."},{"name":"state","in":"query","required":false,"schema":{"type":"string"},"description":"Exact, case-sensitive match on `location.state`, e.g. `Lagos`."},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["APARTMENT","HOUSE","VILLA","LAND","COMMERCIAL","SHORTLET","OFFICE"]},"description":"Property type: `APARTMENT`, `HOUSE`, `VILLA`, `LAND`, `COMMERCIAL`, `SHORTLET` or `OFFICE`."},{"name":"minPrice","in":"query","required":false,"schema":{"type":"number","format":"float","minimum":0},"description":"Lower price bound (inclusive). Compared with the nightly price for short lets, rent or sale price otherwise. 0 is treated as no bound."},{"name":"maxPrice","in":"query","required":false,"schema":{"type":"number","format":"float","minimum":0},"description":"Upper price bound (inclusive). Same field rules as `minPrice`. 0 is treated as no bound."},{"name":"bedrooms","in":"query","required":false,"schema":{"type":"number","format":"float","minimum":0},"description":"Minimum number of bedrooms (`details.bedrooms >= value`). 0 is ignored."},{"name":"bathrooms","in":"query","required":false,"schema":{"type":"number","format":"float","minimum":0},"description":"Minimum number of bathrooms (`details.bathrooms >= value`). 0 is ignored."},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"`price_asc`, `price_desc`, `newest` or `rating`. Any other value, or none, sorts newest first. Price sorts order by `pricing.rentPrice` then `pricing.salePrice`. `rating` orders by `rating.averageRating`, which nothing in the service currently updates when a review is created."},{"name":"page","in":"query","required":false,"schema":{"type":"number","format":"float","minimum":1,"default":1},"description":"1-based page number. Default 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"number","format":"float","minimum":1,"maximum":100,"default":20},"description":"Page size, 1-100. Default 20."}],"responses":{"200":{"description":"Matching listings, newest first unless `sort` says otherwise. An empty `properties` array when nothing matches.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"properties":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["_id","firstName","lastName","avatar","phone","role","isKYCVerified"]},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["properties","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Properties searched successfully","data":{"properties":[{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":{"_id":"664a0b7e2f8c3d0011aa22bb","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/chinedu.jpg","phone":"+2348031234567","role":"LANDLORD","isKYCVerified":true},"agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-20T10:15:00.000Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"400":{"description":"Request validation failed (query). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"title\" is required","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/browse":{"get":{"tags":["property"],"operationId":"property_get_browse","summary":"Browse all public listings","description":"**Access:** Public, no token needed.\n\nPublic, unfiltered feed of every listing that is `listed`, verified and not deleted, newest first. Use `/property/search` when you need filters. Each item has `landlordId` populated with `firstName`, `lastName`, `email`, `phone`, `role` and `isKYCVerified`, so the lister's email and phone are public here. The populate also asks for `profilePhoto`, a field the user model does not have, so no photo comes back on this endpoint (the user's picture is `avatar`, which `/property/search` and `/property/{id}` return). `page` and `limit` are read with `parseInt` and have no upper bound; non-numeric values fall back to the defaults.","security":[],"x-doc-slug":"property/get-browse","x-short":"Public, unfiltered feed of every listing that is listed, verified and not deleted, newest first.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Default 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size. Default 20; not capped by the server."}],"responses":{"200":{"description":"A page of public listings.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"properties":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["_id","firstName","lastName","email","phone","role","isKYCVerified"]},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["properties","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Listed properties retrieved successfully","data":{"properties":[{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":{"_id":"664a0b7e2f8c3d0011aa22bb","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","phone":"+2348031234567","role":"LANDLORD","isKYCVerified":true},"agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-20T10:15:00.000Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/featured":{"get":{"tags":["property"],"operationId":"property_get_featured","summary":"listPublic","description":"**Access:** Public, no token needed.","security":[],"x-doc-slug":"property/get-featured","x-short":"listPublic","responses":{"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/me":{"get":{"tags":["property"],"operationId":"property_get_me","summary":"List my listings","description":"**Access:** Bearer token required.\n\nReturns the listings the caller owns or manages: every non-deleted property where they are the `landlordId` or the `agentId`, in any status, including drafts. Newest first by default.\n\nEach item is the property document plus two computed counters: `viewCount` (total recorded views, one per user per day) and `leadCount` (inspection requests for the listing that are still open: `scheduled`, `pending_review` or `in_progress`). `landlordId` is not populated here.\n\nNone of the query parameters are validated. `search` and `address` are used as case-insensitive regular expressions; an unknown `status` is silently ignored; a price bound of 0 is ignored. Any failure while querying is reported as a 500 `Failed to fetch properties`.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/get-me","x-short":"Returns the listings the caller owns or manages: every non-deleted property where they are the landlordId or the agentId, in any status, including drafts.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Default 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size. Default 20; not capped by the server."},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Free text over title, street, community and nearest landmark (case-insensitive)."},{"name":"address","in":"query","required":false,"schema":{"type":"string"},"description":"Case-insensitive match on street or nearest landmark."},{"name":"state","in":"query","required":false,"schema":{"type":"string"},"description":"Exact match on `location.state`."},{"name":"type","in":"query","required":false,"schema":{"type":"string"},"description":"Exact property type."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Listing status filter; unknown values are ignored."},{"name":"minPrice","in":"query","required":false,"schema":{"type":"number"},"description":"Lower price bound (inclusive)."},{"name":"maxPrice","in":"query","required":false,"schema":{"type":"number"},"description":"Upper price bound (inclusive)."},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"`price_asc`, `price_desc`, `newest` or `rating`."}],"responses":{"200":{"description":"A page of the caller's listings with view and lead counts.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"properties":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"viewCount":{"type":"integer"},"leadCount":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v","viewCount","leadCount"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["properties","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Properties fetched successfully","data":{"properties":[{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":"664a0b7e2f8c3d0011aa22bb","agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-20T10:15:00.000Z","__v":0,"viewCount":42,"leadCount":3}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/acquired":{"get":{"tags":["property"],"operationId":"property_get_acquired","summary":"List my escrow transactions as buyer","description":"**Access:** Bearer token required.\n\nDespite the name, this returns escrow transactions, not properties. `data.properties` is the list of escrow transaction records where the caller is the buyer, newest first, with `propertyId` populated (`title`, `location`, `media`, `pricing`, `details`, `status`, `type`, `rating`, `createdAt`) and `sellerId` populated (`firstName`, `lastName`, `avatar`).\n\nThere is no filter on transaction status or type, so `pending`, `cancelled` and `disputed` escrows and `inspection`-fee escrows are included alongside completed rents and purchases; filter on `status` and `transactionType` client-side if you only want properties the user actually acquired. `propertyId` is `null` if the property record no longer exists. The seller's payout account number is never included. See the escrow endpoints for the meaning of the money fields.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/get-acquired","x-short":"Despite the name, this returns escrow transactions, not properties.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Default 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size. Default 20; not capped by the server."}],"responses":{"200":{"description":"A page of the caller's escrow transactions.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"properties":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","title","type","status","location","details","pricing","media","rating","createdAt"]},"buyerId":{"type":"string"},"sellerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"pandascrowEscrowId":{"type":"integer"},"transactionType":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"platformFee":{"type":"integer"},"netAmount":{"type":"integer"},"sellerPayoutAccount":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"partnerEscrowFeePercent":{"nullable":true},"currency":{"type":"string"},"paymentUrl":{"type":"string"},"transactionRef":{"type":"string"},"bookingId":{"nullable":true},"inspectionId":{"nullable":true},"paymentNotifiedAt":{"nullable":true},"paymentProof":{"nullable":true},"releaseOtpResentAt":{"nullable":true},"completedAt":{"type":"string","format":"date-time"},"agentId":{"nullable":true},"agentCommission":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","buyerId","sellerId","pandascrowEscrowId","transactionType","status","amount","platformFee","netAmount","sellerPayoutAccount","partnerEscrowFeePercent","currency","paymentUrl","transactionRef","bookingId","inspectionId","paymentNotifiedAt","paymentProof","releaseOtpResentAt","completedAt","agentId","agentCommission","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["properties","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Acquired properties fetched successfully","data":{"properties":[{"_id":"66b2e3f4a5b6c7d8e9f01234","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"Serviced 3-bedroom apartment in Lekki Phase 1","type":"APARTMENT","status":"rented","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"rating":{"averageRating":0,"reviewCount":0},"createdAt":"2026-11-18T09:30:00.000Z"},"buyerId":"664b1c8f3a9d4e0012bb33cc","sellerId":{"_id":"664a0b7e2f8c3d0011aa22bb","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/chinedu.jpg"},"pandascrowEscrowId":482913,"transactionType":"rent","status":"completed","amount":4545000,"platformFee":45000,"netAmount":4500000,"sellerPayoutAccount":{"accountName":"Chinedu Okafor","bankCode":"058","bankName":"Guaranty Trust Bank"},"partnerEscrowFeePercent":null,"currency":"NGN","paymentUrl":"https://pay.example.com/escrow/482913","transactionRef":"HLH-ESC-20261121-7F3K2","bookingId":null,"inspectionId":null,"paymentNotifiedAt":null,"paymentProof":null,"releaseOtpResentAt":null,"completedAt":"2026-11-23T14:05:00.000Z","agentId":null,"agentCommission":0,"createdAt":"2026-11-21T11:00:00.000Z","updatedAt":"2026-11-23T14:05:00.000Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/{id}/publish":{"post":{"tags":["property"],"operationId":"property_post_id_publish","summary":"Publish a draft","description":"**Access:** Bearer token required. **Also requires:** Caller must be the listing's landlordId or agentId.\n\nMoves a draft into the verification queue: `status` goes from `draft` to `pending_verification`. This is the only way out of draft. The caller must be the listing's `landlordId` or `agentId`. No request body.\n\nPublishing re-arms every completeness rule on the model, so an unfinished draft is rejected with a 400 that lists what is missing. If image geotagging is switched on, the draft's stored photos are checked against its pin at this point.\n\nOn success the same side effects as a direct create run: the duplicate-listing check (which may open a flag for admins, silently) and, when an admin has set a default legal partner, automatic assignment to that lawyer with an in-app/socket (`notifications:new`), push and email notification. The returned document is the one saved before the auto-assignment, so `legalStatus` still reads `pending_verification`.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/post-id-publish","x-short":"Moves a draft into the verification queue: status goes from draft to pendingverification.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the draft property. A malformed id produces a 500 with Mongoose's cast error message instead of a 400/404."}],"responses":{"200":{"description":"The draft is now pending verification.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"}},"required":["isVerified"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Listing published successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":"664a0b7e2f8c3d0011aa22bb","agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"pending_verification","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":false},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"pending_verification","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-25T09:30:00.000Z","updatedAt":"2026-11-25T09:30:00.000Z","__v":0}}}}}}},"400":{"description":"- The listing is not a draft (already published, listed, unlisted, ...).\n- The draft is incomplete. The message joins every failing model rule with `; `. If Mongoose reports no field messages the message is just `This listing is not ready to publish`.\n- Only when an admin has switched on image geotagging (see `GET /api/v1/settings` -> `imageGeotagging`) and the listing is not a draft. A photo's reported GPS position is further from the listing's pin than `maxDistanceMeters`; in strict mode a photo with no GPS position, or a listing with no pin, is refused too. The message is built per request and names the offending photos (numbered from 1 in upload order).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The listing is not a draft (already published, listed, unlisted, ...).","value":{"status":400,"success":false,"message":"Only a draft listing can be published","data":null}},"example2":{"summary":"The draft is incomplete. The message joins every failing model rule with `; `. If Mongoose reports no field messages the message is just `This listing is not ready to publish`.","value":{"status":400,"success":false,"message":"This listing is not ready to publish: Property description is required; Street address is required; Available from date is required","data":null}},"example3":{"summary":"Only when an admin has switched on image geotagging (see `GET /api/v1/settings` -> `imageGeotagging`) and the listing is not a draft. A photo's reported GPS position is further from the listing's pin than `maxDistanceMeters`; in strict mode a photo with no GPS position, or a listing with no pin, is refused too. The message is built per request and names the offending photos (numbered from 1 in upload order).","value":{"status":400,"success":false,"message":"Photos must be taken within 500 m of the listing's address or landmark: photo 2 (3.4 km away).","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is neither the listing's landlord nor its agent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You are not authorized to publish this listing","data":null}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId. The raw Mongoose cast error is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\"","data":null}}}}}}}}},"/api/v1/property/{id}/draft":{"patch":{"tags":["property"],"operationId":"property_patch_id_draft","summary":"updateDraft","description":"**Access:** Bearer token required.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/patch-id-draft","x-short":"updateDraft","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["APARTMENT","HOUSE","VILLA","LAND","COMMERCIAL","SHORTLET","OFFICE"]},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":5000},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number","format":"float"},"minItems":2,"maxItems":2}}},"details":{"type":"object","properties":{"bedrooms":{"type":"number","format":"float","minimum":0,"maximum":50},"bathrooms":{"type":"number","format":"float","minimum":0,"maximum":50},"squareFeet":{"type":"number","format":"float","minimum":0},"area":{"type":"object","properties":{"value":{"type":"number","format":"float","minimum":0},"unit":{"type":"string","enum":["sqft","sqm","sqyd","sqin","acre","hectare"]}},"required":["value","unit"],"additionalProperties":false},"features":{"type":"array","items":{"type":"string"}}},"additionalProperties":false},"pricing":{"type":"object","properties":{"rentPrice":{"type":"number","format":"float","minimum":0},"salePrice":{"type":"number","format":"float","minimum":0},"currency":{"type":"string","enum":["NGN","USD","GHS","KES","ZAR"],"default":"NGN"},"rentDurationYears":{"type":"integer","minimum":1,"maximum":3}},"additionalProperties":false},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"}},"additionalProperties":false},"shortLet":{"type":"object","properties":{"maxNights":{"type":"number","format":"float","minimum":1,"maximum":365},"minNights":{"type":"number","format":"float","minimum":1},"nightlyPrice":{"type":"number","format":"float","minimum":0}},"additionalProperties":false,"oneOf":[{}]},"amenities":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":40}},"additionalProperties":false}}}},"responses":{"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"id\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/{id}":{"get":{"tags":["property"],"operationId":"property_get_id","summary":"Get a listing","description":"**Access:** Public, no token needed.\n\nReturns one property by id with `landlordId` populated (`firstName`, `lastName`, `avatar`, `phone`, `email`, `role`, `isKYCVerified`).\n\nThe endpoint is public and only excludes soft-deleted records. It does not check `status` or verification, so a draft, pending, unlisted, rented or sold listing is returned to anyone who has its id, together with the lister's phone and email. Clients should check `status` and `verification.isVerified` before presenting a listing as available.\n\nThe per-user `views` array is never included. A malformed id yields a 500, not a 404.","security":[],"x-doc-slug":"property/get-id","x-short":"Returns one property by id with landlordId populated (firstName, lastName, avatar, phone, email, role, isKYCVerified).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property."}],"responses":{"200":{"description":"The property document.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"isKYCVerified":{"type":"boolean"}},"required":["_id","firstName","lastName","avatar","phone","email","role","isKYCVerified"]},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Property fetched successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":{"_id":"664a0b7e2f8c3d0011aa22bb","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/chinedu.jpg","phone":"+2348031234567","email":"chinedu.okafor@example.com","role":"LANDLORD","isKYCVerified":true},"agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-20T10:15:00.000Z","__v":0}}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId (or the lookup failed for another reason). `errorData` carries the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch property","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}},"patch":{"tags":["property"],"operationId":"property_patch_id","summary":"Update a listing","description":"**Access:** Bearer token required. **Also requires:** Caller must be the listing's landlordId.\n\nPartial update of a small set of fields. Only the listing's `landlordId` may call it (an `agentId` on the listing gets a 403).\n\nOnly these values are written, everything else in the body is rejected by validation or ignored: `title`, `description`, `pricing.rentPrice`, `pricing.salePrice`, `pricing.rentDurationYears`, `availability.availableTo`, `details.features` and `amenities`. `details.features` and `amenities` replace the whole list. Type, location, bedrooms, bathrooms, area, currency, short-let terms, `availableFrom`, media and status cannot be changed here.\n\nThe update does not change `status`, does not send the listing back through verification and does not re-run the duplicate check. An empty body `{}` is accepted and returns the unchanged document.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/patch-id","x-short":"Partial update of a small set of fields.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property to update."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":5,"maxLength":200,"description":"New title, 5-200 characters."},"description":{"type":"string","minLength":20,"maxLength":5000,"description":"New description, 20-5000 characters."},"pricing":{"type":"object","properties":{"rentPrice":{"type":"number","format":"float","minimum":0},"salePrice":{"type":"number","format":"float","minimum":0},"rentDurationYears":{"type":"integer","minimum":1,"maximum":3}},"additionalProperties":false,"description":"`{ rentPrice?: number >= 0, salePrice?: number >= 0, rentDurationYears?: integer 1-3 }`. Only the keys sent are changed. `currency` cannot be changed."},"availability":{"type":"object","properties":{"availableTo":{"type":"string","format":"date-time"}},"additionalProperties":false,"description":"`{ availableTo?: date }`. Sets the date the listing stops being available."},"details":{"type":"object","properties":{"features":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"description":"`{ features?: string[] }`. Replaces the feature list. Bedrooms, bathrooms and area cannot be changed."},"amenities":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":40,"description":"Replaces the whole amenity list. Up to 40 strings of 1-40 characters."}},"additionalProperties":false},"examples":{"default":{"value":{"title":"Serviced 3-bedroom apartment in Lekki Phase 1 (newly renovated)","pricing":{"rentPrice":4800000,"rentDurationYears":2},"availability":{"availableTo":"2027-12-01"},"details":{"features":["Fitted kitchen","En-suite rooms","Inverter"]},"amenities":["wifi","parking","Borehole","gym"]}}}}}},"responses":{"200":{"description":"The updated property document (`landlordId` not populated).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"availableTo":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","availableTo","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Property updated successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":"664a0b7e2f8c3d0011aa22bb","agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1 (newly renovated)","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms","Inverter"]},"pricing":{"rentPrice":4800000,"salePrice":null,"currency":"NGN","rentDurationYears":2},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","availableTo":"2027-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole","gym"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-25T12:00:00.000Z","__v":0}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"id\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not the listing's landlord.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to update this property","data":null}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId. The underlying error message is passed through and `errorData` carries the serialized error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\"","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}},"delete":{"tags":["property"],"operationId":"property_delete_id","summary":"Delete a listing","description":"**Access:** Bearer token required. **Also requires:** Caller must be the listing's landlordId.\n\nSoft-deletes a property. Only the listing's `landlordId` may call it. The record is kept so bookings, escrow transactions and reviews that reference it still resolve, but `deletedAt` is stamped and `status` is set to `unlisted`, which removes it from search, browse, `GET /property/{id}`, `/property/me` and link previews. There is no undo endpoint, and the code does not check for active bookings or escrows before deleting. Reviews and wishlist entries for the property are left in place.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/delete-id","x-short":"Soft-deletes a property.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property to delete."}],"responses":{"200":{"description":"The property was soft-deleted. `data` is null.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Property deleted successfully","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not the listing's landlord.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to delete this property","data":null}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId, or the database call failed. `errorData` carries the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to delete property","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}}},"/api/v1/property/{id}/images":{"post":{"tags":["property"],"operationId":"property_post_id_images","summary":"Add images to a listing","description":"**Access:** Bearer token required. **Also requires:** Caller must be the listing's landlordId.\n\nAppends photos to `media.images`. Only the listing's `landlordId` may call it. Two request forms are accepted: `multipart/form-data` with files in `images` (max 20 per request, uploaded to Cloudinary), or `application/json` with `imageUrls`, an array of already-hosted URLs. Uploaded files win when both are present.\n\n`imagesMetadata` is matched to the images by index; only `address`, `coordinates`, `gps` and `tag` are kept from each entry. In multipart it must be a JSON-encoded string.\n\nA listing holds at most 50 images. Images beyond the cap are silently dropped and the call still returns 200, so compare `media.images.length` in the response with what you sent. Unless the listing is a draft, the new photos are checked against the listing's pin when image geotagging is switched on. Adding images does not change `status` or trigger re-verification.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/post-id-images","x-short":"Appends photos to media.images.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property."}],"requestBody":{"required":false,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"images":{"contentMediaType":"application/octet-stream","description":"Up to 20 image files of at most 10 MB each (jpg, jpeg, png, gif). Required unless `imageUrls` is sent as JSON."},"imagesMetadata":{"type":"array","items":{},"description":"One entry per image, matched by index: `{ address?: string, coordinates?: [longitude, latitude], gps?: [longitude, latitude], tag?: string }`. JSON-encoded string in multipart."},"imageUrls":{"type":"array","items":{},"description":"JSON-body alternative to file upload: a non-empty array of image URL strings. Ignored when files are uploaded."}}},"examples":{"default":{"value":{"imageUrls":["https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-kitchen.jpg"],"imagesMetadata":[{"tag":"Kitchen","gps":[3.4725,6.4476]}]}}}}}},"responses":{"200":{"description":"The property document with the new images appended.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Images added successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":"664a0b7e2f8c3d0011aa22bb","agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"},{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-kitchen.jpg","metadata":{"gps":[3.4725,6.4476],"tag":"Kitchen"},"_id":"665f1c2e9b1d4a0012ab34cf"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-25T12:00:00.000Z","__v":0}}}}}}},"400":{"description":"- No files were uploaded and `imageUrls` is missing, empty or not an array.\n- Only when an admin has switched on image geotagging (see `GET /api/v1/settings` -> `imageGeotagging`) and the listing is not a draft. A photo's reported GPS position is further from the listing's pin than `maxDistanceMeters`; in strict mode a photo with no GPS position, or a listing with no pin, is refused too. The message is built per request and names the offending photos (numbered from 1 in upload order).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No files were uploaded and `imageUrls` is missing, empty or not an array.","value":{"status":400,"success":false,"message":"At least one image file or URL is required","data":null}},"example2":{"summary":"Only when an admin has switched on image geotagging (see `GET /api/v1/settings` -> `imageGeotagging`) and the listing is not a draft. A photo's reported GPS position is further from the listing's pin than `maxDistanceMeters`; in strict mode a photo with no GPS position, or a listing with no pin, is refused too. The message is built per request and names the offending photos (numbered from 1 in upload order).","value":{"status":400,"success":false,"message":"Photos must be taken within 500 m of the listing's address or landmark: photo 2 (3.4 km away).","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not the listing's landlord.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to update this property","data":null}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"- `id` is not a valid ObjectId, or saving failed model validation (for example an `imageUrls` entry that is not a string). `errorData` carries the serialized underlying error.\n- An uploaded file has an extension outside the upload allow-list. The upload middleware raises a plain error with no status, so it surfaces as a 500 rather than a 400. Note that no video extension (mp4, mov, ...) and no webp/heic is on the list.\n- A file is larger than 10 MB. Multer's error has no HTTP status, so it surfaces as a 500 and carries Multer's error code.\n- More files than the field allows were sent, or a file was sent under a field name the route does not accept. Surfaces as a 500 with Multer's error code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`id` is not a valid ObjectId, or saving failed model validation (for example an `imageUrls` entry that is not a string). `errorData` carries the serialized underlying error.","value":{"status":500,"success":false,"message":"Failed to add images","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}},"example2":{"summary":"An uploaded file has an extension outside the upload allow-list. The upload middleware raises a plain error with no status, so it surfaces as a 500 rather than a 400. Note that no video extension (mp4, mov, ...) and no webp/heic is on the list.","value":{"status":500,"success":false,"message":"File type not allowed. Allowed types: jpg, jpeg, png, gif, pdf, doc, docx, xls, xlsx, ppt, pptx, txt","data":null}},"example3":{"summary":"A file is larger than 10 MB. Multer's error has no HTTP status, so it surfaces as a 500 and carries Multer's error code.","value":{"status":500,"success":false,"message":"File too large","data":null,"code":"LIMIT_FILE_SIZE"}},"example4":{"summary":"More files than the field allows were sent, or a file was sent under a field name the route does not accept. Surfaces as a 500 with Multer's error code.","value":{"status":500,"success":false,"message":"Unexpected field","data":null,"code":"LIMIT_UNEXPECTED_FILE"}}}}}}}}},"/api/v1/property/{id}/images/reorder":{"patch":{"tags":["property"],"operationId":"property_patch_id_images_reorder","summary":"Reorder listing images","description":"**Access:** Bearer token required. **Also requires:** Caller must be the listing's landlordId.\n\nReorders `media.images`; index 0 is the listing's cover image. Only the listing's `landlordId` may call it. `imageUrls` may list any subset of the listing's current image URLs (typically just the one being promoted): those are placed first in the order given and every other image keeps its relative order after them. URLs that do not belong to the listing are ignored, but at least one must match. Each image keeps its metadata. This endpoint cannot add or remove images. The route has no request validator, and a request with no JSON body at all fails with a 500 rather than the 400 below.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/patch-id-images-reorder","x-short":"Reorders media.images; index 0 is the listing's cover image.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"imageUrls":{"type":"array","items":{},"description":"Non-empty array of image URL strings already stored on the listing, in the order they should appear at the front of the gallery."}},"required":["imageUrls"]},"examples":{"default":{"value":{"imageUrls":["https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-kitchen.jpg"]}}}}}},"responses":{"200":{"description":"The property document with the new image order.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Images reordered successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":"664a0b7e2f8c3d0011aa22bb","agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-kitchen.jpg","metadata":{"gps":[3.4725,6.4476],"tag":"Kitchen"},"_id":"665f1c2e9b1d4a0012ab34cf"},{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-25T12:00:00.000Z","__v":0}}}}}}},"400":{"description":"- `imageUrls` is missing, empty or not an array.\n- No URL in `imageUrls` matches an image on this listing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`imageUrls` is missing, empty or not an array.","value":{"status":400,"success":false,"message":"imageUrls must be a non-empty array","data":null}},"example2":{"summary":"No URL in `imageUrls` matches an image on this listing.","value":{"status":400,"success":false,"message":"None of the given imageUrls belong to this property","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not the listing's landlord.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to update this property","data":null}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId, or saving failed. `errorData` carries the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to reorder images","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}}},"/api/v1/property/{id}/images/tags":{"patch":{"tags":["property"],"operationId":"property_patch_id_images_tags","summary":"Set or clear image room tags","description":"**Access:** Bearer token required. **Also requires:** Caller must be the listing's landlordId.\n\nSets or clears the room tag (`metadata.tag`, e.g. \"Kitchen\", \"Bedroom\") on images already stored on the listing. Only the listing's `landlordId` may call it. Each entry names an image by its exact stored URL. A tag is trimmed, inner whitespace is collapsed and it is capped at 30 characters; an empty string or `null` removes the tag. Images not listed keep their tag, unknown URLs are ignored, but at least one URL must belong to the listing.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/patch-id-images-tags","x-short":"Sets or clears the room tag (metadata.tag, e.g.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"tag":{"type":["string","null"],"maxLength":30}},"required":["url","tag"],"additionalProperties":false},"minItems":1,"maxItems":50,"description":"1-50 entries of `{ url: string, tag: string | null }`. Both keys are required in each entry; `tag` is at most 30 characters, and `\"\"` or `null` clears the tag."}},"required":["images"],"additionalProperties":false},"examples":{"default":{"value":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","tag":"Living Room"},{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-kitchen.jpg","tag":null}]}}}}}},"responses":{"200":{"description":"The property document with updated image tags.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Image tags updated successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":"664a0b7e2f8c3d0011aa22bb","agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-25T12:00:00.000Z","__v":0}}}}}}},"400":{"description":"- No URL in `images` matches an image on this listing.\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No URL in `images` matches an image on this listing.","value":{"status":400,"success":false,"message":"None of the given image URLs belong to this property","data":null}},"example2":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"images\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not the listing's landlord.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to update this property","data":null}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId, or saving failed. `errorData` carries the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to update image tags","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}}},"/api/v1/property/{id}/reviews":{"get":{"tags":["property"],"operationId":"property_get_id_reviews","summary":"List reviews for a listing","description":"**Access:** Public, no token needed.\n\nPublic list of a property's reviews, newest first, with `reviewerId` populated (`firstName`, `lastName`, `avatar`). All reviews are returned whether or not they are `verified`; the verified-only filter is commented out in the code. Pagination is reported as `total` and `pages` next to the list; the requested `page` and `limit` are not echoed back. The property lookup does not exclude soft-deleted properties.","security":[],"x-doc-slug":"property/get-id-reviews","x-short":"Public list of a property's reviews, newest first, with reviewerId populated (firstName, lastName, avatar).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property. A malformed id produces a 500 with Mongoose's cast error message."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Default 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10},"description":"Page size. Default 10; not capped by the server."}],"responses":{"200":{"description":"A page of reviews. `pages` is `ceil(total / limit)`.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"reviews":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"reviewerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"transactionId":{"nullable":true},"rating":{"type":"integer"},"title":{"type":"string"},"comment":{"type":"string"},"categories":{"type":"object","properties":{"cleanliness":{"type":"integer"},"communication":{"type":"integer"},"accuracy":{"type":"integer"},"location":{"type":"integer"}},"required":["cleanliness","communication","accuracy","location"]},"verified":{"type":"boolean"},"helpful":{"type":"integer"},"unhelpful":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","reviewerId","transactionId","rating","title","comment","categories","verified","helpful","unhelpful","createdAt","updatedAt","__v"]}},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["reviews","total","pages"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Reviews fetched successfully","data":{"reviews":[{"_id":"66a1d2e3f4a5b6c7d8e9f012","propertyId":"665f1c2e9b1d4a0012ab34cd","reviewerId":{"_id":"664b1c8f3a9d4e0012bb33cc","firstName":"Aisha","lastName":"Bello","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/aisha.jpg"},"transactionId":null,"rating":4,"title":"Clean, quiet and well managed","comment":"The apartment matched the photos, power was steady and the agent responded quickly whenever we had a question.","categories":{"cleanliness":5,"communication":4,"accuracy":4,"location":5},"verified":false,"helpful":0,"unhelpful":0,"createdAt":"2026-11-25T13:20:00.000Z","updatedAt":"2026-11-25T13:20:00.000Z","__v":0}],"total":1,"pages":1}}}}}}},"404":{"description":"No property with this id exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId. The raw Mongoose cast error is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\"","data":null}}}}}}}},"post":{"tags":["property"],"operationId":"property_post_id_reviews","summary":"Review a listing","description":"**Access:** Bearer token required.\n\nCreates the caller's review of a property. Each user can review a given property once; a second attempt is a 409. There are no endpoints to edit or delete a review.\n\nThe code does not check that the reviewer rented, bought or booked the property, does not stop owners reviewing their own listing, and does not exclude soft-deleted properties. New reviews are stored with `verified: false`.\n\nCreating a review does not update the property's `rating.averageRating` / `rating.reviewCount`; nothing in the service writes those fields, so compute averages from `GET /property/{id}/reviews` if you need them.\n\nIf the property has an `agentId` and the reviewer is not that agent, the agent is notified (event type `agent_review_received`): an in-app notification record, a `notifications:new` socket event, a push notification and an email, subject to the agent's notification preferences. The landlord is not notified.\n\nThe route has no request validator; the rules below come from the model, so violations come back as `400 Validation Error: Review validation failed: ...`. A request with no JSON body at all fails with a 500.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/post-id-reviews","x-short":"Creates the caller's review of a property.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property being reviewed. A malformed id produces a 500 with Mongoose's cast error message."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"type":"number","description":"Overall rating, 1-5."},"title":{"type":"string","description":"5-100 characters."},"comment":{"type":"string","description":"20-5000 characters."},"categories":{"type":"object","description":"Optional sub-ratings, each 1-5: `{ cleanliness?, communication?, accuracy?, location? }`."}},"required":["rating","title","comment"]},"examples":{"default":{"value":{"rating":4,"title":"Clean, quiet and well managed","comment":"The apartment matched the photos, power was steady and the agent responded quickly whenever we had a question.","categories":{"cleanliness":5,"communication":4,"accuracy":4,"location":5}}}}}}},"responses":{"201":{"description":"Review created. `reviewerId` is populated with the reviewer's `firstName`, `lastName` and `avatar`.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"reviewerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"transactionId":{"nullable":true},"rating":{"type":"integer"},"title":{"type":"string"},"comment":{"type":"string"},"categories":{"type":"object","properties":{"cleanliness":{"type":"integer"},"communication":{"type":"integer"},"accuracy":{"type":"integer"},"location":{"type":"integer"}},"required":["cleanliness","communication","accuracy","location"]},"verified":{"type":"boolean"},"helpful":{"type":"integer"},"unhelpful":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","reviewerId","transactionId","rating","title","comment","categories","verified","helpful","unhelpful","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":201,"success":true,"message":"Review created successfully","data":{"_id":"66a1d2e3f4a5b6c7d8e9f012","propertyId":"665f1c2e9b1d4a0012ab34cd","reviewerId":{"_id":"664b1c8f3a9d4e0012bb33cc","firstName":"Aisha","lastName":"Bello","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/aisha.jpg"},"transactionId":null,"rating":4,"title":"Clean, quiet and well managed","comment":"The apartment matched the photos, power was steady and the agent responded quickly whenever we had a question.","categories":{"cleanliness":5,"communication":4,"accuracy":4,"location":5},"verified":false,"helpful":0,"unhelpful":0,"createdAt":"2026-11-25T13:20:00.000Z","updatedAt":"2026-11-25T13:20:00.000Z","__v":0}}}}}}},"400":{"description":"A field is missing or out of range. The message is Mongoose's and lists every failing path.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Validation Error: Review validation failed: title: Title must be at least 5 characters, comment: Review comment is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No property with this id exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"409":{"description":"The caller has already reviewed this property.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":409,"success":false,"message":"You have already reviewed this property","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId. The raw Mongoose cast error is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\"","data":null}}}}}}}}},"/api/v1/property/{id}/view":{"post":{"tags":["property"],"operationId":"property_post_id_view","summary":"Record a listing view","description":"**Access:** Bearer token required.\n\nRecords that the authenticated user viewed a listing. At most one view per user per property per UTC calendar day is stored (with the timestamp, weekday label and UTC hour, used for the lister's analytics and the `viewCount` on `/property/me`). The call is idempotent and always answers 200: `View recorded` the first time that day, `View already counted today` afterwards. The second message is also what you get when the property does not exist, so it cannot be used to test for existence. No request body; `data` is always null. The owner's own views are counted like anyone else's.","security":[{"bearerAuth":[]}],"x-doc-slug":"property/post-id-view","x-short":"Records that the authenticated user viewed a listing.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property being viewed."}],"responses":{"200":{"description":"- First view by this user today; a view entry was stored.\n- The user already has a view for today, or no property has this id. Nothing was stored.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"First view by this user today; a view entry was stored.","value":{"status":200,"success":true,"message":"View recorded","data":null}},"example2":{"summary":"The user already has a view for today, or no property has this id. Nothing was stored.","value":{"status":200,"success":true,"message":"View already counted today","data":null}}}}}},"400":{"description":"`id` is not a valid ObjectId.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid property ID","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/property/{id}/availability":{"get":{"tags":["property"],"operationId":"property_get_id_availability","summary":"Get short-let availability","description":"**Access:** Public, no token needed.\n\nPublic calendar data for a short-let property: the stay terms and the date ranges already held by a requested or confirmed booking. Ranges are half-open (the `checkIn` night is taken, the `checkOut` date is free, so one guest can leave the day another arrives) and ranges whose `checkOut` is before today (UTC) are left out. No booking or guest identifiers are exposed. The result is advisory: the authoritative overlap check runs atomically when a booking is made, so dates can still be lost between loading this and booking. Like `GET /property/{id}`, the lookup only excludes soft-deleted properties and does not check listing status.","security":[],"x-doc-slug":"property/get-id-availability","x-short":"Public calendar data for a short-let property: the stay terms and the date ranges already held by a requested or confirmed booking.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the short-let property."}],"responses":{"200":{"description":"Stay terms and upcoming booked ranges. `maxNights` and `nightlyPrice` are null if the property has no short-let terms stored.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"minNights":{"type":"integer"},"maxNights":{"type":"integer"},"nightlyPrice":{"type":"integer"},"currency":{"type":"string"},"bookedRanges":{"type":"array","items":{"type":"object","properties":{"checkIn":{"type":"string","format":"date-time"},"checkOut":{"type":"string","format":"date-time"}},"required":["checkIn","checkOut"]}}},"required":["minNights","maxNights","nightlyPrice","currency","bookedRanges"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Availability fetched successfully","data":{"minNights":2,"maxNights":30,"nightlyPrice":85000,"currency":"NGN","bookedRanges":[{"checkIn":"2026-12-20T00:00:00.000Z","checkOut":"2026-12-27T00:00:00.000Z"}]}}}}}}},"400":{"description":"The property exists but its `type` is not `SHORTLET`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"This property is not a short let","data":null}}}}}},"404":{"description":"No property with this id exists, or it has been soft-deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`id` is not a valid ObjectId (or the lookup failed). `errorData` carries the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch property","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}}},"/api/v1/property/review/{reviewId}":{"get":{"tags":["property"],"operationId":"property_get_review_review_id","summary":"Get a review","description":"**Access:** Public, no token needed.\n\nPublic lookup of a single review by its id. `reviewerId` is populated with `firstName`, `lastName` and `avatar`, and `propertyId` is populated with the property's `_id` and `title` (it is `null` if the property record no longer exists).","security":[],"x-doc-slug":"property/get-review-review-id","x-short":"Public lookup of a single review by its id.","parameters":[{"name":"reviewId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the review. A malformed id produces a 500 with Mongoose's cast error message."}],"responses":{"200":{"description":"The review.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"}},"required":["_id","title"]},"reviewerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"transactionId":{"nullable":true},"rating":{"type":"integer"},"title":{"type":"string"},"comment":{"type":"string"},"categories":{"type":"object","properties":{"cleanliness":{"type":"integer"},"communication":{"type":"integer"},"accuracy":{"type":"integer"},"location":{"type":"integer"}},"required":["cleanliness","communication","accuracy","location"]},"verified":{"type":"boolean"},"helpful":{"type":"integer"},"unhelpful":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","reviewerId","transactionId","rating","title","comment","categories","verified","helpful","unhelpful","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Review fetched successfully","data":{"_id":"66a1d2e3f4a5b6c7d8e9f012","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"Serviced 3-bedroom apartment in Lekki Phase 1"},"reviewerId":{"_id":"664b1c8f3a9d4e0012bb33cc","firstName":"Aisha","lastName":"Bello","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/aisha.jpg"},"transactionId":null,"rating":4,"title":"Clean, quiet and well managed","comment":"The apartment matched the photos, power was steady and the agent responded quickly whenever we had a question.","categories":{"cleanliness":5,"communication":4,"accuracy":4,"location":5},"verified":false,"helpful":0,"unhelpful":0,"createdAt":"2026-11-25T13:20:00.000Z","updatedAt":"2026-11-25T13:20:00.000Z","__v":0}}}}}}},"404":{"description":"No review with this id exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Review not found","data":null}}}}}},"500":{"description":"`reviewId` is not a valid ObjectId. The raw Mongoose cast error is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Review\"","data":null}}}}}}}}},"/api/v1/booking/create":{"post":{"tags":["booking"],"operationId":"booking_post_create","summary":"Create a booking request","description":"**Access:** Bearer token required.\n\nCreates a booking in status `requested` for the authenticated user (stored as `tenantId`); `landlordId` is copied from the property. `type` selects one of three flows:\n\n- `viewing` – a visit request for `requestedDate` (must be in the future). The listing agent (or the landlord when the property has no `agentId`) gets a `booking_requested` notification.\n- `reservation` – the \"request payment\" step of a property inquiry. Only one reservation in status `requested` or `confirmed` is allowed per tenant per property. The agent/landlord gets a `payment_request` notification with the *New Payment Request* email.\n- `shortlet` – a stay on a `SHORTLET` property. Send `checkIn`/`checkOut` instead of `requestedDate` (which is forbidden for this type). Dates are normalised to midnight UTC, the stay must respect the property's `shortLet.minNights`/`maxNights`, and the nights are claimed atomically in `property.shortLet.bookedRanges` (check-out day is free, so back-to-back stays may share a date). `totalPrice` is stored as `nights * shortLet.nightlyPrice`. The agent/landlord gets a `payment_request` notification titled *New Stay Request*.\n\nNotifications are delivered per the recipient's preferences (stored in-app + `notifications:new` socket event, push, email) and never fail the request. You cannot book a property whose `landlordId` is you. No role, email-verification or KYC check is applied.","security":[{"bearerAuth":[]}],"x-doc-slug":"booking/post-create","x-short":"Creates a booking in status requested for the authenticated user (stored as tenantId); landlordId is copied from the property.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"propertyId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"ObjectId of the property being booked."},"type":{"type":"string","enum":["viewing","reservation","shortlet"],"description":"Booking flow: `viewing`, `reservation` (payment request) or `shortlet` (stay)."},"requestedDate":{"type":"string","format":"date-time","oneOf":[{"x-required":true}],"description":"Required for `viewing` and `reservation`, forbidden for `shortlet`. Must be later than the current server time."},"checkIn":{"type":"string","format":"date-time","oneOf":[{"x-required":true}],"description":"Required for `shortlet`, forbidden otherwise. First night of the stay; truncated to midnight UTC and must not be before today (UTC)."},"checkOut":{"type":"string","format":"date-time","oneOf":[{"x-required":true}],"description":"Required for `shortlet`, forbidden otherwise. Must be after `checkIn`; truncated to midnight UTC. The check-out day itself is not occupied."},"notes":{"type":"string","maxLength":500,"description":"Free-text note for the landlord/agent (max 500 characters)."},"visitDuration":{"type":"number","format":"float","minimum":0.5,"maximum":8,"description":"Viewings only: expected length of the visit in hours (0.5 to 8). Stored on `dates.visitDuration`."}},"required":["propertyId","type"],"additionalProperties":false},"examples":{"default":{"value":{"propertyId":"664a0b7e3f2c1d0012ef5a01","type":"viewing","requestedDate":"2026-12-04T10:00:00.000Z","visitDuration":1,"notes":"I would like to see the kitchen and the parking space."}}}}}},"responses":{"201":{"description":"- Viewing (or reservation) booking created. `data` is the new booking document.\n- Short-let stay created. `dates` carries `checkIn`, `checkOut` and `nights` instead of `requestedDate`, and `totalPrice` is set.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"tenantId":{"type":"string"},"landlordId":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"dates":{"type":"object","properties":{"requestedDate":{"type":"string","format":"date-time"},"visitDuration":{"type":"integer"}},"required":["requestedDate","visitDuration"]},"notes":{"type":"string"},"escrowId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","tenantId","landlordId","status","type","dates","notes","escrowId","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Viewing (or reservation) booking created. `data` is the new booking document.","value":{"status":201,"success":true,"message":"Booking created successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":"664a0b7e3f2c1d0012ef5a01","tenantId":"663d9a1c5e4b2a0012cd7f10","landlordId":"6629e4f08a7b3c0012aa9e42","status":"requested","type":"viewing","dates":{"requestedDate":"2026-12-04T10:00:00.000Z","visitDuration":1},"notes":"I would like to see the kitchen and the parking space.","escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-25T09:14:22.318Z","__v":0}}},"example2":{"summary":"Short-let stay created. `dates` carries `checkIn`, `checkOut` and `nights` instead of `requestedDate`, and `totalPrice` is set.","value":{"status":201,"success":true,"message":"Booking created successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":"664a0b7e3f2c1d0012ef5a01","tenantId":"663d9a1c5e4b2a0012cd7f10","landlordId":"6629e4f08a7b3c0012aa9e42","status":"requested","type":"shortlet","dates":{"checkIn":"2026-12-18T00:00:00.000Z","checkOut":"2026-12-21T00:00:00.000Z","nights":3},"totalPrice":255000,"notes":"Arriving late in the evening.","escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-25T09:14:22.318Z","__v":0}}}}}}},"400":{"description":"- The property's `landlordId` is the caller.\n- `requestedDate` is not later than now (viewing / reservation).\n- `type` is `shortlet` but the property's type is not `SHORTLET`.\n- The short-let property has no `shortLet.maxNights` or `shortLet.nightlyPrice`.\n- `checkIn` is before today (UTC).\n- After truncating both dates to midnight UTC the stay is shorter than one night.\n- Stay is shorter than the property's `shortLet.minNights` (message interpolates the minimum).\n- Stay is longer than the property's `shortLet.maxNights` (message interpolates the maximum).\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The property's `landlordId` is the caller.","value":{"status":400,"success":false,"message":"You cannot book your own property","data":null}},"example2":{"summary":"`requestedDate` is not later than now (viewing / reservation).","value":{"status":400,"success":false,"message":"Requested date must be in the future","data":null}},"example3":{"summary":"`type` is `shortlet` but the property's type is not `SHORTLET`.","value":{"status":400,"success":false,"message":"This property is not available as a short let","data":null}},"example4":{"summary":"The short-let property has no `shortLet.maxNights` or `shortLet.nightlyPrice`.","value":{"status":400,"success":false,"message":"This short let has no booking terms set","data":null}},"example5":{"summary":"`checkIn` is before today (UTC).","value":{"status":400,"success":false,"message":"Check-in cannot be in the past","data":null}},"example6":{"summary":"After truncating both dates to midnight UTC the stay is shorter than one night.","value":{"status":400,"success":false,"message":"Check-out must be at least one night after check-in","data":null}},"example7":{"summary":"Stay is shorter than the property's `shortLet.minNights` (message interpolates the minimum).","value":{"status":400,"success":false,"message":"This property has a minimum stay of 2 nights","data":null}},"example8":{"summary":"Stay is longer than the property's `shortLet.maxNights` (message interpolates the maximum).","value":{"status":400,"success":false,"message":"This property can be booked for at most 14 nights","data":null}},"example9":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"propertyId\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No property with that id (for `shortlet`, soft-deleted properties also count as missing).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"409":{"description":"- The caller already has a `requested` or `confirmed` reservation on this property.\n- The requested nights overlap a range already held by another booking.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The caller already has a `requested` or `confirmed` reservation on this property.","value":{"status":409,"success":false,"message":"You already have an active payment request for this property","data":null}},"example2":{"summary":"The requested nights overlap a range already held by another booking.","value":{"status":409,"success":false,"message":"Those dates have just been taken. Please choose others.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/booking/me":{"get":{"tags":["booking"],"operationId":"booking_get_me","summary":"List my bookings","description":"**Access:** Bearer token required.\n\nReturns a page of bookings, newest first, with `propertyId` (`title`, `location`), `tenantId` and `landlordId` (`firstName`, `lastName`, `avatar`) populated.\n\nThe filter depends on the caller's role: `TENANT` sees bookings where they are the tenant, `LANDLORD` sees bookings where they are the landlord. **For every other role (`AGENT`, `LAWYER`, `DEVELOPER`, `ADMIN`) the service applies no filter at all and returns every booking on the platform.** Bookings of all types (`viewing`, `reservation`, `shortlet`) and all statuses (`requested`, `confirmed`, `completed`, `cancelled`) are included.","security":[{"bearerAuth":[]}],"x-doc-slug":"booking/get-me","x-short":"Returns a page of bookings, newest first, with propertyId (title, location), tenantId and landlordId (firstName, lastName, avatar) populated.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Bookings per page. Defaults to 20; no upper bound is enforced."}],"responses":{"200":{"description":"Page of bookings.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"bookings":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]}},"required":["_id","title","location"]},"tenantId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"status":{"type":"string"},"type":{"type":"string"},"dates":{"type":"object","properties":{"requestedDate":{"type":"string","format":"date-time"},"visitDuration":{"type":"integer"}},"required":["requestedDate","visitDuration"]},"notes":{"type":"string"},"escrowId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","tenantId","landlordId","status","type","dates","notes","escrowId","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["bookings","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Bookings fetched successfully","data":{"bookings":[{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","title":"3 Bedroom Apartment in Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}}},"tenantId":{"_id":"663d9a1c5e4b2a0012cd7f10","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/chinedu.jpg"},"landlordId":{"_id":"6629e4f08a7b3c0012aa9e42","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/folake.jpg"},"status":"requested","type":"viewing","dates":{"requestedDate":"2026-12-04T10:00:00.000Z","visitDuration":1},"notes":"I would like to see the kitchen and the parking space.","escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-25T09:14:22.318Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Any database error while listing is wrapped in this message. The response also carries an `errorData` object with the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch bookings","data":null}}}}}}}}},"/api/v1/booking/landlord/payment-requests":{"get":{"tags":["booking"],"operationId":"booking_get_landlord_payment_requests","summary":"List payment requests for my properties","description":"**Access:** Bearer token required.\n\nReturns the landlord's incoming payment requests: bookings of type `reservation` or `shortlet` whose `landlordId` is the caller, newest first. `propertyId` is populated with `title`, `location`, `media`, `pricing` and `type`; `tenantId` with `firstName`, `lastName`, `avatar`, `email` and `phone`. Matching is on the booking's `landlordId` only, so a listing agent who is not the property's landlord gets an empty list. There is no role check; any authenticated user may call it.","security":[{"bearerAuth":[]}],"x-doc-slug":"booking/get-landlord-payment-requests","x-short":"Returns the landlord's incoming payment requests: bookings of type reservation or shortlet whose landlordId is the caller, newest first.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Bookings per page. Defaults to 20; no upper bound is enforced."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by booking status: `requested`, `confirmed`, `completed` or `cancelled`. Omit or pass `all` for every status. The value is not validated; an unknown status simply matches nothing."}],"responses":{"200":{"description":"Page of payment requests.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"bookings":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","type","location","pricing","media"]},"tenantId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}},"required":["_id","firstName","lastName","avatar","email","phone"]},"landlordId":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"dates":{"type":"object","properties":{"requestedDate":{"type":"string","format":"date-time"}},"required":["requestedDate"]},"escrowId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","tenantId","landlordId","status","type","dates","escrowId","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["bookings","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Payment requests fetched","data":{"bookings":[{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","title":"3 Bedroom Apartment in Lekki Phase 1","type":"APARTMENT","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"tenantId":{"_id":"663d9a1c5e4b2a0012cd7f10","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/chinedu.jpg","email":"chinedu.okafor@example.com","phone":"+2348031234567"},"landlordId":"6629e4f08a7b3c0012aa9e42","status":"requested","type":"reservation","dates":{"requestedDate":"2026-12-01T09:00:00.000Z"},"escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-25T09:14:22.318Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Any database error while listing is wrapped in this message, with the serialized underlying error in `errorData`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch payment requests","data":null}}}}}}}}},"/api/v1/booking/property/{propertyId}/payment-request":{"get":{"tags":["booking"],"operationId":"booking_get_property_property_id_payment_request","summary":"Get my latest payment request for a property","description":"**Access:** Bearer token required.\n\nReturns the caller's most recent `reservation` or `shortlet` booking on the given property, in any status, or `data: null` when they have never made one (still HTTP 200). Clients use `status` to decide between showing *Request Payment* (`null` or `cancelled`), waiting (`requested`) and *Make Payment* (`confirmed`). `propertyId` is populated with `title`, `location`, `media` and `pricing`; `landlordId` with `firstName`, `lastName` and `avatar`. `propertyId` is not validated: a malformed id produces the 500 below rather than a 400.","security":[{"bearerAuth":[]}],"x-doc-slug":"booking/get-property-property-id-payment-request","x-short":"Returns the caller's most recent reservation or shortlet booking on the given property, in any status, or data: null when they have never made one (still HTTP 200).","parameters":[{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property."}],"responses":{"200":{"description":"- The caller's latest payment request for the property.\n- The caller has no reservation or short-let booking on this property.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","location","pricing","media"]},"tenantId":{"type":"string"},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"status":{"type":"string"},"type":{"type":"string"},"dates":{"type":"object","properties":{"requestedDate":{"type":"string","format":"date-time"},"confirmedDate":{"type":"string","format":"date-time"}},"required":["requestedDate","confirmedDate"]},"escrowId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","tenantId","landlordId","status","type","dates","escrowId","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"The caller's latest payment request for the property.","value":{"status":200,"success":true,"message":"Payment request fetched","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","title":"3 Bedroom Apartment in Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"tenantId":"663d9a1c5e4b2a0012cd7f10","landlordId":{"_id":"6629e4f08a7b3c0012aa9e42","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/folake.jpg"},"status":"confirmed","type":"reservation","dates":{"requestedDate":"2026-12-01T09:00:00.000Z","confirmedDate":"2026-12-01T09:00:00.000Z"},"escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-25T11:02:40.007Z","__v":0}}},"example2":{"summary":"The caller has no reservation or short-let booking on this property.","value":{"status":200,"success":true,"message":"Payment request fetched","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Malformed `propertyId` or any database error. `errorData` carries the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch payment request","data":null}}}}}}}}},"/api/v1/booking/{id}":{"get":{"tags":["booking"],"operationId":"booking_get_id","summary":"Get a booking by ID","description":"**Access:** Bearer token required.\n\nReturns one booking with `propertyId` populated as the **full property document**, `tenantId` and `landlordId` populated with `firstName`, `lastName`, `avatar` and `email`, and `escrowId` populated with the linked `EscrowTransaction` (or `null`).\n\nOnly the booking's tenant, its landlord, the agent on its property (`propertyId.agentId`) and admins (`ADMIN` role) may read it. Anyone else who is signed in gets a 403, checked after the booking is loaded, so an unknown id still answers 404.\n\nA malformed id is not rejected with a 400; it surfaces as the 500 below.","security":[{"bearerAuth":[]}],"x-doc-slug":"booking/get-id","x-short":"Returns one booking with propertyId populated as the full property document, tenantId and landlordId populated with firstName, lastName, avatar and email, and escrowId populated...","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the booking."}],"responses":{"200":{"description":"Booking found. The populated property is shown trimmed here; the real response contains the whole property document (description, details, availability, shortLet, amenities, verification, legalStatus and so on).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","landlordId","agentId","title","type","status","location","details","pricing","media"]},"tenantId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"email":{"type":"string"}},"required":["_id","firstName","lastName","avatar","email"]},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"email":{"type":"string"}},"required":["_id","firstName","lastName","avatar","email"]},"status":{"type":"string"},"type":{"type":"string"},"dates":{"type":"object","properties":{"requestedDate":{"type":"string","format":"date-time"},"visitDuration":{"type":"integer"}},"required":["requestedDate","visitDuration"]},"notes":{"type":"string"},"escrowId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","tenantId","landlordId","status","type","dates","notes","escrowId","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Booking fetched successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","landlordId":"6629e4f08a7b3c0012aa9e42","agentId":"662b7c3d1f0e9a0012bb4c55","title":"3 Bedroom Apartment in Lekki Phase 1","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":["Fitted kitchen"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"tenantId":{"_id":"663d9a1c5e4b2a0012cd7f10","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/chinedu.jpg","email":"chinedu.okafor@example.com"},"landlordId":{"_id":"6629e4f08a7b3c0012aa9e42","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/folake.jpg","email":"folake.adeyemi@example.com"},"status":"requested","type":"viewing","dates":{"requestedDate":"2026-12-04T10:00:00.000Z","visitDuration":1},"notes":"I would like to see the kitchen and the parking space.","escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-25T09:14:22.318Z","__v":0}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not the tenant, the landlord, the property's agent or an admin.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have access to this booking","data":null}}}}}},"404":{"description":"No booking with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Booking not found","data":null}}}}}},"500":{"description":"Malformed id or any database error. `errorData` carries the serialized underlying error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch booking","data":null}}}}}}}}},"/api/v1/booking/{id}/confirm":{"patch":{"tags":["booking"],"operationId":"booking_patch_id_confirm","summary":"Confirm a booking","description":"**Access:** Bearer token required. **Also requires:** Caller must be the booking's `landlordId`.\n\nAccepts a booking: sets `status` to `confirmed`, stores `dates.confirmedDate` and, when sent, overwrites `dates.visitDuration`. Only the user stored as the booking's `landlordId` may call it; a listing agent who received the request notification but is not the property's landlord gets the 403.\n\nSide effects: a `booking:updated` event (`{ bookingId, propertyId, status, type }`) is pushed over SSE and Socket.IO to both the tenant and the landlord, and the tenant is notified. For `reservation` and `shortlet` bookings that is a `payment_request_accepted` notification with the *Your Payment Request Was Accepted* email, which is the tenant's cue to pay; for `viewing` it is `booking_confirmed`.\n\nThe current status is not checked, so a `cancelled` or already `confirmed` booking can be confirmed again (and the tenant is notified again). The validator requires `confirmedDate` for every booking type, including stays whose dates are already fixed.","security":[{"bearerAuth":[]}],"x-doc-slug":"booking/patch-id-confirm","x-short":"Accepts a booking: sets status to confirmed, stores dates.confirmedDate and, when sent, overwrites dates.visitDuration.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the booking to confirm."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmedDate":{"type":"string","format":"date-time","description":"Agreed date and time. Required by validation for all booking types; for a viewing it is the visit time, for a reservation or stay it is only recorded."},"visitDuration":{"type":"number","format":"float","minimum":0.5,"maximum":8,"description":"Viewings: visit length in hours (0.5 to 8). Replaces the value requested by the tenant."}},"required":["confirmedDate"],"additionalProperties":false},"examples":{"default":{"value":{"confirmedDate":"2026-12-04T10:00:00.000Z","visitDuration":1}}}}}},"responses":{"200":{"description":"Booking confirmed. `data` is the updated booking (ids not populated).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"tenantId":{"type":"string"},"landlordId":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"dates":{"type":"object","properties":{"requestedDate":{"type":"string","format":"date-time"},"confirmedDate":{"type":"string","format":"date-time"},"visitDuration":{"type":"integer"}},"required":["requestedDate","confirmedDate","visitDuration"]},"notes":{"type":"string"},"escrowId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","tenantId","landlordId","status","type","dates","notes","escrowId","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Booking confirmed successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":"664a0b7e3f2c1d0012ef5a01","tenantId":"663d9a1c5e4b2a0012cd7f10","landlordId":"6629e4f08a7b3c0012aa9e42","status":"confirmed","type":"viewing","dates":{"requestedDate":"2026-12-04T10:00:00.000Z","confirmedDate":"2026-12-04T10:00:00.000Z","visitDuration":1},"notes":"I would like to see the kitchen and the parking space.","escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-25T11:02:40.007Z","__v":0}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"confirmedDate\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not the booking's `landlordId`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to confirm this booking","data":null}}}}}},"404":{"description":"No booking with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Booking not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/booking/{id}/cancel":{"patch":{"tags":["booking"],"operationId":"booking_patch_id_cancel","summary":"Cancel or decline a booking","description":"**Access:** Bearer token required. **Also requires:** Caller must be the booking's tenant or its `landlordId`.\n\nSets `status` to `cancelled` and records `cancellationReason`, `cancellationBy` (the caller) and `cancellationDate`. Either the tenant (cancel) or the booking's `landlordId` (decline) may call it.\n\nSide effects: `booking:updated` is pushed over SSE and Socket.IO to both parties; for a `shortlet` booking the held nights are removed from the property's `shortLet.bookedRanges` so they can be booked again; and the other side receives a `booking_cancelled` notification. When the tenant cancels, the listing agent (or the landlord if there is none) is told the viewing / stay / payment request was *Cancelled*; when the landlord cancels, the tenant is told it was *Declined*. The reason is included in the notification body.\n\nThe current status is not checked: a `confirmed`, `completed` or already `cancelled` booking can be cancelled, and no refund or escrow action is triggered by this endpoint.","security":[{"bearerAuth":[]}],"x-doc-slug":"booking/patch-id-cancel","x-short":"Sets status to cancelled and records cancellationReason, cancellationBy (the caller) and cancellationDate.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the booking to cancel."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cancellationReason":{"type":"string","minLength":5,"maxLength":500,"description":"Why the booking is being cancelled or declined (5 to 500 characters). Shown to the other party."}},"required":["cancellationReason"],"additionalProperties":false},"examples":{"default":{"value":{"cancellationReason":"I have found another apartment closer to work."}}}}}},"responses":{"200":{"description":"Booking cancelled. `data` is the updated booking (ids not populated).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"tenantId":{"type":"string"},"landlordId":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"dates":{"type":"object","properties":{"requestedDate":{"type":"string","format":"date-time"},"visitDuration":{"type":"integer"}},"required":["requestedDate","visitDuration"]},"notes":{"type":"string"},"escrowId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"cancellationReason":{"type":"string"},"cancellationBy":{"type":"string"},"cancellationDate":{"type":"string","format":"date-time"}},"required":["_id","propertyId","tenantId","landlordId","status","type","dates","notes","escrowId","createdAt","updatedAt","__v","cancellationReason","cancellationBy","cancellationDate"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Booking cancelled successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":"664a0b7e3f2c1d0012ef5a01","tenantId":"663d9a1c5e4b2a0012cd7f10","landlordId":"6629e4f08a7b3c0012aa9e42","status":"cancelled","type":"viewing","dates":{"requestedDate":"2026-12-04T10:00:00.000Z","visitDuration":1},"notes":"I would like to see the kitchen and the parking space.","escrowId":null,"createdAt":"2026-11-25T09:14:22.318Z","updatedAt":"2026-11-26T08:45:10.551Z","__v":0,"cancellationReason":"I have found another apartment closer to work.","cancellationBy":"663d9a1c5e4b2a0012cd7f10","cancellationDate":"2026-11-26T08:45:10.551Z"}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"cancellationReason\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is neither the tenant nor the landlord of the booking.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to cancel this booking","data":null}}}}}},"404":{"description":"No booking with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Booking not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/inspection/availability/{propertyId}":{"get":{"tags":["inspection"],"operationId":"inspection_get_availability_property_id","summary":"Get inspection availability for a property","description":"**Access:** Public, no token needed.\n\nPublic endpoint used on the property detail page. Returns the working days, hours and slot length of the property's **landlord** (`property.landlordId`; the listing agent's own availability is not consulted). When that user has not configured `agentAvailability`, the defaults are Monday to Friday, `09:00` to `17:00`, 60-minute slots.\n\nPass `date` to also get concrete `slots` for that day: ISO 8601 UTC timestamps of each slot start. Slots are generated in the **server's local timezone**, and a slot is removed when an inspection for the same property with status `scheduled` or `pending_review` has exactly that `scheduledDate`. Inspections in `in_progress` (approved, awaiting payment) do not block a slot, and past slots are not filtered out. Without `date`, or when the day is not one of `availableDays`, `slots` is an empty array.","security":[],"x-doc-slug":"inspection/get-availability-property-id","x-short":"Public endpoint used on the property detail page.","parameters":[{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property."},{"name":"date","in":"query","required":false,"schema":{"type":"string"},"description":"Day to generate slots for, `YYYY-MM-DD` (any string `new Date()` can parse is accepted). Optional."}],"responses":{"200":{"description":"Availability for the property, with slots for the requested date.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"agentName":{"type":"string"},"availableDays":{"type":"array","items":{"type":"string"}},"dayStartTime":{"type":"string"},"dayEndTime":{"type":"string"},"slotDurationMinutes":{"type":"integer"},"slots":{"type":"array","items":{"type":"string","format":"date-time"}}},"required":["agentName","availableDays","dayStartTime","dayEndTime","slotDurationMinutes","slots"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Availability fetched successfully","data":{"agentName":"Folake Adeyemi","availableDays":["MON","TUE","WED","THU","FRI"],"dayStartTime":"09:00","dayEndTime":"17:00","slotDurationMinutes":60,"slots":["2026-12-04T08:00:00.000Z"]}}}}}}},"400":{"description":"- `propertyId` is not a valid ObjectId.\n- `date` cannot be parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`propertyId` is not a valid ObjectId.","value":{"status":400,"success":false,"message":"Invalid property ID","data":null}},"example2":{"summary":"`date` cannot be parsed.","value":{"status":400,"success":false,"message":"Invalid date format. Use YYYY-MM-DD.","data":null}}}}}},"404":{"description":"No property with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/inspection/request":{"post":{"tags":["inspection"],"operationId":"inspection_post_request","summary":"Request an inspection","description":"**Access:** Bearer token required.\n\nCreates an inspection (property tour) request for the authenticated user, who is stored as `inspectorId`. No booking is needed. The record starts with `status: \"pending_review\"`, `approval.status: \"pending\"` and `paymentStatus: \"unpaid\"`.\n\nThe listing agent (or the landlord when there is no `agentId`) receives an `inspection_request` notification with the *New Tour Request on HomeLink Hub* email, unless the requester is that same user.\n\nThings to know: the optional `notes` value is stored in the inspection's **`cancellationReason`** field (there is no dedicated notes field); the property's existence is not verified, so an unknown `propertyId` still returns 201 and simply notifies nobody; and the chosen time is not checked against the availability endpoint or existing inspections. The usual lifecycle is `pending_review` -> `in_progress` (approved via the review endpoint) -> `scheduled` (once the inspection fee is paid), or `cancelled` on rejection.","security":[{"bearerAuth":[]}],"x-doc-slug":"inspection/post-request","x-short":"Creates an inspection (property tour) request for the authenticated user, who is stored as inspectorId.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"propertyId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"ObjectId of the property to inspect."},"scheduledDate":{"type":"string","format":"date-time","description":"Requested date and time of the visit. Must be in the future."},"notes":{"type":"string","maxLength":500,"description":"Optional message for the agent (max 500 characters). Persisted as `cancellationReason` on the inspection."}},"required":["propertyId","scheduledDate"],"additionalProperties":false},"examples":{"default":{"value":{"propertyId":"664a0b7e3f2c1d0012ef5a01","scheduledDate":"2026-12-04T10:00:00.000Z","notes":"Please confirm the gate code before I arrive."}}}}}},"responses":{"201":{"description":"Inspection request created. `data` is the new inspection document.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"inspectorId":{"type":"string"},"scheduledDate":{"type":"string","format":"date-time"},"status":{"type":"string"},"findings":{"type":"object","properties":{"issues":{"type":"array","items":{}},"photos":{"type":"array","items":{}}},"required":["issues","photos"]},"approval":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]},"cancellationReason":{"type":"string"},"paymentStatus":{"type":"string"},"escrowId":{"nullable":true},"agentId":{"nullable":true},"agentFee":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","inspectorId","scheduledDate","status","findings","approval","cancellationReason","paymentStatus","escrowId","agentId","agentFee","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":201,"success":true,"message":"Inspection tour requested successfully","data":{"_id":"6660a2d47c3e5b0012de8f31","propertyId":"664a0b7e3f2c1d0012ef5a01","inspectorId":"663d9a1c5e4b2a0012cd7f10","scheduledDate":"2026-12-04T10:00:00.000Z","status":"pending_review","findings":{"issues":[],"photos":[]},"approval":{"status":"pending"},"cancellationReason":"Please confirm the gate code before I arrive.","paymentStatus":"unpaid","escrowId":null,"agentId":null,"agentFee":null,"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T09:20:05.112Z","__v":0}}}}}}},"400":{"description":"Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"\"propertyId\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/inspection/agent/requests":{"get":{"tags":["inspection"],"operationId":"inspection_get_agent_requests","summary":"List inspection requests for my properties","description":"**Access:** Bearer token required.\n\nReturns every inspection, in any status, for properties where the caller is the `agentId` or the `landlordId`, sorted by `scheduledDate` descending. `propertyId` is populated with `title`, `media`, `location` and `type`; `inspectorId` (the requester) with `firstName`, `lastName`, `email` and `avatar`. The result is a plain array: there is no pagination and no filtering. There is no role check; a user with no properties gets an empty array.","security":[{"bearerAuth":[]}],"x-doc-slug":"inspection/get-agent-requests","x-short":"Returns every inspection, in any status, for properties where the caller is the agentId or the landlordId, sorted by scheduledDate descending.","responses":{"200":{"description":"All inspection requests on the caller's properties.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","type","location","media"]},"inspectorId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"email":{"type":"string"}},"required":["_id","firstName","lastName","avatar","email"]},"scheduledDate":{"type":"string","format":"date-time"},"status":{"type":"string"},"findings":{"type":"object","properties":{"issues":{"type":"array","items":{}},"photos":{"type":"array","items":{}}},"required":["issues","photos"]},"approval":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]},"cancellationReason":{"type":"string"},"paymentStatus":{"type":"string"},"escrowId":{"nullable":true},"agentId":{"nullable":true},"agentFee":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","inspectorId","scheduledDate","status","findings","approval","cancellationReason","paymentStatus","escrowId","agentId","agentFee","createdAt","updatedAt","__v"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Agent inspection requests fetched successfully","data":[{"_id":"6660a2d47c3e5b0012de8f31","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","title":"3 Bedroom Apartment in Lekki Phase 1","type":"APARTMENT","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"inspectorId":{"_id":"663d9a1c5e4b2a0012cd7f10","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/chinedu.jpg","email":"chinedu.okafor@example.com"},"scheduledDate":"2026-12-04T10:00:00.000Z","status":"pending_review","findings":{"issues":[],"photos":[]},"approval":{"status":"pending"},"cancellationReason":"Please confirm the gate code before I arrive.","paymentStatus":"unpaid","escrowId":null,"agentId":null,"agentFee":null,"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T09:20:05.112Z","__v":0}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/inspection/my":{"get":{"tags":["inspection"],"operationId":"inspection_get_my","summary":"List my inspection requests","description":"**Access:** Bearer token required.\n\nReturns every inspection the caller requested (`inspectorId` is the caller), in any status, sorted by `scheduledDate` descending, as a plain array without pagination. `propertyId` is populated with `title`, `media` and `location`, and each item gets an extra `agentInspectionFee` (NGN) for display. Note that because the populated property does not include `agentId` or `landlordId`, the per-agent fee lookup in this handler never finds an agent, so `agentInspectionFee` is always the platform default (`Setting.defaultInspectionFee`, falling back to 5000). The amount actually charged is decided by `POST /transaction/inspection/initialize`, which may differ.","security":[{"bearerAuth":[]}],"x-doc-slug":"inspection/get-my","x-short":"Returns every inspection the caller requested (inspectorId is the caller), in any status, sorted by scheduledDate descending, as a plain array without pagination.","responses":{"200":{"description":"The caller's inspections.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","location","media"]},"inspectorId":{"type":"string"},"scheduledDate":{"type":"string","format":"date-time"},"status":{"type":"string"},"findings":{"type":"object","properties":{"issues":{"type":"array","items":{}},"photos":{"type":"array","items":{}}},"required":["issues","photos"]},"approval":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]},"cancellationReason":{"type":"string"},"paymentStatus":{"type":"string"},"escrowId":{"nullable":true},"agentId":{"nullable":true},"agentFee":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"agentInspectionFee":{"type":"integer"}},"required":["_id","propertyId","inspectorId","scheduledDate","status","findings","approval","cancellationReason","paymentStatus","escrowId","agentId","agentFee","createdAt","updatedAt","__v","agentInspectionFee"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Inspections fetched successfully","data":[{"_id":"6660a2d47c3e5b0012de8f31","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","title":"3 Bedroom Apartment in Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"inspectorId":"663d9a1c5e4b2a0012cd7f10","scheduledDate":"2026-12-04T10:00:00.000Z","status":"pending_review","findings":{"issues":[],"photos":[]},"approval":{"status":"pending"},"cancellationReason":"Please confirm the gate code before I arrive.","paymentStatus":"unpaid","escrowId":null,"agentId":null,"agentFee":null,"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T09:20:05.112Z","__v":0,"agentInspectionFee":5000}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/inspection/{id}":{"get":{"tags":["inspection"],"operationId":"inspection_get_id","summary":"Get an inspection by ID","description":"**Access:** Bearer token required. **Also requires:** Caller must be the property's `agentId` or `landlordId`.\n\nReturns one inspection with `propertyId` populated (`title`, `type`, `media`, `location`, `pricing`, `details`, `landlordId`, `agentId`) and `inspectorId` populated (`firstName`, `lastName`, `email`, `avatar`), plus `agentInspectionFee` in NGN. Access is limited to the property's `agentId` or `landlordId`: **the user who requested the inspection cannot fetch it here** and gets the 403 (requesters should use `GET /inspection/my`). `agentInspectionFee` is the `inspectionFee` of the property's landlord (falling back to its agent only when there is no landlord), then `Setting.defaultInspectionFee`, then 5000; the payment endpoint resolves the payee the other way round (agent first), so the two can disagree on agent-managed listings.","security":[{"bearerAuth":[]}],"x-doc-slug":"inspection/get-id","x-short":"Returns one inspection with propertyId populated (title, type, media, location, pricing, details, landlordId, agentId) and inspectorId populated (firstName, lastName, email, ava...","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the inspection."}],"responses":{"200":{"description":"Inspection found and the caller manages its property.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","landlordId","agentId","title","type","location","details","pricing","media"]},"inspectorId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"email":{"type":"string"}},"required":["_id","firstName","lastName","avatar","email"]},"scheduledDate":{"type":"string","format":"date-time"},"status":{"type":"string"},"findings":{"type":"object","properties":{"issues":{"type":"array","items":{}},"photos":{"type":"array","items":{}}},"required":["issues","photos"]},"approval":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]},"cancellationReason":{"type":"string"},"paymentStatus":{"type":"string"},"escrowId":{"nullable":true},"agentId":{"nullable":true},"agentFee":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"agentInspectionFee":{"type":"integer"}},"required":["_id","propertyId","inspectorId","scheduledDate","status","findings","approval","cancellationReason","paymentStatus","escrowId","agentId","agentFee","createdAt","updatedAt","__v","agentInspectionFee"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Inspection fetched successfully","data":{"_id":"6660a2d47c3e5b0012de8f31","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","landlordId":"6629e4f08a7b3c0012aa9e42","agentId":"662b7c3d1f0e9a0012bb4c55","title":"3 Bedroom Apartment in Lekki Phase 1","type":"APARTMENT","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":["Fitted kitchen"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"inspectorId":{"_id":"663d9a1c5e4b2a0012cd7f10","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/avatars/chinedu.jpg","email":"chinedu.okafor@example.com"},"scheduledDate":"2026-12-04T10:00:00.000Z","status":"pending_review","findings":{"issues":[],"photos":[]},"approval":{"status":"pending"},"cancellationReason":"Please confirm the gate code before I arrive.","paymentStatus":"unpaid","escrowId":null,"agentId":null,"agentFee":null,"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T09:20:05.112Z","__v":0,"agentInspectionFee":5000}}}}}}},"400":{"description":"`id` is not a valid ObjectId.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid inspection ID","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is neither the agent nor the landlord of the inspected property (this includes the requester).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied","data":null}}}}}},"404":{"description":"No inspection with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Inspection not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/inspection/{id}/review":{"patch":{"tags":["inspection"],"operationId":"inspection_patch_id_review","summary":"Approve or reject an inspection request","description":"**Access:** Bearer token required. **Also requires:** Caller must be the property's `agentId` or `landlordId`.\n\nLets the property's `agentId` or `landlordId` answer an inspection request.\n\n- `approve`: `approval.status` becomes `approved` (with `approvedBy`, `approvedAt` and optional `notes`) and the inspection `status` becomes `in_progress`. The requester is expected to pay the inspection fee next, which moves it to `scheduled`.\n- `reject`: `approval.status` becomes `rejected` with `rejectionReason`; `status` becomes `cancelled` and `cancellationReason` / `cancellationDate` are set. If the inspection had been synced to the requester's Google Calendar, that event is deleted in the background.\n\nEither way the requester receives an `inspection_reviewed` notification (*Inspection Request Approved* / *Inspection Request Rejected*, with the reason). The current status is not checked, so an inspection can be reviewed more than once, including after payment. In the response `propertyId` is populated with only `landlordId` and `agentId`.","security":[{"bearerAuth":[]}],"x-doc-slug":"inspection/patch-id-review","x-short":"Lets the property's agentId or landlordId answer an inspection request.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the inspection to review."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["approve","reject"],"description":"`approve` or `reject`."},"notes":{"type":"string","maxLength":1000,"description":"Optional note stored on `approval.notes` (max 1000 characters)."},"rejectionReason":{"oneOf":[{"type":"string","maxLength":1000,"x-required":true},{"type":"string","maxLength":1000}],"description":"Required when `action` is `reject` (max 1000 characters). Sent to the requester and copied to `cancellationReason`."}},"required":["action"],"additionalProperties":false},"examples":{"default":{"value":{"action":"approve","notes":"Friday 11am works. Ask for Tunde at the gate."}}}}}},"responses":{"200":{"description":"- Inspection approved.\n- Inspection rejected.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"string"},"agentId":{"type":"string"}},"required":["_id","landlordId","agentId"]},"inspectorId":{"type":"string"},"scheduledDate":{"type":"string","format":"date-time"},"status":{"type":"string"},"findings":{"type":"object","properties":{"issues":{"type":"array","items":{}},"photos":{"type":"array","items":{}}},"required":["issues","photos"]},"approval":{"type":"object","properties":{"status":{"type":"string"},"approvedBy":{"type":"string"},"approvedAt":{"type":"string","format":"date-time"},"notes":{"type":"string"}},"required":["status","approvedBy","approvedAt","notes"]},"cancellationReason":{"type":"string"},"paymentStatus":{"type":"string"},"escrowId":{"nullable":true},"agentId":{"nullable":true},"agentFee":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","inspectorId","scheduledDate","status","findings","approval","cancellationReason","paymentStatus","escrowId","agentId","agentFee","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Inspection approved.","value":{"status":200,"success":true,"message":"Inspection approved successfully","data":{"_id":"6660a2d47c3e5b0012de8f31","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","landlordId":"6629e4f08a7b3c0012aa9e42","agentId":"662b7c3d1f0e9a0012bb4c55"},"inspectorId":"663d9a1c5e4b2a0012cd7f10","scheduledDate":"2026-12-04T10:00:00.000Z","status":"in_progress","findings":{"issues":[],"photos":[]},"approval":{"status":"approved","approvedBy":"662b7c3d1f0e9a0012bb4c55","approvedAt":"2026-11-25T12:30:11.904Z","notes":"Friday 11am works. Ask for Tunde at the gate."},"cancellationReason":"Please confirm the gate code before I arrive.","paymentStatus":"unpaid","escrowId":null,"agentId":null,"agentFee":null,"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T12:30:11.904Z","__v":0}}},"example2":{"summary":"Inspection rejected.","value":{"status":200,"success":true,"message":"Inspection rejected successfully","data":{"_id":"6660a2d47c3e5b0012de8f31","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","landlordId":"6629e4f08a7b3c0012aa9e42","agentId":"662b7c3d1f0e9a0012bb4c55"},"inspectorId":"663d9a1c5e4b2a0012cd7f10","scheduledDate":"2026-12-04T10:00:00.000Z","status":"cancelled","findings":{"issues":[],"photos":[]},"approval":{"status":"rejected","approvedBy":"662b7c3d1f0e9a0012bb4c55","approvedAt":"2026-11-25T12:30:11.904Z","rejectionReason":"The apartment has just been let."},"cancellationReason":"The apartment has just been let.","paymentStatus":"unpaid","escrowId":null,"agentId":null,"agentFee":null,"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T12:30:11.904Z","__v":0,"cancellationDate":"2026-11-25T12:30:11.904Z"}}}}}}},"400":{"description":"- `id` is not a valid ObjectId.\n- `action` is `reject` without a reason. Normally caught earlier by request validation.\n- Request validation failed (body). The message joins every failed rule with \"; \".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`id` is not a valid ObjectId.","value":{"status":400,"success":false,"message":"Invalid inspection ID","data":null}},"example2":{"summary":"`action` is `reject` without a reason. Normally caught earlier by request validation.","value":{"status":400,"success":false,"message":"rejectionReason is required when rejecting an inspection","data":null}},"example3":{"summary":"Request validation failed (body). The message joins every failed rule with \"; \".","value":{"status":400,"success":false,"message":"\"action\" is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is neither the agent nor the landlord of the inspected property.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You are not authorised to review this inspection","data":null}}}}}},"404":{"description":"No inspection with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Inspection not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/transaction/inspection/initialize":{"post":{"tags":["transaction"],"operationId":"transaction_post_inspection_initialize","summary":"Initialize an inspection fee payment","description":"**Access:** Bearer token required.\n\nStarts a Paystack checkout for a property's inspection fee and returns the hosted payment URL. **The amount is decided by the server**, not the client: the `inspectionFee` of the property's listing agent (the landlord when there is no `agentId`), else `Setting.defaultInspectionFee`, else NGN 5,000. No platform percentage is added. The charge is created against the caller's account email with reference `INS-<timestamp>-<random>`.\n\nPass `inspectionId` to tie the payment to an inspection; it must be the caller's own inspection of that same property and not already paid. The server writes `userId`, `propertyId`, `inspectionId`, `type: \"inspection\"` and `quotedFee` into the Paystack metadata last, so client `metadata` cannot override them. Nothing is stored locally at this point. The inspection is only marked paid later, by `GET /transaction/inspection/verify/{reference}` or the Paystack webhook; a payment initialised **without** `inspectionId` therefore never updates any inspection.\n\nThere is no request validation schema: a malformed `propertyId` produces a 500 cast error rather than a 400.","security":[{"bearerAuth":[]}],"x-doc-slug":"transaction/post-inspection-initialize","x-short":"Starts a Paystack checkout for a property's inspection fee and returns the hosted payment URL.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"propertyId":{"type":"string","description":"ObjectId of the property being inspected. Determines the fee and who earns it."},"inspectionId":{"type":"string","description":"ObjectId of the caller's inspection request to settle. Without it the payment cannot be applied to an inspection."},"callbackUrl":{"type":"string","description":"URL Paystack redirects the payer to after checkout (passed through as `callback_url`)."},"metadata":{"type":"object","description":"Extra key/values merged into the Paystack metadata. `userId`, `propertyId`, `inspectionId`, `type` and `quotedFee` are always overwritten by the server."}},"required":["propertyId"]},"examples":{"default":{"value":{"propertyId":"664a0b7e3f2c1d0012ef5a01","inspectionId":"6660a2d47c3e5b0012de8f31","callbackUrl":"https://homelinkhub.com/app/inspections"}}}}}},"responses":{"200":{"description":"Paystack transaction created. Redirect the user to `authorization_url` (or use `access_code` with Paystack's inline SDK).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"reference":{"type":"string"},"authorization_url":{"type":"string"},"access_code":{"type":"string"}},"required":["reference","authorization_url","access_code"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Inspection payment initialized","data":{"reference":"INS-1764062400000-K3F9QZ","authorization_url":"https://checkout.paystack.com/0peioxfhpn","access_code":"0peioxfhpn"}}}}}}},"400":{"description":"- `propertyId` missing from the body.\n- The inspection belongs to another property than `propertyId`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`propertyId` missing from the body.","value":{"status":400,"success":false,"message":"propertyId is required","data":null}},"example2":{"summary":"The inspection belongs to another property than `propertyId`.","value":{"status":400,"success":false,"message":"Inspection is for a different property","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"- No property with that id.\n- `inspectionId` is malformed, does not exist, or was not requested by the caller.\n- The authenticated user's record no longer exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No property with that id.","value":{"status":404,"success":false,"message":"Property not found","data":null}},"example2":{"summary":"`inspectionId` is malformed, does not exist, or was not requested by the caller.","value":{"status":404,"success":false,"message":"Inspection not found","data":null}},"example3":{"summary":"The authenticated user's record no longer exists.","value":{"status":404,"success":false,"message":"User not found","data":null}}}}}},"409":{"description":"The inspection's `paymentStatus` is already `paid`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":409,"success":false,"message":"This inspection has already been paid for","data":null}}}}}},"500":{"description":"Paystack rejected the request or was unreachable. The message is Paystack's own error message when it sent one, otherwise this fallback.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to initialize payment","data":null}}}}}}}}},"/api/v1/transaction/inspection/verify/{reference}":{"get":{"tags":["transaction"],"operationId":"transaction_get_inspection_verify_reference","summary":"Verify an inspection payment","description":"**Access:** Bearer token required.\n\nAsks Paystack for the status of a transaction reference and returns Paystack's `data` object unchanged. **The envelope is always HTTP 200 / `Transaction verified` when Paystack answers, even for a failed or abandoned payment**, so clients must read `data.status` (`success`, `failed`, `abandoned`, ...).\n\nWhen `data.status` is `success` and the metadata says `type: \"inspection\"`, the payment is applied to the inspection named in the metadata (the same routine the Paystack webhook runs; whichever arrives first wins and the second is a no-op): `paymentStatus` -> `paid`, `paymentReference` is stored, `status` -> `scheduled`, and `agentId` / `agentFee` are set to the listing agent (or landlord) and the NGN amount actually collected. If the payer has connected Google Calendar, an event is then created on their primary calendar in the background. The payment is silently **not** applied (the response is still 200) when the inspection is missing or already paid, when the metadata's `propertyId` does not match the inspection, or when the amount collected is below the quoted fee.\n\nOnly the user who started the charge can verify it: the `userId` that payment initialisation writes into the Paystack metadata must equal the caller's id, otherwise the request is refused with a 403 and nothing is applied. A charge whose metadata has no `userId` is refused the same way. The inspection's current status is not checked either, so a `cancelled` inspection that is paid becomes `scheduled`.","security":[{"bearerAuth":[]}],"x-doc-slug":"transaction/get-inspection-verify-reference","x-short":"Asks Paystack for the status of a transaction reference and returns Paystack's data object unchanged.","parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string"},"description":"Paystack transaction reference returned by the initialize endpoint, e.g. `INS-1764062400000-K3F9QZ`."}],"responses":{"200":{"description":"Paystack answered. `data` is Paystack's verify-transaction payload passed through as-is; the example shows only a few of its fields (amounts are in kobo). Check `data.status`.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"integer"},"status":{"type":"string"},"reference":{"type":"string"},"amount":{"type":"integer"},"currency":{"type":"string"},"channel":{"type":"string"},"gateway_response":{"type":"string"},"paid_at":{"type":"string","format":"date-time"},"metadata":{"type":"object","properties":{"userId":{"type":"string"},"propertyId":{"type":"string"},"inspectionId":{"type":"string"},"type":{"type":"string"},"quotedFee":{"type":"integer"}},"required":["userId","propertyId","inspectionId","type","quotedFee"]},"customer":{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}},"required":["id","status","reference","amount","currency","channel","gateway_response","paid_at","metadata","customer"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Transaction verified","data":{"id":4099260516,"status":"success","reference":"INS-1764062400000-K3F9QZ","amount":500000,"currency":"NGN","channel":"card","gateway_response":"Successful","paid_at":"2026-11-25T09:22:41.000Z","metadata":{"userId":"663d9a1c5e4b2a0012cd7f10","propertyId":"664a0b7e3f2c1d0012ef5a01","inspectionId":"6660a2d47c3e5b0012de8f31","type":"inspection","quotedFee":5000},"customer":{"email":"chinedu.okafor@example.com"}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The reference was not started by the caller (its metadata `userId` is another user's or missing). Nothing is applied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"This payment does not belong to you","data":null}}}}}},"500":{"description":"Paystack returned an error (for example an unknown reference) or was unreachable. The message is Paystack's own error message when it sent one, otherwise this fallback.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to verify payment","data":null}}}}}}}}},"/api/v1/transaction/booking/initialize":{"post":{"tags":["transaction"],"operationId":"transaction_post_booking_initialize","summary":"Initialize a property booking payment","description":"**Access:** Bearer token required.\n\nStarts a Paystack checkout for a property payment and returns the hosted payment URL as `payment_url` (note: the inspection variant calls the same value `authorization_url`). **The base `amount` (NGN) is supplied by the client** and is not checked against the property's price; the server adds the platform fee (`Setting.platformPropertyFeePercent`, default 1%, rounded to the nearest naira) and charges the total. The reference has the form `BKG-<timestamp>-<random>`, and the metadata always carries `userId`, `propertyId` and `type: \"PROPERTY_BOOKING\"`.\n\nNothing is stored locally and the property is not looked up, so an unknown `propertyId` is accepted. There is no verify endpoint for booking payments; the only follow-up is the Paystack webhook's `charge.success` handling (see `POST /transaction/webhook/paystack`, including its caveats). `title` is accepted in the body but ignored.","security":[{"bearerAuth":[]}],"x-doc-slug":"transaction/post-booking-initialize","x-short":"Starts a Paystack checkout for a property payment and returns the hosted payment URL as paymenturl (note: the inspection variant calls the same value authorizationurl).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"number","description":"Base amount in NGN (whole naira, not kobo), before the platform fee. Must be truthy; `0` is rejected."},"propertyId":{"type":"string","description":"ObjectId of the property being paid for. Stored in the Paystack metadata; not validated."},"callbackUrl":{"type":"string","description":"URL Paystack redirects the payer to after checkout (passed through as `callback_url`)."},"metadata":{"type":"object","description":"Extra key/values merged into the Paystack metadata. `userId`, `propertyId` and `type` are always overwritten by the server."},"title":{"type":"string","description":"Read from the body but not used."}},"required":["amount","propertyId"]},"examples":{"default":{"value":{"amount":4500000,"propertyId":"664a0b7e3f2c1d0012ef5a01","callbackUrl":"https://homelinkhub.com/app/property/664a0b7e3f2c1d0012ef5a01"}}}}}},"responses":{"200":{"description":"Paystack transaction created. With the default 1% fee, an `amount` of 4,500,000 is charged as NGN 4,545,000.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"reference":{"type":"string"},"payment_url":{"type":"string"},"access_code":{"type":"string"}},"required":["reference","payment_url","access_code"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Booking payment initialized","data":{"reference":"BKG-1764062400000-P7XW2M","payment_url":"https://checkout.paystack.com/7k2mq1xw9d","access_code":"7k2mq1xw9d"}}}}}}},"400":{"description":"`amount` or `propertyId` missing (or `amount` is 0).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"amount and propertyId are required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The authenticated user's record no longer exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"User not found","data":null}}}}}},"500":{"description":"Paystack rejected the request or was unreachable. The message is Paystack's own error message when it sent one, otherwise this fallback.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to initialize payment","data":null}}}}}}}}},"/api/v1/transaction/history":{"get":{"tags":["transaction"],"operationId":"transaction_get_history","summary":"List my transaction history","description":"**Access:** Bearer token required.\n\nReturns a page of `Transaction` records where the caller is `parties.from` or `parties.to`, newest first, with `propertyId` populated (`title`, `location`, `media`, `pricing`). `type` is one of `rent_payment`, `sale_payment`, `deposit`, `refund`, `commission`; `status` one of `pending`, `completed`, `failed`, `disputed`. **Caveat:** nothing in the current service source creates `Transaction` documents (escrow payments are stored as `EscrowTransaction`, and Paystack inspection/booking payments are not persisted here), so unless records are written by another process this list is empty. For escrow activity use the escrow endpoints. The example values for `auditTrail[].action` and `paymentReference` are illustrative; the code does not define them.","security":[{"bearerAuth":[]}],"x-doc-slug":"transaction/get-history","x-short":"Returns a page of Transaction records where the caller is parties.from or parties.to, newest first, with propertyId populated (title, location, media, pricing).","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Transactions per page. Defaults to 20; no upper bound is enforced."}],"responses":{"200":{"description":"Page of transactions.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"escrowId":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","location","pricing","media"]},"type":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"currency":{"type":"string"},"parties":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"]},"paymentMethod":{"type":"string"},"paymentGateway":{"type":"string"},"paymentReference":{"type":"string"},"auditTrail":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"action":{"type":"string"},"actor":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}},"required":["_id","action","actor","timestamp"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","escrowId","propertyId","type","status","amount","currency","parties","paymentMethod","paymentGateway","paymentReference","auditTrail","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["transactions","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Transaction history fetched","data":{"transactions":[{"_id":"6661b3e58d4f6c0012ef9a42","escrowId":"6662c4f69e507d0012fa0b53","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","title":"3 Bedroom Apartment in Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"type":"rent_payment","status":"completed","amount":4500000,"currency":"NGN","parties":{"from":"663d9a1c5e4b2a0012cd7f10","to":"6629e4f08a7b3c0012aa9e42"},"paymentMethod":"bank_transfer","paymentGateway":"pandascrow","paymentReference":"HLH-ESC-20261125-0042","auditTrail":[{"_id":"6661b3e58d4f6c0012ef9a43","action":"payment_received","actor":"663d9a1c5e4b2a0012cd7f10","timestamp":"2026-11-25T09:22:41.000Z"}],"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T09:22:41.310Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/transaction/webhook/paystack":{"post":{"tags":["transaction"],"operationId":"transaction_post_webhook_paystack","summary":"Receive Paystack webhook events","description":"**Access:** No user token. The request is verified by its signature header.\n\nServer-to-server endpoint called by Paystack; not for client use. There is no bearer auth. The request is authenticated with the `x-paystack-signature` header: the handler computes an HMAC-SHA512 of the request body with the Paystack secret key and compares the hex digest to the header. Note that the digest is taken over `JSON.stringify(req.body)` (the parsed and re-serialised JSON, not the raw bytes) and compared with plain string equality. A missing or wrong signature gets HTTP 401 with the **plain-text** body `Invalid signature`.\n\nOnly `charge.success` does anything; every other event is acknowledged and ignored. The branch depends on `data.metadata.type`:\n\n- `inspection`: applies the payment to the inspection in `metadata.inspectionId`, exactly as `GET /transaction/inspection/verify/{reference}` does (`paymentStatus` -> `paid`, `status` -> `scheduled`, `paymentReference`, `agentId` and `agentFee` set, Google Calendar event created for the payer). Idempotent; skipped when the inspection is unknown, already paid, for a different property, or underpaid.\n- `PROPERTY_BOOKING` (with `metadata.propertyId`): runs `Booking.findOneAndUpdate({ propertyId, tenantId: metadata.userId }, { status: \"confirmed\", paymentStatus: \"paid\", paymentReference }, { upsert: true })`. Be aware of what that really does: it confirms whichever single booking of that tenant on that property MongoDB matches first, regardless of its type or current status; `paymentStatus` and `paymentReference` are not fields of the Booking schema, so they are not persisted; and if no booking matches, the upsert inserts a bare booking without `landlordId`, `type` or dates. No notification or `booking:updated` event is sent.\n\nSuccess is HTTP 200 with `{ \"received\": true }` (not the standard envelope).","security":[],"x-doc-slug":"transaction/post-webhook-paystack","x-short":"Server-to-server endpoint called by Paystack; not for client use.","parameters":[{"name":"x-paystack-signature","in":"header","required":true,"schema":{"type":"string"},"description":"Hex HMAC-SHA512 of the JSON body, keyed with the Paystack secret key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","description":"Paystack event name. Only `charge.success` is acted on."},"data":{"type":"object","description":"Paystack transaction object. The handler reads `reference`, `amount` (kobo) and `metadata` (`type`, `inspectionId`, `propertyId`, `userId`, `quotedFee`)."}},"required":["event","data"]},"examples":{"default":{"value":{"event":"charge.success","data":{"id":4099260516,"status":"success","reference":"INS-1764062400000-K3F9QZ","amount":500000,"currency":"NGN","channel":"card","gateway_response":"Successful","paid_at":"2026-11-25T09:22:41.000Z","metadata":{"userId":"663d9a1c5e4b2a0012cd7f10","propertyId":"664a0b7e3f2c1d0012ef5a01","inspectionId":"6660a2d47c3e5b0012de8f31","type":"inspection","quotedFee":5000},"customer":{"email":"chinedu.okafor@example.com"}}}}}}}},"responses":{"200":{"description":"Signature valid; event processed or ignored.","content":{"application/json":{"schema":{"type":"object","properties":{"received":{"type":"boolean"}},"required":["received"]},"examples":{"default":{"value":{"received":true}}}}}},"401":{"description":"Signature header missing or not matching. The body is plain text, not JSON.","content":{"text/plain":{"schema":{"type":"string"},"examples":{"default":{"value":"Invalid signature"}}}}}}}},"/api/v1/transaction/{id}":{"get":{"tags":["transaction"],"operationId":"transaction_get_id","summary":"Get a transaction by ID","description":"**Access:** Bearer token required.\n\nReturns one `Transaction` record with `propertyId` populated (`title`, `location`, `media`, `pricing`), but only when the caller is `parties.from` or `parties.to`; someone else's transaction is reported as not found rather than forbidden. The id is not validated, so a malformed id surfaces as a 500 with Mongoose's cast error message instead of a 400. See the caveat on `GET /transaction/history`: nothing in the current service source writes `Transaction` documents, so in practice this is likely to return 404.","security":[{"bearerAuth":[]}],"x-doc-slug":"transaction/get-id","x-short":"Returns one Transaction record with propertyId populated (title, location, media, pricing), but only when the caller is parties.from or parties.to; someone else's transaction is...","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the transaction."}],"responses":{"200":{"description":"Transaction found and the caller is one of its parties.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"escrowId":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","location","pricing","media"]},"type":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"currency":{"type":"string"},"parties":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"]},"paymentMethod":{"type":"string"},"paymentGateway":{"type":"string"},"paymentReference":{"type":"string"},"auditTrail":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"action":{"type":"string"},"actor":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}},"required":["_id","action","actor","timestamp"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","escrowId","propertyId","type","status","amount","currency","parties","paymentMethod","paymentGateway","paymentReference","auditTrail","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Transaction fetched","data":{"_id":"6661b3e58d4f6c0012ef9a42","escrowId":"6662c4f69e507d0012fa0b53","propertyId":{"_id":"664a0b7e3f2c1d0012ef5a01","title":"3 Bedroom Apartment in Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"664a0b7e3f2c1d0012ef5a02","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1716100000/properties/lekki-3bed-living.jpg","metadata":{"tag":"Living room"}}],"videos":[]}},"type":"rent_payment","status":"completed","amount":4500000,"currency":"NGN","parties":{"from":"663d9a1c5e4b2a0012cd7f10","to":"6629e4f08a7b3c0012aa9e42"},"paymentMethod":"bank_transfer","paymentGateway":"pandascrow","paymentReference":"HLH-ESC-20261125-0042","auditTrail":[{"_id":"6661b3e58d4f6c0012ef9a43","action":"payment_received","actor":"663d9a1c5e4b2a0012cd7f10","timestamp":"2026-11-25T09:22:41.000Z"}],"createdAt":"2026-11-25T09:20:05.112Z","updatedAt":"2026-11-25T09:22:41.310Z","__v":0}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No transaction with that id, or the caller is not a party to it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Transaction not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/review/create":{"post":{"tags":["review"],"operationId":"review_post_create","summary":"Create a review (not implemented)","description":"**Access:** Public, no token needed.\n\nPlaceholder route: it is mounted and reachable but not implemented. It ignores all input, requires no authentication, and always answers 200 with a bare `{ message }` object (not the standard `{status, success, message, data}` envelope). To create a review use `POST /api/v1/property/{id}/reviews`.","security":[],"x-doc-slug":"review/post-create","x-short":"Placeholder route: it is mounted and reachable but not implemented.","responses":{"200":{"description":"Always returned; nothing is created.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"examples":{"default":{"value":{"message":"Create review endpoint - coming soon"}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/review/property/{propertyId}":{"get":{"tags":["review"],"operationId":"review_get_property_property_id","summary":"List property reviews (not implemented)","description":"**Access:** Public, no token needed.\n\nPlaceholder route: it is mounted and reachable but not implemented. It ignores all input, requires no authentication, and always answers 200 with a bare `{ message }` object (not the standard `{status, success, message, data}` envelope). To list a property's reviews use `GET /api/v1/property/{id}/reviews`.","security":[],"x-doc-slug":"review/get-property-property-id","x-short":"Placeholder route: it is mounted and reachable but not implemented.","parameters":[{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"},"description":"Ignored by the placeholder handler."}],"responses":{"200":{"description":"Always returned; no reviews are included.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"examples":{"default":{"value":{"message":"Get property reviews endpoint - coming soon"}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/review/{id}":{"get":{"tags":["review"],"operationId":"review_get_id","summary":"Get a review (not implemented)","description":"**Access:** Public, no token needed.\n\nPlaceholder route: it is mounted and reachable but not implemented. It ignores all input, requires no authentication, and always answers 200 with a bare `{ message }` object (not the standard `{status, success, message, data}` envelope). To fetch a review use `GET /api/v1/property/review/{reviewId}`.","security":[],"x-doc-slug":"review/get-id","x-short":"Placeholder route: it is mounted and reachable but not implemented.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Ignored by the placeholder handler."}],"responses":{"200":{"description":"Always returned; no review is included.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"examples":{"default":{"value":{"message":"Get review endpoint - coming soon"}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/escrow/initialize":{"post":{"tags":["escrow"],"operationId":"escrow_post_initialize","summary":"Start an escrow payment","description":"**Access:** Bearer token required. **Also requires:** Property (when `propertyId` is sent) must have `legalStatus` = `legally_verified`.\n\nOpens a Pandascrow escrow for a property payment and returns the hosted payment link (`payment_url`) the buyer must open to fund it. The caller is always the buyer.\n\n**Fees.** The server replaces `escrowData.amount` with `amount + platformFee`, where `platformFee = round(amount x platformPropertyFeePercent / 100)` (admin setting, default 1%). When `transactionType` is exactly `purchase` and the property has an assigned agent, an agent commission of `round(amount x agentCommissionPercent / 100)` (default 5%) is snapshotted; it is taken out of the seller's proceeds, not added to what the buyer pays (`netAmount = amount - agentCommission`). The base `amount` comes from the request and is not compared with the listing price.\n\n**Server-controlled fields.** `uuid`, `initiator_id`, `partner_id`, `partner_escrow_fee`, `payout` and `callback_url` are set by the server after the caller's data, so values sent for them are ignored. The payout destination is the seller's (property `landlordId`) saved bank account when it has both an account number and a bank code; otherwise the release lands in the platform's Pandascrow wallet and the seller withdraws from their HomeLink Hub wallet. Every other key in `escrowData` is forwarded to Pandascrow unchanged.\n\n**Records created** (only when `propertyId` is given and Pandascrow accepts the request): an `EscrowTransaction` with status `pending`; for `inspection` payments the inspection's `escrowId` is set; for every other type a `Booking` (`type: reservation`, `status: requested`) is created and linked both ways. Without a `propertyId` nothing is stored locally and the Pandascrow response is returned as is.\n\n**Next state.** `pending` becomes `funded` when Pandascrow's `escrow.paid` webhook arrives, or when the buyer reports the payment through `PATCH /escrow/{id}/payment-made`. No email, socket event or notification is sent by this call.\n\nThe HTTP status is 200 whenever Pandascrow answers 2xx; `success` and `message` are Pandascrow's own `status` and `message`, so check `success` as well as the status code.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/post-initialize","x-short":"Opens a Pandascrow escrow for a property payment and returns the hosted payment link (paymenturl) the buyer must open to fund it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"escrowData":{"type":"object","properties":{"propertyId":{"type":"string","description":"Property ObjectId. Optional in code, but without it no local escrow record or booking is created and the legal-verification gate is skipped. First-party clients always send it."},"transactionType":{"type":"string","description":"`rent` | `purchase` | `inspection`. Stored as `purchase` when omitted, but the agent commission is only snapshotted when the value is sent explicitly as `purchase`. Any other value fails the local save with a 400 after the Pandascrow escrow already exists."},"amount":{"type":"number","description":"Base amount before the platform fee, in the currency's main unit (e.g. naira). The server adds the platform fee and sends the total to Pandascrow. A missing or non-numeric value is treated as 0."},"currency":{"type":"string","description":"`NGN` | `USD` | `GHS` | `KES` | `ZAR`. Stored as `NGN` when omitted."},"description":{"type":"string","description":"Sent to Pandascrow and copied into the booking's `notes`."},"inspectionId":{"type":"string","description":"Inspection ObjectId. Only used when `transactionType` is `inspection`: stored on the escrow record, and that inspection's `escrowId` is set."},"escrow_type":{"type":"string","description":"Pandascrow escrow type. First-party clients send `onetime`."},"initiator_role":{"type":"string","description":"Pandascrow role of the initiator. First-party clients send `seller` (the platform account is the initiator)."},"title":{"type":"string","description":"Escrow title shown by Pandascrow."},"inspection_period":{"type":"integer","description":"Buyer inspection period in days."},"delivery_date":{"type":"string","description":"Expected delivery date, YYYY-MM-DD."},"who_pay_fees":{"type":"string","description":"Who pays Pandascrow's fees: `buyer` | `seller` | `both`."},"buyer_details":{"type":"object","description":"{ name, email, phone? } of the buyer, as supplied by the client."},"seller_details":{"type":"object","description":"{ name, email, phone? } of the seller, as supplied by the client. Does not decide where the money is paid; the server sets `payout`."}},"required":["amount"],"description":"Escrow definition. Read by the server: `propertyId`, `transactionType`, `amount`, `currency`, `description`, `inspectionId`. Forwarded to Pandascrow untouched: `escrow_type` (`onetime` | `milestone` | `recurring`), `initiator_role` (`buyer` | `seller` | `broker`), `title`, `inspection_period` (days), `delivery_date` (YYYY-MM-DD), `who_pay_fees` (`buyer` | `seller` | `both`), `buyer_details` ({ name, email, phone? }), `seller_details` ({ name, email, phone? }) and optional `acceptance_criteria`, `how_dispute_is_handled` (`platform` | `arbitration`), `dispute_window`, `prd_url`. Overwritten by the server: `uuid`, `initiator_id`, `partner_id`, `partner_escrow_fee`, `payout`, `callback_url`. None of these are validated by this API; Pandascrow decides which are mandatory."}},"required":["escrowData"]},"examples":{"default":{"value":{"escrowData":{"propertyId":"665e0a7b9b1d4a0012ab1f02","transactionType":"purchase","escrow_type":"onetime","initiator_role":"seller","title":"Purchase – 4 Bedroom Duplex, Lekki Phase 1","currency":"NGN","description":"Purchase payment for 4 Bedroom Duplex, Lekki Phase 1","inspection_period":7,"delivery_date":"2026-12-25","who_pay_fees":"buyer","amount":45000000,"buyer_details":{"name":"Chinedu Okafor","email":"chinedu.okafor@example.com","phone":"+2348031234567"},"seller_details":{"name":"Folake Adeyemi","email":"folake.adeyemi@example.com","phone":"+2348059876543"},"payout":{"payout_type":"bank"}}}}}}}},"responses":{"200":{"description":"- Pandascrow accepted the escrow and a local record was created (`propertyId` was sent). `success` and `message` are passed through from Pandascrow (message text here is the one quoted in service/docs/ESCROW.md); `data` is Pandascrow's `data` object plus `escrowTransactionId` and, for non-inspection payments, `bookingId`. The code reads `escrow_id`, `payment_url`, `transaction_ref` and `provider` from Pandascrow's data; any other keys Pandascrow returns are passed through too.\n- No `propertyId` was sent, or Pandascrow answered 2xx with `status: false` / no data. Nothing is stored locally; Pandascrow's `status`, `message` and `data` are returned unchanged (`success` may be `false` with HTTP 200).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"escrow_id":{"type":"integer"},"status":{"type":"string"},"payment_url":{"type":"string"},"transaction_ref":{"type":"string"},"provider":{"type":"string"},"escrowTransactionId":{"type":"string"},"bookingId":{"type":"string"}},"required":["escrow_id","status","payment_url","transaction_ref","provider","escrowTransactionId","bookingId"]}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Pandascrow accepted the escrow and a local record was created (`propertyId` was sent). `success` and `message` are passed through from Pandascrow (message text here is the one quoted in service/docs/ESCROW.md); `data` is Pandascrow's `data` object plus `escrowTransactionId` and, for non-inspection payments, `bookingId`. The code reads `escrow_id`, `payment_url`, `transaction_ref` and `provider` from Pandascrow's data; any other keys Pandascrow returns are passed through too.","value":{"status":200,"success":true,"message":"Escrow initialized successfully","data":{"escrow_id":48213,"status":"pending","payment_url":"https://checkout.paystack.com/7k2m9x4q1z","transaction_ref":"PNDS-TRX-8F3A21C9D0","provider":"paystack","escrowTransactionId":"665f1c2e9b1d4a0012ab34cd","bookingId":"665f1c2f9b1d4a0012ab34d1"}}},"example2":{"summary":"No `propertyId` was sent, or Pandascrow answered 2xx with `status: false` / no data. Nothing is stored locally; Pandascrow's `status`, `message` and `data` are returned unchanged (`success` may be `false` with HTTP 200).","value":{"status":200,"success":true,"message":"Escrow initialized successfully","data":{"escrow_id":48213,"status":"pending","payment_url":"https://checkout.paystack.com/7k2m9x4q1z"}}}}}}},"400":{"description":"- `escrowData` is missing from the body.\n- The local escrow record failed Mongoose validation after Pandascrow had already created the escrow (for example an unsupported `transactionType` or `currency`, or Pandascrow returned no `transaction_ref`). The message is Mongoose's, prefixed with `Validation Error: `.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`escrowData` is missing from the body.","value":{"status":400,"success":false,"message":"Missing required fields: escrowData","data":null}},"example2":{"summary":"The local escrow record failed Mongoose validation after Pandascrow had already created the escrow (for example an unsupported `transactionType` or `currency`, or Pandascrow returned no `transaction_ref`). The message is Mongoose's, prefixed with `Validation Error: `.","value":{"status":400,"success":false,"message":"Validation Error: EscrowTransaction validation failed: transactionType: `lease` is not a valid enum value for path `transactionType`.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The property has not passed legal review.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Property is not legally verified. Payment is unavailable until legal review is completed.","data":null}}}}}},"404":{"description":"- `propertyId` does not match any property.\n- The authenticated user record no longer exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`propertyId` does not match any property.","value":{"status":404,"success":false,"message":"Property not found","data":null}},"example2":{"summary":"The authenticated user record no longer exists.","value":{"status":404,"success":false,"message":"Buyer not found","data":null}}}}}},"500":{"description":"- Pandascrow rejected the request or could not be reached. The message is `Failed to initialize escrow: ` followed by Pandascrow's own message, or `Pandascrow API request failed` when it sent none.\n- `propertyId` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"Pandascrow rejected the request or could not be reached. The message is `Failed to initialize escrow: ` followed by Pandascrow's own message, or `Pandascrow API request failed` when it sent none.","value":{"status":500,"success":false,"message":"Failed to initialize escrow: Pandascrow API request failed","data":null}},"example2":{"summary":"`propertyId` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"abc\" (type string) at path \"_id\" for model \"Property\"","data":null}}}}}}}}},"/api/v1/escrow/my":{"get":{"tags":["escrow"],"operationId":"escrow_get_my","summary":"List my escrow payments (buyer)","description":"**Access:** Bearer token required.\n\nReturns the escrow transactions stored in HomeLink Hub where the authenticated user is the **buyer**, newest first, with the property and seller populated. Sellers and agents do not see their deals here; use `GET /escrow/property/{propertyId}` or `GET /earnings`.\n\n`status` is one of `pending`, `funded`, `completed`, `disputed`, `cancelled`. `amount` is what the buyer pays (base price plus `platformFee`); `netAmount` is the seller's share after any `agentCommission`. `sellerPayoutAccount` exposes the seller's bank name, bank code and account name but never the account number. A non-null `paymentProof` means `funded` was reported by the buyer rather than confirmed by Pandascrow. `limit` has no upper bound.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/get-my","x-short":"Returns the escrow transactions stored in HomeLink Hub where the authenticated user is the buyer, newest first, with the property and seller populated.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Non-numeric or 0 falls back to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size. Non-numeric or 0 falls back to 20; no maximum is enforced."}],"responses":{"200":{"description":"Page of the caller's escrow transactions (empty `transactions` array when there are none).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"nullable":true},"salePrice":{"type":"integer"},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","status","location","details","pricing","media"]},"buyerId":{"type":"string"},"sellerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"pandascrowEscrowId":{"type":"integer"},"transactionType":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"platformFee":{"type":"integer"},"netAmount":{"type":"integer"},"sellerPayoutAccount":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"partnerEscrowFeePercent":{"type":"string"},"currency":{"type":"string"},"paymentUrl":{"type":"string"},"transactionRef":{"type":"string"},"provider":{"type":"string"},"bookingId":{"type":"string"},"inspectionId":{"nullable":true},"paymentNotifiedAt":{"type":"string","format":"date-time"},"paymentProof":{"nullable":true},"releaseOtpResentAt":{"nullable":true},"completedAt":{"nullable":true},"agentId":{"type":"string"},"agentCommission":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","buyerId","sellerId","pandascrowEscrowId","transactionType","status","amount","platformFee","netAmount","sellerPayoutAccount","partnerEscrowFeePercent","currency","paymentUrl","transactionRef","provider","bookingId","inspectionId","paymentNotifiedAt","paymentProof","releaseOtpResentAt","completedAt","agentId","agentCommission","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["transactions","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Escrow transactions fetched successfully","data":{"transactions":[{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"665e0a7b9b1d4a0012ab1f02","title":"4 Bedroom Duplex, Lekki Phase 1","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":4,"bathrooms":5,"squareFeet":3200,"features":["Swimming pool","BQ"]},"pricing":{"rentPrice":null,"salePrice":45000000,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"665e0a7b9b1d4a0012ab1f05","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1717400000/properties/duplex-front.jpg","metadata":{"tag":"Exterior"}}],"videos":[]}},"buyerId":"665d9f3a9b1d4a0012ab0e11","sellerId":{"_id":"665d8c219b1d4a0012ab0d47","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1717300000/avatars/folake.jpg"},"pandascrowEscrowId":48213,"transactionType":"purchase","status":"funded","amount":45450000,"platformFee":450000,"netAmount":42750000,"sellerPayoutAccount":{"accountName":"Folake Adeyemi","bankCode":"058","bankName":"Guaranty Trust Bank"},"partnerEscrowFeePercent":"5.940594","currency":"NGN","paymentUrl":"https://checkout.paystack.com/7k2m9x4q1z","transactionRef":"PNDS-TRX-8F3A21C9D0","provider":"paystack","bookingId":"665f1c2f9b1d4a0012ab34d1","inspectionId":null,"paymentNotifiedAt":"2026-11-20T10:42:17.000Z","paymentProof":null,"releaseOtpResentAt":null,"completedAt":null,"agentId":"665d8e5f9b1d4a0012ab0d9a","agentCommission":2250000,"createdAt":"2026-11-20T10:31:05.412Z","updatedAt":"2026-11-20T10:42:17.120Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/escrow/my/{id}":{"get":{"tags":["escrow"],"operationId":"escrow_get_my_id","summary":"Get one of my escrow payments","description":"**Access:** Bearer token required.\n\nReturns a single local escrow transaction, but only when the authenticated user is its **buyer**; anyone else (including the seller) gets a 404. Same document shape as the items of `GET /escrow/my`, with the property's `verification` block added to the populated `propertyId`. Status values: `pending`, `funded`, `completed`, `disputed`, `cancelled`.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/get-my-id","x-short":"Returns a single local escrow transaction, but only when the authenticated user is its buyer; anyone else (including the seller) gets a 404.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Local escrow transaction ObjectId (`escrowTransactionId` returned by `POST /escrow/initialize`), not the Pandascrow escrow id."}],"responses":{"200":{"description":"The escrow transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"nullable":true},"salePrice":{"type":"integer"},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]}},"required":["_id","title","status","location","details","pricing","media","verification"]},"buyerId":{"type":"string"},"sellerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"pandascrowEscrowId":{"type":"integer"},"transactionType":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"platformFee":{"type":"integer"},"netAmount":{"type":"integer"},"sellerPayoutAccount":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"partnerEscrowFeePercent":{"type":"string"},"currency":{"type":"string"},"paymentUrl":{"type":"string"},"transactionRef":{"type":"string"},"provider":{"type":"string"},"bookingId":{"type":"string"},"inspectionId":{"nullable":true},"paymentNotifiedAt":{"nullable":true},"paymentProof":{"nullable":true},"releaseOtpResentAt":{"nullable":true},"completedAt":{"nullable":true},"agentId":{"type":"string"},"agentCommission":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","buyerId","sellerId","pandascrowEscrowId","transactionType","status","amount","platformFee","netAmount","sellerPayoutAccount","partnerEscrowFeePercent","currency","paymentUrl","transactionRef","provider","bookingId","inspectionId","paymentNotifiedAt","paymentProof","releaseOtpResentAt","completedAt","agentId","agentCommission","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Escrow transaction fetched successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"665e0a7b9b1d4a0012ab1f02","title":"4 Bedroom Duplex, Lekki Phase 1","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":4,"bathrooms":5,"squareFeet":3200,"features":["Swimming pool","BQ"]},"pricing":{"rentPrice":null,"salePrice":45000000,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"665e0a7b9b1d4a0012ab1f05","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1717400000/properties/duplex-front.jpg","metadata":{"tag":"Exterior"}}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-10-02T09:15:00.000Z","verifiedBy":"665d7a109b1d4a0012ab0c02"}},"buyerId":"665d9f3a9b1d4a0012ab0e11","sellerId":{"_id":"665d8c219b1d4a0012ab0d47","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1717300000/avatars/folake.jpg"},"pandascrowEscrowId":48213,"transactionType":"purchase","status":"pending","amount":45450000,"platformFee":450000,"netAmount":42750000,"sellerPayoutAccount":{"accountName":"Folake Adeyemi","bankCode":"058","bankName":"Guaranty Trust Bank"},"partnerEscrowFeePercent":"5.940594","currency":"NGN","paymentUrl":"https://checkout.paystack.com/7k2m9x4q1z","transactionRef":"PNDS-TRX-8F3A21C9D0","provider":"paystack","bookingId":"665f1c2f9b1d4a0012ab34d1","inspectionId":null,"paymentNotifiedAt":null,"paymentProof":null,"releaseOtpResentAt":null,"completedAt":null,"agentId":"665d8e5f9b1d4a0012ab0d9a","agentCommission":2250000,"createdAt":"2026-11-20T10:31:05.412Z","updatedAt":"2026-11-20T10:31:05.980Z","__v":0}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No escrow transaction with this id where the caller is the buyer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Escrow transaction not found","data":null}}}}}},"500":{"description":"`id` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"abc\" (type string) at path \"_id\" for model \"EscrowTransaction\"","data":null}}}}}}}}},"/api/v1/escrow":{"get":{"tags":["escrow"],"operationId":"escrow_get","summary":"List escrows from Pandascrow (raw passthrough)","description":"**Access:** Bearer token required.\n\nProxies Pandascrow's `GET /escrow`, passing the caller's HomeLink Hub user id as Pandascrow's `uuid`, and returns Pandascrow's `status`, `message` and `data` untouched. Nothing is read from the local database.\n\nEscrows created through `POST /escrow/initialize` are opened under the platform's own Pandascrow account, not under the caller's HomeLink Hub id, so this lookup is not a reliable way to list a user's payments. Use `GET /escrow/my` for that; the first-party apps do. The response shape below follows the service's TypeScript interface for a Pandascrow escrow (`IEscrowData`), not a payload verified against the live provider.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/get","x-short":"Proxies Pandascrow's GET /escrow, passing the caller's HomeLink Hub user id as Pandascrow's uuid, and returns Pandascrow's status, message and data untouched.","responses":{"200":{"description":"Pandascrow answered 2xx. `success`, `message` and `data` are Pandascrow's own values; `data` is typed as an array of Pandascrow escrow objects.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"integer"},"escrow_type":{"type":"string"},"escrow_data":{"type":"object","properties":{"_id":{"type":"integer"},"escrow_type":{"type":"string"},"initiator_role":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string"},"amount_pay":{"type":"string"},"amount_receive":{"type":"string"},"inspection_period":{"type":"integer"},"delivery_date":{"type":"string"},"how_dispute_is_handled":{"type":"string"},"who_pay_fees":{"type":"string"},"dispute_window":{"type":"integer"},"initiator_id":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","escrow_type","initiator_role","title","description","currency","amount","amount_pay","amount_receive","inspection_period","delivery_date","how_dispute_is_handled","who_pay_fees","dispute_window","initiator_id","status","created_at","updated_at"]},"timestamp":{"type":"integer"}},"required":["_id","escrow_type","escrow_data","timestamp"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"(message returned by Pandascrow)","data":[{"_id":48213,"escrow_type":"onetime","escrow_data":{"_id":48213,"escrow_type":"onetime","initiator_role":"seller","title":"Purchase – 4 Bedroom Duplex, Lekki Phase 1","description":"Purchase payment for 4 Bedroom Duplex, Lekki Phase 1","currency":"NGN","amount":"45450000","amount_pay":"45450000","amount_receive":"42750000","inspection_period":7,"delivery_date":"2026-12-25","how_dispute_is_handled":"platform","who_pay_fees":"buyer","dispute_window":30,"initiator_id":"8d2f6c1e-4b7a-4e0c-9a35-1f6b2c7d9e10","status":"funded","created_at":"2026-11-20 10:31:05","updated_at":"2026-11-20 10:42:17"},"timestamp":1795170665}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Pandascrow rejected the request (for example an unknown `uuid`) or could not be reached. The text after the colon is Pandascrow's message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch escrows: Pandascrow API request failed","data":null}}}}}}}}},"/api/v1/escrow/{escrowId}":{"get":{"tags":["escrow"],"operationId":"escrow_get_escrow_id","summary":"Get an escrow from Pandascrow (raw passthrough)","description":"**Access:** Bearer token required.\n\nProxies Pandascrow's `GET /escrow/{id}`. `escrowId` is parsed with `parseInt` and sent as the Pandascrow escrow id, with the caller's HomeLink Hub user id as `uuid`; Pandascrow's `status`, `message` and `data` are returned untouched. Nothing is read from the local database and no local ownership check is made, so access control is whatever Pandascrow applies to that `uuid`.\n\nThis is not the endpoint for the local escrow record: pass a Mongo ObjectId here and it is truncated to its leading digits (or becomes `NaN`). Use `GET /escrow/my/{id}` instead. The shape of `data` is not defined in this codebase.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/get-escrow-id","x-short":"Proxies Pandascrow's GET /escrow/{id}.","parameters":[{"name":"escrowId","in":"path","required":true,"schema":{"type":"string"},"description":"Numeric Pandascrow escrow id (`pandascrowEscrowId` / `escrow_id`), not the local escrow transaction ObjectId."}],"responses":{"200":{"description":"Pandascrow answered 2xx. `success`, `message` and `data` are passed through.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"nullable":true}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"(message returned by Pandascrow)","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Pandascrow rejected the request (unknown id, non-numeric id, `uuid` not a party) or could not be reached. The text after the colon is Pandascrow's message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch escrow: Pandascrow API request failed","data":null}}}}}}}}},"/api/v1/escrow/{id}/payment-made":{"patch":{"tags":["escrow"],"operationId":"escrow_patch_id_payment_made","summary":"Report an escrow payment as made","description":"**Access:** Bearer token required.\n\nFallback for when Pandascrow's payment webhook never arrives: the **buyer** reports that they have paid and may attach proof of payment. Only an escrow in `pending` is accepted, and it moves straight to `funded` with `paymentNotifiedAt` set; the transition is made on the buyer's word alone, so a non-null `paymentProof` on the record means `funded` is a claim that Pandascrow has not confirmed.\n\nSend `multipart/form-data` with an optional single file in the `proof` field (jpg, jpeg, png or pdf, up to 5 MB). The file is uploaded to Cloudinary only after the escrow checks pass and is stored as `paymentProof` (`url`, `publicId`, `fileName`, `mimeType`, `uploadedAt`). A request with no body is also accepted.\n\nSide effects: the buyer, the seller and any commission-earning agent each get an `escrow_funded` notification (stored in-app and pushed over the `notifications:new` socket event, plus push and email according to their preferences), and the seller's socket room receives `escrow:status_updated` with `{ escrowTxId, status: \"funded\" }`.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/patch-id-payment-made","x-short":"Fallback for when Pandascrow's payment webhook never arrives: the buyer reports that they have paid and may attach proof of payment.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Local escrow transaction ObjectId. The caller must be its buyer."}],"requestBody":{"required":false,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"proof":{"contentMediaType":"application/octet-stream","description":"Proof of payment: one jpg, jpeg, png or pdf file, 5 MB maximum. Optional at the API (older app builds send none); current clients always attach one."}}}}}},"responses":{"200":{"description":"The escrow is now `funded`. `data` is the updated escrow transaction with `propertyId` (title, location, media, pricing, details, status, verification) and `sellerId` (firstName, lastName, avatar) populated.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"nullable":true},"salePrice":{"type":"integer"},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]}},"required":["_id","title","status","location","details","pricing","media","verification"]},"buyerId":{"type":"string"},"sellerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"pandascrowEscrowId":{"type":"integer"},"transactionType":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"platformFee":{"type":"integer"},"netAmount":{"type":"integer"},"sellerPayoutAccount":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"partnerEscrowFeePercent":{"type":"string"},"currency":{"type":"string"},"paymentUrl":{"type":"string"},"transactionRef":{"type":"string"},"provider":{"type":"string"},"bookingId":{"type":"string"},"inspectionId":{"nullable":true},"paymentNotifiedAt":{"type":"string","format":"date-time"},"paymentProof":{"type":"object","properties":{"url":{"type":"string"},"publicId":{"type":"string"},"fileName":{"type":"string"},"mimeType":{"type":"string"},"uploadedAt":{"type":"string","format":"date-time"}},"required":["url","publicId","fileName","mimeType","uploadedAt"]},"releaseOtpResentAt":{"nullable":true},"completedAt":{"nullable":true},"agentId":{"type":"string"},"agentCommission":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","buyerId","sellerId","pandascrowEscrowId","transactionType","status","amount","platformFee","netAmount","sellerPayoutAccount","partnerEscrowFeePercent","currency","paymentUrl","transactionRef","provider","bookingId","inspectionId","paymentNotifiedAt","paymentProof","releaseOtpResentAt","completedAt","agentId","agentCommission","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Payment notification recorded successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"665e0a7b9b1d4a0012ab1f02","title":"4 Bedroom Duplex, Lekki Phase 1","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":4,"bathrooms":5,"squareFeet":3200,"features":["Swimming pool","BQ"]},"pricing":{"rentPrice":null,"salePrice":45000000,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"665e0a7b9b1d4a0012ab1f05","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1717400000/properties/duplex-front.jpg","metadata":{"tag":"Exterior"}}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-10-02T09:15:00.000Z","verifiedBy":"665d7a109b1d4a0012ab0c02"}},"buyerId":"665d9f3a9b1d4a0012ab0e11","sellerId":{"_id":"665d8c219b1d4a0012ab0d47","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1717300000/avatars/folake.jpg"},"pandascrowEscrowId":48213,"transactionType":"purchase","status":"funded","amount":45450000,"platformFee":450000,"netAmount":42750000,"sellerPayoutAccount":{"accountName":"Folake Adeyemi","bankCode":"058","bankName":"Guaranty Trust Bank"},"partnerEscrowFeePercent":"5.940594","currency":"NGN","paymentUrl":"https://checkout.paystack.com/7k2m9x4q1z","transactionRef":"PNDS-TRX-8F3A21C9D0","provider":"paystack","bookingId":"665f1c2f9b1d4a0012ab34d1","inspectionId":null,"paymentNotifiedAt":"2026-11-20T11:05:44.031Z","paymentProof":{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1795172744/homelinkhub/payment-proofs/665f1c2e9b1d4a0012ab34cd-1795172744031.jpg","publicId":"homelinkhub/payment-proofs/665f1c2e9b1d4a0012ab34cd-1795172744031","fileName":"gtbank-transfer-receipt.jpg","mimeType":"image/jpeg","uploadedAt":"2026-11-20T11:05:44.031Z"},"releaseOtpResentAt":null,"completedAt":null,"agentId":"665d8e5f9b1d4a0012ab0d9a","agentCommission":2250000,"createdAt":"2026-11-20T10:31:05.412Z","updatedAt":"2026-11-20T11:05:44.040Z","__v":0}}}}}}},"400":{"description":"- The attached file is larger than 5 MB.\n- The attached file's extension is not jpg, jpeg, png or pdf. Other multipart problems (a file under a field name other than `proof`, more than one file) also return 400, with multer's own message such as `Unexpected field`.\n- The escrow is already `funded` (by the webhook, an earlier report, or a webhook that landed while the file was uploading).\n- The escrow is `completed`, `disputed` or `cancelled`; the status is interpolated into the message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The attached file is larger than 5 MB.","value":{"status":400,"success":false,"message":"Proof of payment must be 5MB or smaller","data":null}},"example2":{"summary":"The attached file's extension is not jpg, jpeg, png or pdf. Other multipart problems (a file under a field name other than `proof`, more than one file) also return 400, with multer's own message such as `Unexpected field`.","value":{"status":400,"success":false,"message":"Proof of payment must be one of: jpg, jpeg, png, pdf","data":null}},"example3":{"summary":"The escrow is already `funded` (by the webhook, an earlier report, or a webhook that landed while the file was uploading).","value":{"status":400,"success":false,"message":"Payment has already been confirmed for this escrow","data":null}},"example4":{"summary":"The escrow is `completed`, `disputed` or `cancelled`; the status is interpolated into the message.","value":{"status":400,"success":false,"message":"A completed escrow cannot be marked as paid","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No escrow transaction with this id where the caller is the buyer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Escrow transaction not found or unauthorized","data":null}}}}}},"500":{"description":"`id` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"abc\" (type string) at path \"_id\" for model \"EscrowTransaction\"","data":null}}}}}},"502":{"description":"The proof file could not be stored (Cloudinary upload failed). The escrow stays `pending`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":502,"success":false,"message":"Could not upload the proof of payment. Please try again.","data":null}}}}}}}}},"/api/v1/escrow/{id}/resend-otp":{"post":{"tags":["escrow"],"operationId":"escrow_post_id_resend_otp","summary":"Resend the escrow release OTP","description":"**Access:** Bearer token required.\n\nAsks Pandascrow to send a fresh OTP for releasing a funded escrow, for a **buyer** whose first code never arrived or has expired. The escrow must be in `funded`. Requests are limited to one per 60 seconds per escrow; a request inside the cooldown returns 429 with the seconds left in both the message and `errorData.retryAfter`.\n\nThe call goes to Pandascrow's `POST /escrow/resend-otp` under the platform's Pandascrow account, and on success `releaseOtpResentAt` is stamped on the escrow record. Pandascrow delivers the code itself; this codebase does not choose the channel or recipient. No request body is read. The OTP is then submitted to `PATCH /escrow/{id}/request-completion`.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/post-id-resend-otp","x-short":"Asks Pandascrow to send a fresh OTP for releasing a funded escrow, for a buyer whose first code never arrived or has expired.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Local escrow transaction ObjectId. The caller must be its buyer."}],"responses":{"200":{"description":"Pandascrow accepted the resend. `retryAfter` is the cooldown in seconds before the next resend is allowed (always 60).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"retryAfter":{"type":"integer"}},"required":["retryAfter"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"A new OTP has been sent","data":{"retryAfter":60}}}}}}},"400":{"description":"The escrow is not in `funded` (still `pending`, or already `completed`, `disputed` or `cancelled`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"An OTP can only be sent for a funded escrow","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No escrow transaction with this id where the caller is the buyer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Escrow transaction not found or unauthorized","data":null}}}}}},"429":{"description":"A resend was already made for this escrow less than 60 seconds ago. The number of seconds left is in the message and in `errorData.retryAfter`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":429,"success":false,"message":"Please wait 42 seconds before requesting another OTP","data":null,"errorData":{"retryAfter":42}}}}}}},"500":{"description":"`id` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"abc\" (type string) at path \"_id\" for model \"EscrowTransaction\"","data":null}}}}}},"502":{"description":"Pandascrow rejected the resend or could not be reached. The cooldown is not started.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":502,"success":false,"message":"Could not send a new OTP. Please try again shortly.","data":null}}}}}}}}},"/api/v1/escrow/{id}/request-completion":{"patch":{"tags":["escrow"],"operationId":"escrow_patch_id_request_completion","summary":"Confirm handover and release escrow funds","description":"**Access:** Bearer token required.\n\nThe **buyer** confirms the deal is concluded and releases the money. The escrow must be `funded`; the server first calls Pandascrow's `POST /escrow/complete` with the escrow's Pandascrow id and the supplied `otp` (under the platform's Pandascrow account), and only if that call succeeds sets the local record to `completed` with `completedAt`. A wrong or expired OTP therefore surfaces as a 500 carrying Pandascrow's message, and the escrow stays `funded`.\n\n**Property status.** Unless the property type is `SHORTLET` (short lets stay bookable), the property is set to `rented` when `transactionType` is `rent` and to `sold` for every other transaction type.\n\n**Money.** Pandascrow pays the seller's net directly to the bank account snapshotted at initialization (or into the platform wallet when there was none) and withholds the platform fee plus agent commission as the partner fee. After responding, the server disburses the rest in the background: it records the seller's release as a `processing` payout, sends the listing agent's commission by bank transfer if the agent has a payout account on file (otherwise it stays in the agent's wallet balance), and sweeps the platform fee when the `autoSweepPlatformFees` setting is on. A failed transfer is stored as a `failed` payout to retry and never fails this request.\n\n**Notifications.** Buyer, seller and commission-earning agent each get an `escrow_completed` notification (in-app + `notifications:new` socket event, push and email per preferences), and the seller's socket room receives `escrow:status_updated` with `{ escrowTxId, status: \"completed\", propertyStatus }`.","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/patch-id-request-completion","x-short":"The buyer confirms the deal is concluded and releases the money.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Local escrow transaction ObjectId. The caller must be its buyer."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"otp":{"type":"string","description":"Release OTP issued by Pandascrow for this escrow. Request a new one with `POST /escrow/{id}/resend-otp`."}},"required":["otp"]},"examples":{"default":{"value":{"otp":"482913"}}}}}},"responses":{"200":{"description":"Funds released; the escrow is `completed`. `data` is the updated escrow transaction with `propertyId` (title, location, media, pricing, details, status, verification) and `sellerId` (firstName, lastName, avatar) populated. The populated property is read before its status is changed, so it can still show the pre-completion status.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"nullable":true},"salePrice":{"type":"integer"},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]}},"required":["_id","title","status","location","details","pricing","media","verification"]},"buyerId":{"type":"string"},"sellerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"pandascrowEscrowId":{"type":"integer"},"transactionType":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"platformFee":{"type":"integer"},"netAmount":{"type":"integer"},"sellerPayoutAccount":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"partnerEscrowFeePercent":{"type":"string"},"currency":{"type":"string"},"paymentUrl":{"type":"string"},"transactionRef":{"type":"string"},"provider":{"type":"string"},"bookingId":{"type":"string"},"inspectionId":{"nullable":true},"paymentNotifiedAt":{"type":"string","format":"date-time"},"paymentProof":{"nullable":true},"releaseOtpResentAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"agentId":{"type":"string"},"agentCommission":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","buyerId","sellerId","pandascrowEscrowId","transactionType","status","amount","platformFee","netAmount","sellerPayoutAccount","partnerEscrowFeePercent","currency","paymentUrl","transactionRef","provider","bookingId","inspectionId","paymentNotifiedAt","paymentProof","releaseOtpResentAt","completedAt","agentId","agentCommission","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Escrow marked as completed successfully","data":{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":{"_id":"665e0a7b9b1d4a0012ab1f02","title":"4 Bedroom Duplex, Lekki Phase 1","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":4,"bathrooms":5,"squareFeet":3200,"features":["Swimming pool","BQ"]},"pricing":{"rentPrice":null,"salePrice":45000000,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"_id":"665e0a7b9b1d4a0012ab1f05","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1717400000/properties/duplex-front.jpg","metadata":{"tag":"Exterior"}}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-10-02T09:15:00.000Z","verifiedBy":"665d7a109b1d4a0012ab0c02"}},"buyerId":"665d9f3a9b1d4a0012ab0e11","sellerId":{"_id":"665d8c219b1d4a0012ab0d47","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1717300000/avatars/folake.jpg"},"pandascrowEscrowId":48213,"transactionType":"purchase","status":"completed","amount":45450000,"platformFee":450000,"netAmount":42750000,"sellerPayoutAccount":{"accountName":"Folake Adeyemi","bankCode":"058","bankName":"Guaranty Trust Bank"},"partnerEscrowFeePercent":"5.940594","currency":"NGN","paymentUrl":"https://checkout.paystack.com/7k2m9x4q1z","transactionRef":"PNDS-TRX-8F3A21C9D0","provider":"paystack","bookingId":"665f1c2f9b1d4a0012ab34d1","inspectionId":null,"paymentNotifiedAt":"2026-11-20T10:42:17.000Z","paymentProof":null,"releaseOtpResentAt":"2026-11-24T14:02:10.000Z","completedAt":"2026-11-24T14:03:31.207Z","agentId":"665d8e5f9b1d4a0012ab0d9a","agentCommission":2250000,"createdAt":"2026-11-20T10:31:05.412Z","updatedAt":"2026-11-24T14:03:31.210Z","__v":0}}}}}}},"400":{"description":"- `otp` is missing from the body (checked before the escrow is looked up).\n- The escrow is not in `funded`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`otp` is missing from the body (checked before the escrow is looked up).","value":{"status":400,"success":false,"message":"Missing required field: otp","data":null}},"example2":{"summary":"The escrow is not in `funded`.","value":{"status":400,"success":false,"message":"Only funded escrow transactions can be marked as completed","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No escrow transaction with this id where the caller is the buyer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Escrow transaction not found or unauthorized","data":null}}}}}},"500":{"description":"- Pandascrow refused the completion (typically a wrong or expired OTP) or could not be reached. The text after the colon is Pandascrow's message. The escrow stays `funded` and nothing else changes.\n- `id` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"Pandascrow refused the completion (typically a wrong or expired OTP) or could not be reached. The text after the colon is Pandascrow's message. The escrow stays `funded` and nothing else changes.","value":{"status":500,"success":false,"message":"Failed to mark escrow complete: Pandascrow API request failed","data":null}},"example2":{"summary":"`id` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"abc\" (type string) at path \"_id\" for model \"EscrowTransaction\"","data":null}}}}}}}}},"/api/v1/escrow/property/{propertyId}":{"get":{"tags":["escrow"],"operationId":"escrow_get_property_property_id","summary":"List escrow payments for one of my properties","description":"**Access:** Bearer token required.\n\nSeller view of a property's deals: returns **every** escrow transaction recorded against the property, newest first, with the buyer populated (`firstName`, `lastName`, `email`, `avatar`). There is no pagination, and an empty array is returned when the property has no escrows.\n\nThe caller must be the property's `landlordId` (the user who created the listing). An agent who is only assigned to the property through `agentId` gets the same 404 as a stranger. Each item carries the full escrow record, including `paymentProof` (so the seller can check a buyer-reported payment) and `status` (`pending`, `funded`, `completed`, `disputed`, `cancelled`).","security":[{"bearerAuth":[]}],"x-doc-slug":"escrow/get-property-property-id","x-short":"Seller view of a property's deals: returns every escrow transaction recorded against the property, newest first, with the buyer populated (firstName, lastName, email, avatar).","parameters":[{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"},"description":"Property ObjectId. Must be a property whose `landlordId` is the caller."}],"responses":{"200":{"description":"All escrow transactions for the property, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"buyerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","email","avatar"]},"sellerId":{"type":"string"},"pandascrowEscrowId":{"type":"integer"},"transactionType":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"platformFee":{"type":"integer"},"netAmount":{"type":"integer"},"sellerPayoutAccount":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"partnerEscrowFeePercent":{"type":"string"},"currency":{"type":"string"},"paymentUrl":{"type":"string"},"transactionRef":{"type":"string"},"provider":{"type":"string"},"bookingId":{"type":"string"},"inspectionId":{"nullable":true},"paymentNotifiedAt":{"type":"string","format":"date-time"},"paymentProof":{"type":"object","properties":{"url":{"type":"string"},"publicId":{"type":"string"},"fileName":{"type":"string"},"mimeType":{"type":"string"},"uploadedAt":{"type":"string","format":"date-time"}},"required":["url","publicId","fileName","mimeType","uploadedAt"]},"releaseOtpResentAt":{"nullable":true},"completedAt":{"nullable":true},"agentId":{"type":"string"},"agentCommission":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","buyerId","sellerId","pandascrowEscrowId","transactionType","status","amount","platformFee","netAmount","sellerPayoutAccount","partnerEscrowFeePercent","currency","paymentUrl","transactionRef","provider","bookingId","inspectionId","paymentNotifiedAt","paymentProof","releaseOtpResentAt","completedAt","agentId","agentCommission","createdAt","updatedAt","__v"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Property escrow status fetched successfully","data":[{"_id":"665f1c2e9b1d4a0012ab34cd","propertyId":"665e0a7b9b1d4a0012ab1f02","buyerId":{"_id":"665d9f3a9b1d4a0012ab0e11","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1717300000/avatars/chinedu.jpg"},"sellerId":"665d8c219b1d4a0012ab0d47","pandascrowEscrowId":48213,"transactionType":"purchase","status":"funded","amount":45450000,"platformFee":450000,"netAmount":42750000,"sellerPayoutAccount":{"accountName":"Folake Adeyemi","bankCode":"058","bankName":"Guaranty Trust Bank"},"partnerEscrowFeePercent":"5.940594","currency":"NGN","paymentUrl":"https://checkout.paystack.com/7k2m9x4q1z","transactionRef":"PNDS-TRX-8F3A21C9D0","provider":"paystack","bookingId":"665f1c2f9b1d4a0012ab34d1","inspectionId":null,"paymentNotifiedAt":"2026-11-20T11:05:44.031Z","paymentProof":{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1795172744/homelinkhub/payment-proofs/665f1c2e9b1d4a0012ab34cd-1795172744031.jpg","publicId":"homelinkhub/payment-proofs/665f1c2e9b1d4a0012ab34cd-1795172744031","fileName":"gtbank-transfer-receipt.jpg","mimeType":"image/jpeg","uploadedAt":"2026-11-20T11:05:44.031Z"},"releaseOtpResentAt":null,"completedAt":null,"agentId":"665d8e5f9b1d4a0012ab0d9a","agentCommission":2250000,"createdAt":"2026-11-20T10:31:05.412Z","updatedAt":"2026-11-20T11:05:44.040Z","__v":0}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The property does not exist, or the caller is not its `landlordId`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found or unauthorized","data":null}}}}}},"500":{"description":"`propertyId` is not a valid 24-character ObjectId. The Mongoose cast error is not mapped to a 4xx.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"abc\" (type string) at path \"_id\" for model \"Property\"","data":null}}}}}}}}},"/api/v1/earnings":{"get":{"tags":["earnings"],"operationId":"earnings_get","summary":"Get earnings summary and feed","description":"**Access:** Bearer token required.\n\nEverything the earnings screen needs in one call: lifetime totals, the wallet balance and a merged, paginated feed of the caller's earnings, newest first. Four streams feed it, each tagged with `source`: `escrow` (escrows where the caller is the seller, any status), `shortlet` (the same, when the property type is `SHORTLET`), `commission` (completed `purchase` escrows where the caller is the listing agent; these rows have `_id` = `<escrowId>-commission`) and `inspection` (paid inspections assigned to the caller as agent).\n\nAmounts come from the values snapshotted on each record when it was created, so later fee changes never restate history. `grossAmount` is what the buyer paid, `netAmount` what the caller earns; for a seller it is already net of the platform fee and of any agent commission. Item `status` is the escrow status (`pending`, `funded`, `completed`, `disputed`, `cancelled`); inspection rows are reported as `completed` when the inspection is completed and `funded` otherwise. `payout` is the latest bank transfer recorded for that earning (`status`: `pending`, `processing`, `success`, `failed`) or `null`.\n\nIn `summary`, `totalNet`, `pendingNet` and `bySource` come from the wallet ledger (`totalNet` = completed seller proceeds + completed purchase commissions + fees on paid inspections; `pendingNet` is seller proceeds still `pending` or `funded`), while `totalGross`, `totalPlatformFees`, `completedCount` and `thisMonthNet` count completed feed items (this month is judged by the item's creation date). The feed is assembled in memory and then sliced, so `pagination.total` counts all items; `limit` has no upper bound. Any authenticated user may call this; users with no earnings get zeros and an empty feed.","security":[{"bearerAuth":[]}],"x-doc-slug":"earnings/get","x-short":"Everything the earnings screen needs in one call: lifetime totals, the wallet balance and a merged, paginated feed of the caller's earnings, newest first.","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page of the merged feed. Non-numeric or 0 falls back to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Feed page size. Non-numeric or 0 falls back to 20; no maximum is enforced."}],"responses":{"200":{"description":"Summary, wallet and one page of the feed. `property` and `counterparty` are populated objects (property: title, type, location, media, pricing; counterparty: firstName, lastName, avatar) or `null` when the referenced record is gone.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"summary":{"type":"object","properties":{"totalNet":{"type":"integer"},"totalGross":{"type":"integer"},"totalPlatformFees":{"type":"integer"},"pendingNet":{"type":"integer"},"thisMonthNet":{"type":"integer"},"completedCount":{"type":"integer"},"currency":{"type":"string"},"bySource":{"type":"object","properties":{"escrow":{"type":"integer"},"commission":{"type":"integer"},"inspection":{"type":"integer"},"shortlet":{"type":"integer"}},"required":["escrow","commission","inspection","shortlet"]}},"required":["totalNet","totalGross","totalPlatformFees","pendingNet","thisMonthNet","completedCount","currency","bySource"]},"wallet":{"type":"object","properties":{"available":{"type":"integer"},"withdrawn":{"type":"integer"},"processing":{"type":"integer"},"pending":{"type":"integer"},"currency":{"type":"string"}},"required":["available","withdrawn","processing","pending","currency"]},"transactions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"source":{"type":"string"},"property":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","coordinates"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"url":{"type":"string"},"metadata":{"type":"object","properties":{"tag":{"type":"string"}},"required":["tag"]}},"required":["_id","url","metadata"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"pricing":{"type":"object","properties":{"rentPrice":{"nullable":true},"salePrice":{"type":"integer"},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]}},"required":["_id","title","type","location","media","pricing"]},"counterparty":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"transactionType":{"type":"string"},"status":{"type":"string"},"grossAmount":{"type":"integer"},"platformFee":{"type":"integer"},"agentCommission":{"type":"integer"},"netAmount":{"type":"integer"},"currency":{"type":"string"},"reference":{"type":"string"},"completedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"payout":{"type":"object","properties":{"_id":{"type":"string"},"status":{"type":"string"},"amount":{"type":"integer"},"transactionRef":{"type":"string"},"failureReason":{"nullable":true},"processedAt":{"type":"string","format":"date-time"}},"required":["_id","status","amount","transactionRef","failureReason","processedAt"]}},"required":["_id","source","property","counterparty","transactionType","status","grossAmount","platformFee","agentCommission","netAmount","currency","reference","completedAt","createdAt","payout"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["summary","wallet","transactions","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Earnings fetched successfully","data":{"summary":{"totalNet":43125000,"totalGross":45828600,"totalPlatformFees":453600,"pendingNet":1485000,"thisMonthNet":42750000,"completedCount":5,"currency":"NGN","bySource":{"escrow":42750000,"commission":0,"inspection":15000,"shortlet":360000}},"wallet":{"available":375000,"withdrawn":42750000,"processing":0,"pending":1485000,"currency":"NGN"},"transactions":[{"_id":"665f1c2e9b1d4a0012ab34cd","source":"escrow","property":{"_id":"665e0a7b9b1d4a0012ab1f02","title":"4 Bedroom Duplex, Lekki Phase 1","type":"HOUSE","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"media":{"images":[{"_id":"665e0a7b9b1d4a0012ab1f05","url":"https://res.cloudinary.com/homelinkhub/image/upload/v1717400000/properties/duplex-front.jpg","metadata":{"tag":"Exterior"}}],"videos":[]},"pricing":{"rentPrice":null,"salePrice":45000000,"currency":"NGN","rentDurationYears":1}},"counterparty":{"_id":"665d9f3a9b1d4a0012ab0e11","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1717300000/avatars/chinedu.jpg"},"transactionType":"purchase","status":"completed","grossAmount":45450000,"platformFee":450000,"agentCommission":2250000,"netAmount":42750000,"currency":"NGN","reference":"PNDS-TRX-8F3A21C9D0","completedAt":"2026-11-24T14:03:31.207Z","createdAt":"2026-11-20T10:31:05.412Z","payout":{"_id":"66601b7e9b1d4a0012ab4a10","status":"success","amount":42750000,"transactionRef":"PNDS-PAYOUT-51C07E2B","failureReason":null,"processedAt":"2026-11-24T14:05:02.000Z"}}],"pagination":{"page":1,"limit":20,"total":7,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/earnings/wallet":{"get":{"tags":["earnings"],"operationId":"earnings_get_wallet","summary":"Get wallet balance","description":"**Access:** Bearer token required.\n\nReturns the caller's wallet figures and the payout account saved on their profile. The wallet is a ledger computed on each request, not a stored balance: `totalEarned` is the sum of `earned` (net proceeds of completed escrows sold, split into `escrow` and `shortlet`; `commission` on completed purchases brokered; `inspection` fees on paid inspections), `pending` is seller proceeds on escrows still `pending` or `funded`, `withdrawn` is the total of payouts with status `success`, `processing` the total of payouts in `pending` or `processing`, and `available = max(totalEarned - withdrawn - processing, 0)`.\n\n`payoutAccount` is `null` when no account number is saved; otherwise only the last four digits of the number are returned. As a side effect, an account saved with a bank name but no bank code has its code looked up from the provider's bank list and written back to the profile.","security":[{"bearerAuth":[]}],"x-doc-slug":"earnings/get-wallet","x-short":"Returns the caller's wallet figures and the payout account saved on their profile.","responses":{"200":{"description":"Wallet summary plus the saved payout account (or `payoutAccount: null`).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"currency":{"type":"string"},"earned":{"type":"object","properties":{"escrow":{"type":"integer"},"commission":{"type":"integer"},"inspection":{"type":"integer"},"shortlet":{"type":"integer"}},"required":["escrow","commission","inspection","shortlet"]},"totalEarned":{"type":"integer"},"pending":{"type":"integer"},"withdrawn":{"type":"integer"},"processing":{"type":"integer"},"available":{"type":"integer"},"payoutAccount":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountName":{"type":"string"},"accountNumberMasked":{"type":"string"}},"required":["bankName","bankCode","accountName","accountNumberMasked"]}},"required":["currency","earned","totalEarned","pending","withdrawn","processing","available","payoutAccount"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Wallet fetched successfully","data":{"currency":"NGN","earned":{"escrow":42750000,"commission":0,"inspection":15000,"shortlet":360000},"totalEarned":43125000,"pending":1485000,"withdrawn":42750000,"processing":0,"available":375000,"payoutAccount":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountName":"Folake Adeyemi","accountNumberMasked":"••••6789"}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/earnings/banks":{"get":{"tags":["earnings"],"operationId":"earnings_get_banks","summary":"List banks supported for payouts","description":"**Access:** Bearer token required.\n\nReturns the payout provider's (Pandascrow `GET /bank/lists`) list of banks, for the bank picker on the withdrawal and payout-account forms. Use an item's `bankCode` as `bankCode` in `POST /earnings/banks/validate` and `POST /earnings/withdraw`. The list is fetched from the provider on every call (the API does not cache it) and each item is passed through as received, so fields beyond those shown may be present.","security":[{"bearerAuth":[]}],"x-doc-slug":"earnings/get-banks","x-short":"Returns the payout provider's (Pandascrow GET /bank/lists) list of banks, for the bank picker on the withdrawal and payout-account forms.","responses":{"200":{"description":"Array of banks (empty array if the provider returned none).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"nibssBankCode":{"type":"string"}},"required":["bankName","bankCode","nibssBankCode"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Banks fetched successfully","data":[{"bankName":"Guaranty Trust Bank","bankCode":"058","nibssBankCode":"000013"}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"The provider could not be reached or returned an error. The text after the colon is the provider's message or the HTTP client's error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to fetch banks: Request failed with status code 502","data":null}}}}}}}}},"/api/v1/earnings/banks/validate":{"post":{"tags":["earnings"],"operationId":"earnings_post_banks_validate","summary":"Resolve a bank account name","description":"**Access:** Bearer token required.\n\nLooks up an account number at a bank through the payout provider (Pandascrow `POST /bank/validate`) and returns the name on the account, so the user can confirm the destination before saving it or withdrawing to it. Nothing is stored. Both values are coerced to strings before being sent.\n\nThe provider's field names for the resolved account are not documented, so the service reads the name under several spellings; if none matches, the call still returns 200 with `accountName` as an empty string. Treat an empty `accountName` as \"could not be resolved\".","security":[{"bearerAuth":[]}],"x-doc-slug":"earnings/post-banks-validate","x-short":"Looks up an account number at a bank through the payout provider (Pandascrow POST /bank/validate) and returns the name on the account, so the user can confirm the destination be...","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountNumber":{"type":"string","description":"Bank account number to resolve (10-digit NUBAN for Nigerian banks)."},"bankCode":{"type":"string","description":"Bank code from `GET /earnings/banks`."}},"required":["accountNumber","bankCode"]},"examples":{"default":{"value":{"accountNumber":"0123456789","bankCode":"058"}}}}}},"responses":{"200":{"description":"The account was resolved. `accountNumber` falls back to the number sent when the provider does not echo it; `bank` and `accountName` are empty strings when the provider omits them.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"accountNumber":{"type":"string"},"accountName":{"type":"string"},"bank":{"type":"string"}},"required":["accountNumber","accountName","bank"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Account resolved successfully","data":{"accountNumber":"0123456789","accountName":"FOLAKE ADEYEMI","bank":"Guaranty Trust Bank"}}}}}}},"400":{"description":"`accountNumber` or `bankCode` is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Missing required fields: accountNumber and bankCode","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"The provider rejected the lookup (unknown account, wrong bank) or could not be reached. The text after the colon is the provider's message, or `Account could not be resolved` when it returned no account data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Failed to validate bank account: Account could not be resolved","data":null}}}}}}}}},"/api/v1/earnings/withdraw":{"post":{"tags":["earnings"],"operationId":"earnings_post_withdraw","summary":"Withdraw from the wallet to a bank account","description":"**Access:** Bearer token required.\n\nSends part of the caller's available wallet balance to a Nigerian bank account by Pandascrow bank transfer (`POST /bank/transfers`, drawn from the platform's Pandascrow wallet). `amount` is rounded to a whole number and must not exceed `available` from `GET /earnings/wallet`.\n\nThe destination defaults to the payout account saved on the profile. Sending `accountNumber` switches to a one-off destination taken entirely from the body (`accountNumber`, `accountName`, `bankCode`, `bankName`) without changing the saved account; in that case `bankCode` must be sent too. The account is not re-validated here.\n\nA `Payout` record (`purpose: wallet_withdrawal`, `sourceType: manual`) is written as `pending` before the provider is called, moves to `processing` while the transfer is in flight, and ends as `success` or `failed`. The transfer is made synchronously: a 200 means the provider accepted it (`status: success`), a provider rejection returns 502 and leaves a `failed` payout in `GET /earnings/payouts` that no longer counts against the balance. Each call uses a fresh random idempotency key, so repeating the request creates a second withdrawal. No notification, socket event or email is sent by this API (the user's email is passed to the provider).","security":[{"bearerAuth":[]}],"x-doc-slug":"earnings/post-withdraw","x-short":"Sends part of the caller's available wallet balance to a Nigerian bank account by Pandascrow bank transfer (POST /bank/transfers, drawn from the platform's Pandascrow wallet).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"number","description":"Amount to withdraw in the wallet currency's main unit (naira). Rounded to the nearest whole number; must be greater than zero and at most the available balance."},"accountNumber":{"type":"string","description":"One-off destination account number. Omit to use the saved payout account. When present, the bank details are taken only from this request."},"accountName":{"type":"string","description":"Name on the one-off account. Only used together with `accountNumber`."},"bankCode":{"type":"string","description":"Bank code from `GET /earnings/banks`. Required when `accountNumber` is sent."},"bankName":{"type":"string","description":"Display name of the bank, stored on the payout record. Only used together with `accountNumber`."}},"required":["amount"]},"examples":{"default":{"value":{"amount":250000}}}}}},"responses":{"200":{"description":"The provider accepted the transfer. `transactionRef` is the provider's reference (can be `null` if it returned none).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"amount":{"type":"integer"},"currency":{"type":"string"},"status":{"type":"string"},"transactionRef":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","amount","currency","status","transactionRef","createdAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Withdrawal submitted successfully","data":{"_id":"66601b7e9b1d4a0012ab4a10","amount":250000,"currency":"NGN","status":"success","transactionRef":"PNDS-PAYOUT-51C07E2B","createdAt":"2026-11-25T09:12:40.118Z"}}}}}}},"400":{"description":"- `amount` is missing, not a number, or rounds to zero or less.\n- `amount` is more than the available balance; the balance is included in the message.\n- No `accountNumber` was sent and the profile has no saved payout account.\n- The destination (saved or one-off) has no bank code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`amount` is missing, not a number, or rounds to zero or less.","value":{"status":400,"success":false,"message":"Withdrawal amount must be greater than zero","data":null}},"example2":{"summary":"`amount` is more than the available balance; the balance is included in the message.","value":{"status":400,"success":false,"message":"Insufficient balance. Available: 375000","data":null}},"example3":{"summary":"No `accountNumber` was sent and the profile has no saved payout account.","value":{"status":400,"success":false,"message":"No payout bank account on file. Add your bank details in settings before withdrawing.","data":null}},"example4":{"summary":"The destination (saved or one-off) has no bank code.","value":{"status":400,"success":false,"message":"A bank code is required for the payout account. Pick your bank from the list and try again.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}},"502":{"description":"The provider rejected or failed the transfer. The message is the stored `failureReason`: the provider's own message, `Failed to transfer to bank account: <provider message>` when the request errored, or the text below when it gave none. A `failed` payout record is kept.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":502,"success":false,"message":"Transfer was rejected by the provider","data":null}}}}}}}}},"/api/v1/earnings/{id}/dispatch":{"post":{"tags":["earnings"],"operationId":"earnings_post_id_dispatch","summary":"Send a completed earning to my bank account","description":"**Access:** Bearer token required.\n\nPays out one item from the `GET /earnings` feed to the payout account saved on the caller's profile, by Pandascrow bank transfer. `source` must match the item's `source`, and the item must belong to the caller and be completed: for `escrow`/`shortlet` the caller is the escrow's seller and its status is `completed`; for `commission` the caller is the listing agent of a completed `purchase` escrow; for `inspection` the caller is the agent of a paid inspection whose status is `completed`.\n\nEach earning maps to a fixed idempotency key, so it can only be paid once: a payout that is already `success` or `processing` for that earning returns 409, while one that is `pending` or `failed` is re-sent under the same key. This matters for sales: when the escrow was opened with the seller's bank account, Pandascrow pays the seller directly on release and that transfer is recorded as a `processing` payout, so dispatching the same escrow returns 409 until the release is reported as failed. A new or retried payout must also fit within the available wallet balance.\n\nFor `escrow` and `shortlet` the call also triggers the escrow's other disbursements (the listing agent's commission, and the platform fee when auto-sweep is on); those payouts are appended to the response after the caller's own. The transfer is synchronous and no notification or socket event is sent.","security":[{"bearerAuth":[]}],"x-doc-slug":"earnings/post-id-dispatch","x-short":"Pays out one item from the GET /earnings feed to the payout account saved on the caller's profile, by Pandascrow bank transfer.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The earning's `_id` from the `GET /earnings` feed: an escrow transaction ObjectId, an inspection ObjectId, or `<escrowId>-commission` for commission rows (the suffix is stripped)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","description":"Which stream the earning belongs to: `escrow`, `shortlet`, `commission` or `inspection`. Use the feed item's `source`."}},"required":["source"]},"examples":{"default":{"value":{"source":"commission"}}}}}},"responses":{"200":{"description":"The transfer for the caller's share was accepted. `data` is an array of payouts; the first is always the caller's own (`purpose`: `seller_proceeds`, `agent_commission` or `inspection_fee`). For `escrow`/`shortlet` it may be followed by the escrow's `agent_commission` and `platform_fee` payouts, which can individually be `failed` without failing the request.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"purpose":{"type":"string"},"amount":{"type":"integer"},"currency":{"type":"string"},"status":{"type":"string"},"transactionRef":{"type":"string"},"failureReason":{"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["_id","purpose","amount","currency","status","transactionRef","failureReason","createdAt"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Funds dispatched successfully","data":[{"_id":"66601b7e9b1d4a0012ab4a10","purpose":"agent_commission","amount":2250000,"currency":"NGN","status":"success","transactionRef":"PNDS-PAYOUT-51C07E2B","failureReason":null,"createdAt":"2026-11-25T09:12:40.118Z"}]}}}}}},"400":{"description":"- `source` is missing or not one of the four values.\n- `id` (after removing a `-commission` suffix) is not a valid ObjectId.\n- The escrow or inspection behind the earning is not `completed` yet.\n- The earning's amount is more than the caller's available wallet balance (for example it was already withdrawn through `POST /earnings/withdraw`).\n- The caller has no payout account saved.\n- The saved payout account has no bank code.\n- The earning's amount is zero (for example a purchase escrow with no commission recorded).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`source` is missing or not one of the four values.","value":{"status":400,"success":false,"message":"source must be one of: escrow, shortlet, commission, inspection","data":null}},"example2":{"summary":"`id` (after removing a `-commission` suffix) is not a valid ObjectId.","value":{"status":400,"success":false,"message":"Invalid earning id","data":null}},"example3":{"summary":"The escrow or inspection behind the earning is not `completed` yet.","value":{"status":400,"success":false,"message":"Only completed earnings can be dispatched","data":null}},"example4":{"summary":"The earning's amount is more than the caller's available wallet balance (for example it was already withdrawn through `POST /earnings/withdraw`).","value":{"status":400,"success":false,"message":"Insufficient balance to dispatch this earning. Available: 0","data":null}},"example5":{"summary":"The caller has no payout account saved.","value":{"status":400,"success":false,"message":"No payout bank account on file. Add your bank details in settings before withdrawing.","data":null}},"example6":{"summary":"The saved payout account has no bank code.","value":{"status":400,"success":false,"message":"Your saved payout account has no bank selected. Update it under Settings › Payments & Billing and try again.","data":null}},"example7":{"summary":"The earning's amount is zero (for example a purchase escrow with no commission recorded).","value":{"status":400,"success":false,"message":"Payout amount must be greater than zero","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No matching earning owned by the caller for this `source` (wrong id, wrong source, not the caller's record, or an unpaid inspection).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Earning not found","data":null}}}}}},"409":{"description":"- This earning has already been paid out.\n- A transfer for this earning is in flight (including Pandascrow's own release to the seller's bank).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"This earning has already been paid out.","value":{"status":409,"success":false,"message":"These funds have already been sent to your bank account.","data":null}},"example2":{"summary":"A transfer for this earning is in flight (including Pandascrow's own release to the seller's bank).","value":{"status":409,"success":false,"message":"A transfer for these funds is already in progress.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}},"502":{"description":"The provider rejected or failed the caller's transfer. The message is the payout's `failureReason` (provider message, or `Failed to transfer to bank account: <provider message>`), or the text below when none was recorded. The `failed` payout is kept and can be retried by calling this endpoint again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":502,"success":false,"message":"Bank transfer failed","data":null}}}}}}}}},"/api/v1/earnings/payouts":{"get":{"tags":["earnings"],"operationId":"earnings_get_payouts","summary":"List my payouts","description":"**Access:** Bearer token required.\n\nPaginated history of every bank transfer recorded for the caller as beneficiary, newest first: wallet withdrawals (`purpose: wallet_withdrawal`), dispatched or automatically released seller proceeds (`seller_proceeds`), agent commissions (`agent_commission`) and inspection fees (`inspection_fee`). `status` is `pending`, `processing`, `success` or `failed`; `failureReason` explains a failed transfer and `providerFee` is the provider's fee when it reported one.\n\nThe raw provider response and the destination account number are never returned; `bank` carries only `accountName`, `bankCode` and `bankName`. `sourceType` is `escrow`, `inspection`, `booking` or `manual`, and `sourceId` points at the escrow or inspection the money came from (`null` for manual withdrawals). `limit` has no upper bound.","security":[{"bearerAuth":[]}],"x-doc-slug":"earnings/get-payouts","x-short":"Paginated history of every bank transfer recorded for the caller as beneficiary, newest first: wallet withdrawals (purpose: walletwithdrawal), dispatched or automatically releas...","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Non-numeric or 0 falls back to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size. Non-numeric or 0 falls back to 20; no maximum is enforced."}],"responses":{"200":{"description":"One page of payouts (`pages` is at least 1, even when there are none).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"payouts":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"beneficiaryType":{"type":"string"},"beneficiaryId":{"type":"string"},"purpose":{"type":"string"},"sourceType":{"type":"string"},"sourceId":{"nullable":true},"amount":{"type":"integer"},"currency":{"type":"string"},"status":{"type":"string"},"idempotencyKey":{"type":"string"},"bank":{"type":"object","properties":{"accountName":{"type":"string"},"bankCode":{"type":"string"},"bankName":{"type":"string"}},"required":["accountName","bankCode","bankName"]},"transactionRef":{"type":"string"},"providerFee":{"type":"integer"},"failureReason":{"nullable":true},"description":{"type":"string"},"initiatedBy":{"type":"string"},"processedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","beneficiaryType","beneficiaryId","purpose","sourceType","sourceId","amount","currency","status","idempotencyKey","bank","transactionRef","providerFee","failureReason","description","initiatedBy","processedAt","createdAt","updatedAt","__v"]}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}},"required":["page","limit","total","pages"]}},"required":["payouts","pagination"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Payouts fetched successfully","data":{"payouts":[{"_id":"66601b7e9b1d4a0012ab4a10","beneficiaryType":"agent","beneficiaryId":"665d8c219b1d4a0012ab0d47","purpose":"wallet_withdrawal","sourceType":"manual","sourceId":null,"amount":250000,"currency":"NGN","status":"success","idempotencyKey":"withdraw:665d8c219b1d4a0012ab0d47:1795597960118:9f2c4b7a1d3e5f60","bank":{"accountName":"Folake Adeyemi","bankCode":"058","bankName":"Guaranty Trust Bank"},"transactionRef":"PNDS-PAYOUT-51C07E2B","providerFee":50,"failureReason":null,"description":"HomeLinkHub wallet withdrawal","initiatedBy":"665d8c219b1d4a0012ab0d47","processedAt":"2026-11-25T09:12:41.530Z","createdAt":"2026-11-25T09:12:40.118Z","updatedAt":"2026-11-25T09:12:41.531Z","__v":0}],"pagination":{"page":1,"limit":20,"total":1,"pages":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/stream/events":{"get":{"tags":["stream"],"operationId":"stream_get_events","summary":"Open the server-sent events stream","description":"**Access:** Access token in the `Authorization` header, or in the `token` query parameter.\n\nOpens a long-lived Server-Sent Events connection for the authenticated user. The response is `200` with `Content-Type: text/event-stream`, `Cache-Control: no-cache`, `Connection: keep-alive` and `X-Accel-Buffering: no`, and it never completes. The first frame is a `connected` event whose data is `{ userId, timestamp }`. Every 30 seconds the server writes the comment line `:heartbeat` to keep proxies from closing the connection (comments do not fire `EventSource` handlers). A user may hold several connections at once; each receives every event. Events delivered on this stream: `booking:updated` (`{ bookingId, propertyId, status, type }`, sent to both tenant and landlord when a booking is confirmed or cancelled), `notification:new` (only from `POST /api/v1/stream/notify`) and `notification:system` (no route sends it at the moment). The platform's regular notifications (`notifications:new`), chat events and `escrow:status_updated` are **not** sent over SSE; they are Socket.IO only. The token is checked once, when the connection opens; the stream stays open after the token expires. The client registry is in process memory, so delivery assumes a single server instance. An open stream also counts as \"online\", which suppresses the push and email fallbacks for chat messages.\n\n**Auth:** this route uses the `streamAuth` middleware, not `authenticateUser` (which is why the generated spec shows it as public). It requires a valid access token, taken from `Authorization: Bearer <token>` or, if that header is absent, from the `?token=` query parameter. `streamAuth` only verifies the JWT signature and expiry: it does not load the user from the database, so it does not notice deleted or deactivated accounts, and it sets the request's role to the placeholder `user`, so no stream route authorizes on role. Its failures use their own body shape, `{ success: false, error }`, not the standard error envelope.","security":[{"bearerAuth":[]},{"tokenQuery":[]}],"x-doc-slug":"stream/get-events","x-short":"Opens a long-lived Server-Sent Events connection for the authenticated user.","parameters":[{"name":"token","in":"query","required":false,"schema":{"type":"string"},"description":"JWT access token. Use this when the client cannot set headers (browser `EventSource`); otherwise send `Authorization: Bearer <token>`. One of the two is required."}],"responses":{"200":{"description":"Stream opened. The body is an endless `text/event-stream`, not JSON; the example shows the first frame, a heartbeat comment and a later event.","content":{"text/event-stream":{"schema":{"type":"string"},"examples":{"default":{"value":"event: connected\ndata: {\"userId\":\"665f1c2e9b1d4a0012ab34c4\",\"timestamp\":\"2026-06-05T14:02:10.107Z\"}\n\n:heartbeat\n\nevent: booking:updated\ndata: {\"bookingId\":\"6660a7d49b1d4a0012ab3590\",\"propertyId\":\"665f1c2e9b1d4a0012ab34cd\",\"status\":\"confirmed\",\"type\":\"reservation\"}\n\n"}}}}},"401":{"description":"- No `Authorization: Bearer` header and no `?token=` query parameter\n- The access token has expired\n- The token is malformed or its signature is wrong\n- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No `Authorization: Bearer` header and no `?token=` query parameter","value":{"success":false,"error":"No token provided"}},"example2":{"summary":"The access token has expired","value":{"success":false,"error":"Token expired"}},"example3":{"summary":"The token is malformed or its signature is wrong","value":{"success":false,"error":"Invalid token"}},"example4":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example5":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example6":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Any other failure while verifying the token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"success":false,"error":"Auth failed"}}}}}}}}},"/api/v1/stream/notify":{"post":{"tags":["stream"],"operationId":"stream_post_notify","summary":"Send a test notification to yourself","description":"**Access:** Bearer token required.\n\nA test/demo helper (labelled as such in the source). It builds an ad-hoc notification object and delivers it as a `notification:new` event to the **caller's own** open SSE connections and to their Socket.IO personal room (`user:<id>`). The recipient is always the token's user; there is no way to target someone else. Nothing is stored: the object is not written to the notifications collection, will not appear in the notifications list, and its `id` is just `notif_<timestamp>`. The body is not validated; `type` defaults to `info`, `metadata` is always `{}` and `read` is always `false`. Note the event name is `notification:new` (singular), distinct from the `notifications:new` event the real notification service emits. The route is not public, but it is open to **any** authenticated user regardless of role. The response uses its own envelope, `{ success, data }`.\n\n**Auth:** this route uses the `streamAuth` middleware, not `authenticateUser` (which is why the generated spec shows it as public). It requires a valid access token, taken from `Authorization: Bearer <token>` or, if that header is absent, from the `?token=` query parameter. `streamAuth` only verifies the JWT signature and expiry: it does not load the user from the database, so it does not notice deleted or deactivated accounts, and it sets the request's role to the placeholder `user`, so no stream route authorizes on role. Its failures use their own body shape, `{ success: false, error }`, not the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"stream/post-notify","x-short":"A test/demo helper (labelled as such in the source).","parameters":[{"name":"token","in":"query","required":false,"schema":{"type":"string"},"description":"JWT access token, accepted as an alternative to the `Authorization: Bearer` header."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","description":"Notification title. Not validated; omitted from the payload if not sent."},"body":{"type":"string","description":"Notification text. Not validated; omitted from the payload if not sent."},"type":{"type":"string","description":"Free-form type label. Defaults to `info`."}}},"examples":{"default":{"value":{"title":"Test","body":"This is a test notification","type":"info"}}}}}},"responses":{"200":{"description":"Event emitted to the caller's own connections. `data` is the payload that was sent.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"type":{"type":"string"},"metadata":{"type":"object"},"read":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","userId","title","body","type","metadata","read","createdAt"]}},"required":["success","data"]},"examples":{"default":{"value":{"success":true,"data":{"id":"notif_1780668130107","userId":"665f1c2e9b1d4a0012ab34c4","title":"Test","body":"This is a test notification","type":"info","metadata":{},"read":false,"createdAt":"2026-06-05T14:02:10.107Z"}}}}}}},"401":{"description":"- No `Authorization: Bearer` header and no `?token=` query parameter\n- The access token has expired\n- The token is malformed or its signature is wrong\n- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No `Authorization: Bearer` header and no `?token=` query parameter","value":{"success":false,"error":"No token provided"}},"example2":{"summary":"The access token has expired","value":{"success":false,"error":"Token expired"}},"example3":{"summary":"The token is malformed or its signature is wrong","value":{"success":false,"error":"Invalid token"}},"example4":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example5":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example6":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"- Any other failure while verifying the token\n- The handler threw while emitting. `error` is the thrown error's message, or the fallback shown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"Any other failure while verifying the token","value":{"success":false,"error":"Auth failed"}},"example2":{"summary":"The handler threw while emitting. `error` is the thrown error's message, or the fallback shown.","value":{"success":false,"error":"Unknown error"}}}}}}}}},"/api/v1/chat/rooms":{"get":{"tags":["chat"],"operationId":"chat_get_rooms","summary":"List my chat rooms","description":"**Access:** Bearer token required.\n\nEvery non-deleted room the caller participates in, sorted by `lastMessageAt` descending (most recent conversation first). `createdBy`, `participants` and `lastMessageSenderId` are populated with `firstName`, `lastName`, `avatar`; `referencedProperty` with `title`, `media`, `pricing.rentPrice`, `pricing.salePrice`. There is no pagination and no projection: each room carries its **entire** embedded `messages` array (including soft-deleted messages, with `senderId` as a raw id), so the payload grows with conversation length. No unread count is computed; clients derive it from each message's `readBy`. The same payload is pushed over Socket.IO as the `chat:rooms` event.\n\n**Envelope:** chat endpoints do not use the standard `{status, success, message, data}` wrapper. Success bodies are `{success, data}` and the handler's own 400s are `{success: false, message}`; only errors that fall through to the global error middleware get the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"chat/get-rooms","x-short":"Every non-deleted room the caller participates in, sorted by lastMessageAt descending (most recent conversation first).","responses":{"200":{"description":"The caller's rooms (the `messages` array is trimmed to one item here)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"isPrivate":{"type":"boolean"},"createdBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"participants":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]}},"referencedProperty":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true}},"required":["rentPrice","salePrice"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","pricing","media"]},"messages":{"type":"array","items":{"type":"object","properties":{"senderId":{"type":"string"},"content":{"type":"string"},"messageType":{"type":"string"},"readBy":{"type":"array","items":{}},"deletedAt":{"nullable":true},"editedAt":{"nullable":true},"replyToId":{"nullable":true},"_id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["senderId","content","messageType","readBy","deletedAt","editedAt","replyToId","_id","createdAt","updatedAt"]}},"lastMessage":{"type":"string"},"lastMessageAt":{"type":"string","format":"date-time"},"lastMessageSenderId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","name","isPrivate","createdBy","participants","referencedProperty","messages","lastMessage","lastMessageAt","lastMessageSenderId","deletedAt","createdAt","updatedAt","__v"]}}},"required":["success","data"]},"examples":{"default":{"value":{"success":true,"data":[{"_id":"6660a7d49b1d4a0012ab3550","name":"Amaka Eze","isPrivate":true,"createdBy":{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg"},"participants":[{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg"},{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg"}],"referencedProperty":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","pricing":{"rentPrice":4500000,"salePrice":null},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]}},"messages":[{"senderId":"665f1c2e9b1d4a0012ab34c4","content":"Good afternoon, is the flat still available for inspection this Saturday?","messageType":"TEXT","readBy":[],"deletedAt":null,"editedAt":null,"replyToId":null,"_id":"6660a7d49b1d4a0012ab3551","createdAt":"2026-06-05T14:02:10.107Z","updatedAt":"2026-06-05T14:02:10.107Z"}],"lastMessage":"Good afternoon, is the flat still available for inspection this Saturday?","lastMessageAt":"2026-06-05T14:02:10.107Z","lastMessageSenderId":{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg"},"deletedAt":null,"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"post":{"tags":["chat"],"operationId":"chat_post_rooms","summary":"Create or fetch a chat room for a property","description":"**Access:** Bearer token required.\n\nCreates a conversation about a property, or returns the existing one. Rooms are unique per (`createdBy`, `referencedProperty`): the call is an atomic upsert, so if the caller already has a room for that property the existing room is returned unchanged (the `name`, `participants` and `isPrivate` sent are ignored) and the status is still **201**. On first creation the participants are the caller plus the ids in `participants`. Unlike the Socket.IO `chat:create_and_send` event, this endpoint does **not** add the property's agent or landlord automatically, does not check that the property or the participant users exist, and sends no notification. After the upsert, each of the caller and the listed participants is sent a `chat:rooms` socket event on their personal room (`user:<id>`) carrying their full, refreshed room list. `data` is the room with `createdBy`, `participants` (`firstName`, `lastName`, `avatar`) and `referencedProperty` (`title`, `media`, `pricing.rentPrice`, `pricing.salePrice`) populated, and it includes the room's whole embedded `messages` array. Malformed ObjectIds in `referencedProperty` or `participants` are not validated and surface as a 500. `name` is required by the model but not enforced on this path.\n\n**Envelope:** chat endpoints do not use the standard `{status, success, message, data}` wrapper. Success bodies are `{success, data}` and the handler's own 400s are `{success: false, message}`; only errors that fall through to the global error middleware get the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"chat/post-rooms","x-short":"Creates a conversation about a property, or returns the existing one.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"referencedProperty":{"type":"string","description":"ObjectId of the property the conversation is about."},"name":{"type":"string","description":"Room display name (the socket flow uses the creator's full name). Only applied when the room is first created."},"participants":{"type":"array","items":{},"description":"Array of user ObjectId strings to add alongside the caller, normally the property's agent or landlord. Defaults to `[]`. Only applied when the room is first created."},"isPrivate":{"type":"boolean","description":"Defaults to `true`. Only applied when the room is first created."}},"required":["referencedProperty"]},"examples":{"default":{"value":{"name":"Amaka Eze","participants":["665f1c2e9b1d4a0012ab34c1"],"referencedProperty":"665f1c2e9b1d4a0012ab34cd"}}}}}},"responses":{"201":{"description":"Room created, or the caller's existing room for this property returned","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"isPrivate":{"type":"boolean"},"createdBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"participants":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]}},"referencedProperty":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true}},"required":["rentPrice","salePrice"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]}},"required":["_id","title","pricing","media"]},"messages":{"type":"array","items":{}},"lastMessage":{"nullable":true},"lastMessageAt":{"nullable":true},"lastMessageSenderId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","name","isPrivate","createdBy","participants","referencedProperty","messages","lastMessage","lastMessageAt","lastMessageSenderId","deletedAt","createdAt","updatedAt","__v"]}},"required":["success","data"]},"examples":{"default":{"value":{"success":true,"data":{"_id":"6660a7d49b1d4a0012ab3550","name":"Amaka Eze","isPrivate":true,"createdBy":{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg"},"participants":[{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg"},{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg"}],"referencedProperty":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","pricing":{"rentPrice":4500000,"salePrice":null},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]}},"messages":[],"lastMessage":null,"lastMessageAt":null,"lastMessageSenderId":null,"deletedAt":null,"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}}}}}}},"400":{"description":"`referencedProperty` missing from the body. Non-standard error body (no `status` or `data`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"success":false,"message":"Referenced property ID is required"}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/chat/rooms/{roomId}/messages":{"get":{"tags":["chat"],"operationId":"chat_get_rooms_room_id_messages","summary":"List messages in a room","description":"**Access:** Bearer token required.\n\nMessages from one room with soft-deleted messages removed and `senderId` populated (`firstName`, `lastName`, `avatar`, `email`). Messages are returned in stored order, **oldest first**, and the window is taken from the start of the conversation: `offset=0&limit=50` is the first (oldest) 50 messages, not the latest 50. To page towards newer messages increase `offset`. Only participants of the room can read it; anyone else, and any unknown or deleted room id, gets a 403. Fetching does not mark messages as read.\n\n**Envelope:** chat endpoints do not use the standard `{status, success, message, data}` wrapper. Success bodies are `{success, data}` and the handler's own 400s are `{success: false, message}`; only errors that fall through to the global error middleware get the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"chat/get-rooms-room-id-messages","x-short":"Messages from one room with soft-deleted messages removed and senderId populated (firstName, lastName, avatar, email).","parameters":[{"name":"roomId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the chat room."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50},"description":"Maximum number of messages to return. Not capped."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0},"description":"Number of non-deleted messages to skip, counted from the oldest message."}],"responses":{"200":{"description":"Messages, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"senderId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"email":{"type":"string"}},"required":["_id","firstName","lastName","avatar","email"]},"content":{"type":"string"},"messageType":{"type":"string"},"readBy":{"type":"array","items":{}},"deletedAt":{"nullable":true},"editedAt":{"nullable":true},"replyToId":{"nullable":true},"_id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["senderId","content","messageType","readBy","deletedAt","editedAt","replyToId","_id","createdAt","updatedAt"]}}},"required":["success","data"]},"examples":{"default":{"value":{"success":true,"data":[{"senderId":{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg","email":"amaka.eze@example.com"},"content":"Good afternoon, is the flat still available for inspection this Saturday?","messageType":"TEXT","readBy":[],"deletedAt":null,"editedAt":null,"replyToId":null,"_id":"6660a7d49b1d4a0012ab3551","createdAt":"2026-06-05T14:02:10.107Z","updatedAt":"2026-06-05T14:02:10.107Z"}]}}}}}},"400":{"description":"`roomId` is not a valid ObjectId. Non-standard error body (no `status` or `data`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"success":false,"message":"Invalid room ID"}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not a participant of the room (or the room does not exist or was deleted). Non-standard error body (no `status` or `data`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"success":false,"message":"You are not a participant in this chat room"}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"post":{"tags":["chat"],"operationId":"chat_post_rooms_room_id_messages","summary":"Send a message","description":"**Access:** Bearer token required.\n\nAppends a message to the room and updates the room's `lastMessage`, `lastMessageAt` and `lastMessageSenderId`. The saved message is broadcast over Socket.IO as `chat:message` to the room channel `room:<roomId>` (sockets that sent `chat:join` for the room), with an added `sender: { id, username }`; unlike messages sent through the socket, this broadcast has no `roomId` field and no `chat:room_updated` event is sent to participants' personal rooms. Other participants who are **offline** (no socket and no SSE connection) get a push notification and, at most once per room every 30 minutes, an email (\"New message from <name> on HomeLink Hub\"); chat messages are never stored in the notifications list. Those alerts follow `agentMessages` preferences for the room creator and `newMessages` for everyone else. Only participants of the room can post; anyone else, and any unknown or deleted room id, gets a 403. The handler does not validate `content` or `messageType` (the update is applied without schema validators), so send a non-empty `content` and one of the documented types. `data` is the saved message with `senderId` populated (`firstName`, `lastName`, `avatar`).\n\n**Envelope:** chat endpoints do not use the standard `{status, success, message, data}` wrapper. Success bodies are `{success, data}` and the handler's own 400s are `{success: false, message}`; only errors that fall through to the global error middleware get the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"chat/post-rooms-room-id-messages","x-short":"Appends a message to the room and updates the room's lastMessage, lastMessageAt and lastMessageSenderId.","parameters":[{"name":"roomId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the chat room."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","description":"Message text, or the URL of the uploaded media for non-text types. The model's limit is 5000 characters. Not validated by the handler."},"messageType":{"type":"string","description":"`TEXT` (default), `IMAGE`, `FILE` or `AUDIO`. For non-text types the offline alert preview reads \"Sent a photo\", \"Sent a file\" or \"Sent a voice note\"."},"replyToId":{"type":"string","description":"ObjectId of the message being replied to. Stored as-is; not checked against the room."}},"required":["content"]},"examples":{"default":{"value":{"content":"Good afternoon, is the flat still available for inspection this Saturday?","messageType":"TEXT"}}}}}},"responses":{"201":{"description":"Message saved and broadcast","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"senderId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"content":{"type":"string"},"messageType":{"type":"string"},"readBy":{"type":"array","items":{}},"deletedAt":{"nullable":true},"editedAt":{"nullable":true},"replyToId":{"nullable":true},"_id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["senderId","content","messageType","readBy","deletedAt","editedAt","replyToId","_id","createdAt","updatedAt"]}},"required":["success","data"]},"examples":{"default":{"value":{"success":true,"data":{"senderId":{"_id":"665f1c2e9b1d4a0012ab34c4","firstName":"Amaka","lastName":"Eze","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg"},"content":"Good afternoon, is the flat still available for inspection this Saturday?","messageType":"TEXT","readBy":[],"deletedAt":null,"editedAt":null,"replyToId":null,"_id":"6660a7d49b1d4a0012ab3551","createdAt":"2026-06-05T14:02:10.107Z","updatedAt":"2026-06-05T14:02:10.107Z"}}}}}}},"400":{"description":"`roomId` is not a valid ObjectId. Non-standard error body (no `status` or `data`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"success":false,"message":"Invalid room ID"}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not a participant of the room (or the room does not exist or was deleted). Non-standard error body (no `status` or `data`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"success":false,"message":"You are not a participant in this chat room"}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/chat/messages/{messageId}":{"delete":{"tags":["chat"],"operationId":"chat_delete_messages_message_id","summary":"Delete a message","description":"**Access:** Bearer token required. **Also requires:** Caller must be the sender of the message.\n\nSoft-deletes one of the caller's own messages by setting its `deletedAt`. Deleted messages disappear from the messages endpoint and from socket history, but remain inside the `messages` array returned by the rooms list, and the room's `lastMessage` preview is not rewritten. No socket event is emitted, so other clients only notice on their next fetch. The success body has no `data`. All failures of this endpoint are thrown as plain errors and therefore come back as **500** in the standard error envelope, including not-found, not-owner and a malformed `messageId`.","security":[{"bearerAuth":[]}],"x-doc-slug":"chat/delete-messages-message-id","x-short":"Soft-deletes one of the caller's own messages by setting its deletedAt.","parameters":[{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the embedded message to delete."}],"responses":{"200":{"description":"Message soft-deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]},"examples":{"default":{"value":{"success":true,"message":"Message deleted successfully"}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"- No room contains a message with that id\n- The message was sent by someone else","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No room contains a message with that id","value":{"status":500,"success":false,"message":"Message not found","data":null}},"example2":{"summary":"The message was sent by someone else","value":{"status":500,"success":false,"message":"Unauthorized: You can only delete your own messages","data":null}}}}}}}}},"/api/v1/chat/rooms/{roomId}/report":{"post":{"tags":["chat"],"operationId":"chat_post_rooms_room_id_report","summary":"Report a chat room","description":"**Access:** Bearer token required.\n\nFiles a report against a conversation. A `Report` document is created with the caller as `reporterId`, the room as `reportedRoomId` and status `Pending` (the model's statuses are `Pending`, `Reviewed`, `Resolved`). Only participants of the room can report it (anyone else, and any unknown or deleted room id, gets a 403). The same user can report the same room repeatedly, and nothing is emitted, emailed or notified. No other code in the service reads the `Report` collection, so there is currently no API to list or resolve reports. `reason` must be one of the model's enum values; anything else fails Mongoose validation, which the error middleware returns as a 400 in the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"chat/post-rooms-room-id-report","x-short":"Files a report against a conversation.","parameters":[{"name":"roomId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the chat room being reported."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","description":"One of `Spam`, `Harassment`, `Fraud`, `Inappropriate Content`, `Other` (case-sensitive)."},"description":{"type":"string","description":"Free-text details, at most 1000 characters."}},"required":["reason"]},"examples":{"default":{"value":{"reason":"Fraud","description":"Asked me to pay the caution fee to a personal account outside the app."}}}}}},"responses":{"201":{"description":"Report stored. Note the body has `message` and `data` but no `status`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"_id":{"type":"string"},"reporterId":{"type":"string"},"reportedRoomId":{"type":"string"},"reason":{"type":"string"},"description":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","reporterId","reportedRoomId","reason","description","status","createdAt","updatedAt","__v"]},"message":{"type":"string"}},"required":["success","data","message"]},"examples":{"default":{"value":{"success":true,"data":{"_id":"6660a7d49b1d4a0012ab3560","reporterId":"665f1c2e9b1d4a0012ab34c4","reportedRoomId":"6660a7d49b1d4a0012ab3550","reason":"Fraud","description":"Asked me to pay the caution fee to a personal account outside the app.","status":"Pending","createdAt":"2026-06-05T14:02:10.107Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0},"message":"Report submitted successfully"}}}}}},"400":{"description":"- `roomId` is not a valid ObjectId. Non-standard error body (no `status` or `data`).\n- `reason` missing from the body. Non-standard error body (no `status` or `data`).\n- `reason` is not an allowed value (Mongoose validation error passed through the error middleware; the quoted value is the one sent)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`roomId` is not a valid ObjectId. Non-standard error body (no `status` or `data`).","value":{"success":false,"message":"Invalid room ID"}},"example2":{"summary":"`reason` missing from the body. Non-standard error body (no `status` or `data`).","value":{"success":false,"message":"Reason is required"}},"example3":{"summary":"`reason` is not an allowed value (Mongoose validation error passed through the error middleware; the quoted value is the one sent)","value":{"status":400,"success":false,"message":"Validation Error: Report validation failed: reason: `Scam` is not a valid enum value for path `reason`.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The caller is not a participant of the room (or the room does not exist or was deleted). Non-standard error body (no `status` or `data`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"success":false,"message":"You are not a participant in this chat room"}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/wishlist/add":{"post":{"tags":["wishlist"],"operationId":"wishlist_post_add","summary":"Add a listing to my wishlist","description":"**Access:** Bearer token required.\n\nAdds a property to the caller's wishlist (stored as an array of property ids on the user). Fails with a 409 if it is already there; use `/wishlist/toggle` for a call that never conflicts. The property only has to exist: its status is not checked and soft-deleted properties are accepted. `data.wishlist` is the caller's full list of wishlisted property ids after the change.\n\nSend the body as JSON with `Content-Type: application/json`: a request with no parsed body fails with a 500 instead of the 400 below, because the handler reads `req.body` unguarded. Success responses from the wishlist endpoints do not use the standard envelope: there is no top-level `status` field, and the message is repeated inside `data`. Errors do use the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"wishlist/post-add","x-short":"Adds a property to the caller's wishlist (stored as an array of property ids on the user).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"propertyId":{"type":"string","description":"ObjectId of the property."}},"required":["propertyId"]},"examples":{"default":{"value":{"propertyId":"665f1c2e9b1d4a0012ab34cd"}}}}}},"responses":{"200":{"description":"The property was added.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"message":{"type":"string"},"wishlist":{"type":"array","items":{"type":"string"}}},"required":["message","wishlist"]}},"required":["success","message","data"]},"examples":{"default":{"value":{"success":true,"message":"Property added to wishlist","data":{"message":"Property added to wishlist","wishlist":["665f1c2e9b1d4a0012ab34cd"]}}}}}}},"400":{"description":"`propertyId` is missing from the body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Property ID is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No property with this id exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"409":{"description":"The property is already in the caller's wishlist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":409,"success":false,"message":"Property already in wishlist","data":null}}}}}},"500":{"description":"`propertyId` is not a valid ObjectId. The underlying error message is passed through and `errorData` carries the serialized error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\"","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}}},"/api/v1/wishlist/remove":{"post":{"tags":["wishlist"],"operationId":"wishlist_post_remove","summary":"Remove a listing from my wishlist","description":"**Access:** Bearer token required.\n\nRemoves a property id from the caller's wishlist. Note the method is POST, not DELETE. The property itself is not looked up, so this works for deleted properties too; an id that is not in the list (including a malformed one) is a 404. `data.wishlist` is the caller's remaining list of property ids.\n\nSend the body as JSON with `Content-Type: application/json`: a request with no parsed body fails with a 500 instead of the 400 below, because the handler reads `req.body` unguarded. Success responses from the wishlist endpoints do not use the standard envelope: there is no top-level `status` field, and the message is repeated inside `data`. Errors do use the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"wishlist/post-remove","x-short":"Removes a property id from the caller's wishlist.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"propertyId":{"type":"string","description":"ObjectId of the property."}},"required":["propertyId"]},"examples":{"default":{"value":{"propertyId":"665f1c2e9b1d4a0012ab34cd"}}}}}},"responses":{"200":{"description":"The property was removed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"message":{"type":"string"},"wishlist":{"type":"array","items":{}}},"required":["message","wishlist"]}},"required":["success","message","data"]},"examples":{"default":{"value":{"success":true,"message":"Property removed from wishlist","data":{"message":"Property removed from wishlist","wishlist":[]}}}}}}},"400":{"description":"`propertyId` is missing from the body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Property ID is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"The property is not in the caller's wishlist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not in wishlist","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/wishlist/toggle":{"post":{"tags":["wishlist"],"operationId":"wishlist_post_toggle","summary":"Toggle a listing in my wishlist","description":"**Access:** Bearer token required.\n\nAdds the property to the caller's wishlist if it is absent, removes it if it is present. `data.added` tells you which happened (`true` = added, `false` = removed) and `data.wishlist` is the full list of property ids afterwards. The property must exist (even to remove it), but its status is not checked.\n\nSend the body as JSON with `Content-Type: application/json`: a request with no parsed body fails with a 500 instead of the 400 below, because the handler reads `req.body` unguarded. Success responses from the wishlist endpoints do not use the standard envelope: there is no top-level `status` field, and the message is repeated inside `data`. Errors do use the standard error envelope.","security":[{"bearerAuth":[]}],"x-doc-slug":"wishlist/post-toggle","x-short":"Adds the property to the caller's wishlist if it is absent, removes it if it is present.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"propertyId":{"type":"string","description":"ObjectId of the property."}},"required":["propertyId"]},"examples":{"default":{"value":{"propertyId":"665f1c2e9b1d4a0012ab34cd"}}}}}},"responses":{"200":{"description":"- The property was not in the wishlist and has been added.\n- The property was in the wishlist and has been removed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"message":{"type":"string"},"added":{"type":"boolean"},"wishlist":{"type":"array","items":{"type":"string"}}},"required":["message","added","wishlist"]}},"required":["success","message","data"]},"examples":{"example1":{"summary":"The property was not in the wishlist and has been added.","value":{"success":true,"message":"Property added to wishlist","data":{"message":"Property added to wishlist","added":true,"wishlist":["665f1c2e9b1d4a0012ab34cd"]}}},"example2":{"summary":"The property was in the wishlist and has been removed.","value":{"success":true,"message":"Property removed from wishlist","data":{"message":"Property removed from wishlist","added":false,"wishlist":[]}}}}}}},"400":{"description":"`propertyId` is missing from the body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Property ID is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"404":{"description":"No property with this id exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"`propertyId` is not a valid ObjectId. The underlying error message is passed through and `errorData` carries the serialized error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\"","data":null,"errorData":{"stringValue":"\"not-an-id\"","valueType":"string","kind":"ObjectId","value":"not-an-id","path":"_id","reason":{},"name":"CastError","message":"Cast to ObjectId failed for value \"not-an-id\" (type string) at path \"_id\" for model \"Property\""}}}}}}}}}},"/api/v1/wishlist":{"get":{"tags":["wishlist"],"operationId":"wishlist_get","summary":"Get my wishlist","description":"**Access:** Bearer token required.\n\nReturns the caller's wishlisted properties as full property documents, in the order they were added, each with `landlordId` populated (`firstName`, `lastName`, `avatar`). The list is not filtered by status, so unlisted, rented, sold and soft-deleted properties (`deletedAt` set) still appear; check `status` and `deletedAt` before showing them as available. Pagination is done in memory after loading the whole list.\n\nThe success response does not use the standard envelope: there is no `status` and no `message`, and the paging values (`total`, `page`, `limit`) sit directly inside `data` rather than in a `pagination` object.","security":[{"bearerAuth":[]}],"x-doc-slug":"wishlist/get","x-short":"Returns the caller's wishlisted properties as full property documents, in the order they were added, each with landlordId populated (firstName, lastName, avatar).","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Default 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20},"description":"Page size. Default 20; not capped by the server."}],"responses":{"200":{"description":"A page of wishlisted properties. `total` is the size of the whole wishlist.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"properties":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"landlordId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"agentId":{"nullable":true},"title":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"availability":{"type":"object","properties":{"availableFrom":{"type":"string","format":"date-time"},"bookingCalendar":{"type":"array","items":{}}},"required":["availableFrom","bookingCalendar"]},"shortLet":{"type":"object","properties":{"minNights":{"type":"integer"},"bookedRanges":{"type":"array","items":{}}},"required":["minNights","bookedRanges"]},"amenities":{"type":"array","items":{"type":"string"}},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"gps":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","gps","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time"},"verifiedBy":{"type":"string"}},"required":["isVerified","verifiedAt","verifiedBy"]},"rating":{"type":"object","properties":{"averageRating":{"type":"integer"},"reviewCount":{"type":"integer"}},"required":["averageRating","reviewCount"]},"landlordKYCStatus":{"type":"string"},"legalStatus":{"type":"string"},"activeLegalAssignmentId":{"nullable":true},"deletedAt":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","landlordId","agentId","title","description","type","status","location","details","pricing","availability","shortLet","amenities","media","verification","rating","landlordKYCStatus","legalStatus","activeLegalAssignmentId","deletedAt","createdAt","updatedAt","__v"]}},"total":{"type":"integer"},"page":{"type":"integer"},"limit":{"type":"integer"}},"required":["properties","total","page","limit"]}},"required":["success","data"]},"examples":{"default":{"value":{"success":true,"data":{"properties":[{"_id":"665f1c2e9b1d4a0012ab34cd","landlordId":{"_id":"664a0b7e2f8c3d0011aa22bb","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/chinedu.jpg"},"agentId":null,"title":"Serviced 3-bedroom apartment in Lekki Phase 1","description":"Spacious serviced 3-bedroom apartment with a fitted kitchen, 24-hour power and secure parking, five minutes from Admiralty Way.","type":"APARTMENT","status":"listed","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1800,"features":["Fitted kitchen","En-suite rooms"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"availability":{"availableFrom":"2026-12-01T00:00:00.000Z","bookingCalendar":[]},"shortLet":{"minNights":1,"bookedRanges":[]},"amenities":["wifi","parking","Borehole"],"media":{"images":[{"url":"https://res.cloudinary.com/homelinkhub/image/upload/v1764061200/homelinkhub/media/lekki-3bed-living.jpg","metadata":{"address":"12 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"gps":[3.4725,6.4476],"tag":"Living Room"},"_id":"665f1c2e9b1d4a0012ab34ce"}],"videos":[]},"verification":{"isVerified":true,"verifiedAt":"2026-11-20T10:15:00.000Z","verifiedBy":"664e4f1c6d2a7b0015ee66ff"},"rating":{"averageRating":0,"reviewCount":0},"landlordKYCStatus":"VERIFIED","legalStatus":"legally_verified","activeLegalAssignmentId":null,"deletedAt":null,"createdAt":"2026-11-18T09:30:00.000Z","updatedAt":"2026-11-20T10:15:00.000Z","__v":0}],"total":1,"page":1,"limit":20}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/wishlist/check/{propertyId}":{"get":{"tags":["wishlist"],"operationId":"wishlist_get_check_property_id","summary":"Check if a listing is in my wishlist","description":"**Access:** Bearer token required.\n\nReports whether a property is in the caller's wishlist. **The handler does not read the path parameter.** It reads `propertyId` from the query string, so the id must be sent as `?propertyId=...`; the path segment is required for routing but its value is ignored. Calling the URL with only the path parameter returns `400 Property ID is required`. A malformed or unknown id simply returns `inWishlist: false`.\n\nThe success response does not use the standard envelope: there is no `status` and no `message`.","security":[{"bearerAuth":[]}],"x-doc-slug":"wishlist/get-check-property-id","x-short":"Reports whether a property is in the caller's wishlist.","parameters":[{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"},"description":"Required by the route but ignored by the handler. Send the same id in the `propertyId` query parameter."},{"name":"propertyId","in":"query","required":true,"schema":{"type":"string"},"description":"Required by the route but ignored by the handler. Send the same id in the `propertyId` query parameter."}],"responses":{"200":{"description":"Whether the property id given in the query string is in the caller's wishlist.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"inWishlist":{"type":"boolean"}},"required":["inWishlist"]}},"required":["success","data"]},"examples":{"default":{"value":{"success":true,"data":{"inWishlist":true}}}}}}},"400":{"description":"The `propertyId` query parameter is missing (even if the path parameter is present).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Property ID is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/dashboard/stats":{"get":{"tags":["dashboard"],"operationId":"dashboard_get_stats","summary":"Get dashboard stat cards","description":"**Access:** Bearer token required.\n\nReturns the headline counters for the agent/landlord dashboard, computed over the properties the caller owns, meaning the caller is the property's `landlordId` (creator) or its assigned `agentId`.\n\n`totalListings` counts every such property in any status (drafts included; the query does not filter out soft-deleted listings either),`listingsThisMonth` those created since the 1st of the current month (UTC), and `activeListings` those with status `listed`. `pendingRequests` is the number of inspections on those properties in `scheduled` or `pending_review`. `successfulClosings` counts properties in `rented` or `sold`, and `closingsVolume` adds up the listed `pricing.rentPrice` and `pricing.salePrice` of those properties (asking prices, not money actually received). There is no role check: any authenticated user can call it and gets zeros if they own nothing.","security":[{"bearerAuth":[]}],"x-doc-slug":"dashboard/get-stats","x-short":"Returns the headline counters for the agent/landlord dashboard, computed over the properties the caller owns, meaning the caller is the property's landlordId (creator) or its as...","responses":{"200":{"description":"The stat card values.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"totalListings":{"type":"integer"},"listingsThisMonth":{"type":"integer"},"activeListings":{"type":"integer"},"pendingRequests":{"type":"integer"},"successfulClosings":{"type":"integer"},"closingsVolume":{"type":"integer"}},"required":["totalListings","listingsThisMonth","activeListings","pendingRequests","successfulClosings","closingsVolume"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Dashboard stats fetched successfully","data":{"totalListings":18,"listingsThisMonth":3,"activeListings":11,"pendingRequests":4,"successfulClosings":5,"closingsVolume":131500000}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/dashboard/performance":{"get":{"tags":["dashboard"],"operationId":"dashboard_get_performance","summary":"Get views and inquiries chart data","description":"**Access:** Bearer token required.\n\nReturns the area-chart series for the caller's properties (those where they are `landlordId` or `agentId`). With `view=weekly` (the default, also used for any unrecognised value) the array has seven points, `MON` to `SUN`, covering the current Monday-to-Sunday week in UTC; with `view=monthly` it has twelve points, `JAN` to `DEC`, covering the current calendar year to date. The success message differs between the two.\n\n`views` counts recorded property views in the period (a view is stored at most once per user per property per day) and `inquiries` counts inspection requests created in the period. Days or months with no data are returned as zeros.\n\nKnown quirk in the weekly series: the inquiry day label is computed by indexing a Sunday-first label list with MongoDB's 1-based `$dayOfWeek`, so inquiries are reported one day late (Monday's under `TUE`, Sunday's under `MON`) and inquiries created on a Saturday are not counted. `views` and the monthly series are unaffected.","security":[{"bearerAuth":[]}],"x-doc-slug":"dashboard/get-performance","x-short":"Returns the area-chart series for the caller's properties (those where they are landlordId or agentId).","parameters":[{"name":"view","in":"query","required":false,"schema":{"type":"string","default":"weekly"},"description":"`weekly` or `monthly`. Anything other than `monthly` is treated as `weekly`."}],"responses":{"200":{"description":"- Weekly series (default): seven points, `MON` to `SUN`.\n- Monthly series (`view=monthly`): twelve points, `JAN` to `DEC`.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"views":{"type":"integer"},"inquiries":{"type":"integer"}},"required":["name","views","inquiries"]}}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"Weekly series (default): seven points, `MON` to `SUN`.","value":{"status":200,"success":true,"message":"Weekly performance fetched successfully","data":[{"name":"MON","views":42,"inquiries":3}]}},"example2":{"summary":"Monthly series (`view=monthly`): twelve points, `JAN` to `DEC`.","value":{"status":200,"success":true,"message":"Monthly performance fetched successfully","data":[{"name":"JAN","views":310,"inquiries":17}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/dashboard/listing-overview":{"get":{"tags":["dashboard"],"operationId":"dashboard_get_listing_overview","summary":"Get listing count by status","description":"**Access:** Bearer token required.\n\nReturns pie-chart data: how many of the caller's properties (as `landlordId` or `agentId`) are in each status. Only statuses that have at least one property appear, in no guaranteed order, and an empty array is returned when the caller owns nothing.\n\nStatuses are mapped to display labels: `listed` to `Active`, `pending_verification` to `Pending`, `sold` to `Sold`, `rented` to `Rented`, `unlisted` to `Inactive`. Any other status is returned under its raw value, so drafts appear as `draft`. Soft-deleted listings are not filtered out of the counts.","security":[{"bearerAuth":[]}],"x-doc-slug":"dashboard/get-listing-overview","x-short":"Returns pie-chart data: how many of the caller's properties (as landlordId or agentId) are in each status.","responses":{"200":{"description":"One `{ label, value }` entry per status in use.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"integer"}},"required":["label","value"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Listing overview fetched successfully","data":[{"label":"Active","value":11}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/dashboard/recent-activity":{"get":{"tags":["dashboard"],"operationId":"dashboard_get_recent_activity","summary":"Get recent activity feed","description":"**Access:** Bearer token required.\n\nReturns up to 10 of the most recent events around the caller's properties, newest first, merged from four sources (at most 5 of each): `message` (chat rooms the caller participates in that have a last message; `text` is that message and `property` is the referenced property's title or, failing that, the room name), `inspection` (open inspections in `scheduled` or `pending_review` on the caller's properties; `actor` is the assigned inspector or `Unassigned`), `booking` (bookings on the caller's properties; `actor` is the tenant) and `review` (reviews of the caller's properties, with `rating`).\n\nEvery item has `type`, `actor` (a display name; `Unknown` or `Anonymous` when the user record is gone), `property` (a title string, `Unknown` when missing) and `time`. `text` is present only on messages and `rating` only on reviews. A message item can be the caller's own last message. No ids are returned, so items cannot be linked to their records from this response alone.","security":[{"bearerAuth":[]}],"x-doc-slug":"dashboard/get-recent-activity","x-short":"Returns up to 10 of the most recent events around the caller's properties, newest first, merged from four sources (at most 5 of each): message (chat rooms the caller participate...","responses":{"200":{"description":"The merged feed (empty array when there is no activity).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"actor":{"type":"string"},"text":{"type":"string"},"property":{"type":"string"},"time":{"type":"string","format":"date-time"}},"required":["type","actor","text","property","time"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Recent activity fetched successfully","data":[{"type":"message","actor":"Chinedu Okafor","text":"Is the duplex still available for viewing this Saturday?","property":"4 Bedroom Duplex, Lekki Phase 1","time":"2026-11-25T08:47:12.000Z"}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/dashboard/earnings":{"get":{"tags":["dashboard"],"operationId":"dashboard_get_earnings","summary":"Get agent earnings totals","description":"**Access:** Bearer token required.\n\nReturns flat lifetime totals for the dashboard tiles, covering only what the caller earned **as an agent**: `inspectionEarnings` is the sum of `agentFee` over paid inspections assigned to them (`inspectionCount` of them, whatever the inspection's status), and `acquisitionEarnings` is the sum of `agentCommission` over completed `purchase` escrows on which they are the listing agent (`acquisitionCount`). `totalEarnings` is the two added together.\n\nSeller proceeds, short-let income, withdrawals and balances are not included. For those, and for the per-transaction list, use `GET /earnings` and `GET /earnings/wallet`; the two endpoints have different response shapes and are not interchangeable. Amounts are in naira.","security":[{"bearerAuth":[]}],"x-doc-slug":"dashboard/get-earnings","x-short":"Returns flat lifetime totals for the dashboard tiles, covering only what the caller earned as an agent: inspectionEarnings is the sum of agentFee over paid inspections assigned...","responses":{"200":{"description":"The totals (all zeros when the caller has no agent earnings).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"totalEarnings":{"type":"integer"},"inspectionEarnings":{"type":"integer"},"inspectionCount":{"type":"integer"},"acquisitionEarnings":{"type":"integer"},"acquisitionCount":{"type":"integer"}},"required":["totalEarnings","inspectionEarnings","inspectionCount","acquisitionEarnings","acquisitionCount"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Agent earnings fetched successfully","data":{"totalEarnings":2265000,"inspectionEarnings":15000,"inspectionCount":3,"acquisitionEarnings":2250000,"acquisitionCount":1}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/dashboard/analytics":{"get":{"tags":["dashboard"],"operationId":"dashboard_get_analytics","summary":"Get analytics screen data","description":"**Access:** Bearer token required.\n\nReturns everything the analytics screen renders in one call. A deal counts for the caller when they are the escrow's seller or its listing agent, and \"closed\" always means an escrow in `completed`; deals are bucketed by the escrow's creation date (UTC).\n\n`stats`: `totalRevenue` is the net amount (after platform fee and agent commission) of deals closed this calendar year and `propertiesSold` their count, each with a percentage change against last year; `activeLeads` is the number of open inspections (`scheduled`, `pending_review`, `in_progress`) on the caller's properties, compared with the number of inspections created last month; `avgDaysToClose` is the mean days from escrow creation to completion over all closed deals. A `...Change` value is `null` when there is no previous figure to compare with.\n\n`volumeByMonth` always has twelve entries (`JAN` to `DEC`) with the gross value closed that month and `type`, the category that contributed most (`residential` when the month is empty). `categories` groups property types into `residential` (APARTMENT, HOUSE, SHORTLET), `luxury` (VILLA) and `commercial` (LAND, COMMERCIAL, OFFICE) and reports units sold this year, live `listed` inventory, average gross price and growth against last year; only categories with inventory or sales appear. `topPerformer` is the caller's most-viewed property, or `null` when they own none.","security":[{"bearerAuth":[]}],"x-doc-slug":"dashboard/get-analytics","x-short":"Returns everything the analytics screen renders in one call.","responses":{"200":{"description":"The analytics payload. `topPerformer.location` is the property's full location object; `price` is the sale price, else the rent price, else 0.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"stats":{"type":"object","properties":{"totalRevenue":{"type":"integer"},"totalRevenueChange":{"type":"number"},"propertiesSold":{"type":"integer"},"propertiesSoldChange":{"type":"integer"},"activeLeads":{"type":"integer"},"activeLeadsChange":{"type":"integer"},"avgDaysToClose":{"type":"integer"},"currency":{"type":"string"}},"required":["totalRevenue","totalRevenueChange","propertiesSold","propertiesSoldChange","activeLeads","activeLeadsChange","avgDaysToClose","currency"]},"volumeByMonth":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"value":{"type":"integer"},"type":{"type":"string"}},"required":["month","value","type"]}},"categories":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string"},"label":{"type":"string"},"sold":{"type":"integer"},"inventory":{"type":"integer"},"avgPrice":{"type":"integer"},"growth":{"nullable":true}},"required":["category","label","sold","inventory","avgPrice","growth"]}},"topPerformer":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"category":{"type":"string"},"image":{"type":"string"},"views":{"type":"integer"},"price":{"type":"integer"},"currency":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]}},"required":["_id","title","type","category","image","views","price","currency","location"]}},"required":["stats","volumeByMonth","categories","topPerformer"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Analytics fetched successfully","data":{"stats":{"totalRevenue":43110000,"totalRevenueChange":18.5,"propertiesSold":2,"propertiesSoldChange":100,"activeLeads":4,"activeLeadsChange":-20,"avgDaysToClose":6,"currency":"NGN"},"volumeByMonth":[{"month":"JAN","value":0,"type":"residential"}],"categories":[{"category":"residential","label":"Residential","sold":2,"inventory":9,"avgPrice":22906800,"growth":null}],"topPerformer":{"_id":"665e0a7b9b1d4a0012ab1f02","title":"4 Bedroom Duplex, Lekki Phase 1","type":"HOUSE","category":"residential","image":"https://res.cloudinary.com/homelinkhub/image/upload/v1717400000/properties/duplex-front.jpg","views":1284,"price":45000000,"currency":"NGN","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"12 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}}}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/partnership-invites/email":{"post":{"tags":["legal"],"operationId":"legal_post_partnership_invites_email","summary":"Invite a lawyer to partner","description":"**Access:** Bearer token required. **Roles:** `AGENT`, `ADMIN`, `LANDLORD`.\n\nSends a partnership invite to a lawyer who is **already registered** on the platform with role `LAWYER`; the email is trimmed and lower-cased before the lookup. A `LegalPartnershipInvite` is created with status `invite_pending`, and the lawyer is emailed (\"You've Been Invited to Partner on HomeLink Hub\") with the inviter's name, the note and a link to their invites page. The email is fire-and-forget: a mail failure does not fail the request. No in-app notification or socket event is emitted. The lawyer must accept (status `contracted`) before the inviter can assign them to a property. An inviter can have only one `invite_pending` or `contracted` invite per lawyer; after a rejection a new invite may be sent. `inviteNote` is limited to 2000 characters by the model, but that is enforced by Mongoose, so an over-long note fails as a 500 rather than a 400. Any unexpected error inside the legal service (including a Mongoose cast or validation failure) is re-thrown as a 500 carrying the underlying error's message plus an `errorData` field holding the serialized underlying error.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/post-partnership-invites-email","x-short":"Sends a partnership invite to a lawyer who is already registered on the platform with role LAWYER; the email is trimmed and lower-cased before the lookup.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","description":"Email address of a registered user whose role is `LAWYER`."},"inviteNote":{"type":"string","description":"Optional message shown to the lawyer in the invite email. Max 2000 characters."}},"required":["email"]},"examples":{"default":{"value":{"email":"folake.adeyemi@example.com","inviteNote":"We list 10-15 Lekki properties a month and need title verification."}}}}}},"responses":{"201":{"description":"Invite created and emailed","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"inviterId":{"type":"string"},"lawyerId":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"inviteNote":{"type":"string"},"invitedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","inviterId","lawyerId","email","status","inviteNote","invitedAt","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":201,"success":true,"message":"Invite sent successfully","data":{"_id":"6660a7d49b1d4a0012ab3510","inviterId":"665f1c2e9b1d4a0012ab34c1","lawyerId":"665f1c2e9b1d4a0012ab34c3","email":"folake.adeyemi@example.com","status":"invite_pending","inviteNote":"We list 10-15 Lekki properties a month and need title verification.","invitedAt":"2026-06-04T09:15:22.481Z","createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}}}}}}},"400":{"description":"`email` is missing or blank","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Lawyer email is required","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: AGENT, ADMIN, LANDLORD. You have role: TENANT","data":null}}}}}},"404":{"description":"No user has that email, or the user is not a `LAWYER`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"No registered lawyer found with this email","data":null}}}}}},"409":{"description":"- The caller already has an accepted partnership with this lawyer\n- The caller already has a pending invite to this lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"The caller already has an accepted partnership with this lawyer","value":{"status":409,"success":false,"message":"Lawyer is already contracted with you","data":null}},"example2":{"summary":"The caller already has a pending invite to this lawyer","value":{"status":409,"success":false,"message":"An invite is already pending for this lawyer","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/partners":{"get":{"tags":["legal"],"operationId":"legal_get_partners","summary":"List my partner lawyers","description":"**Access:** Bearer token required. **Roles:** `AGENT`, `ADMIN`, `LANDLORD`.\n\nThe caller's own invites that are `invite_pending` or `contracted` (rejected invites are left out), newest first. Despite the field name, `lawyerId` is an **object**: the lawyer's public profile plus two computed stats. `mattersHandled` counts that lawyer's assignments with status `changes_requested`, `verified` or `rejected`; `responseRate` is the whole-number percentage of their assignments that reached `accepted`, `in_review`, `changes_requested`, `verified` or `rejected` (0 when they have none). Both stats cover the lawyer's assignments from **all** listers, not only the caller's. `location` is the lawyer's `address.state` and `address.country` joined with a comma, omitted when neither is set. `profileImage` is declared in the response type but the User model has no such field, so it is never present. Only `contracted` lawyers can be assigned to a property.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/get-partners","x-short":"The caller's own invites that are invitepending or contracted (rejected invites are left out), newest first.","responses":{"200":{"description":"Pending and contracted partners","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"inviterId":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"inviteNote":{"type":"string"},"invitedAt":{"type":"string","format":"date-time"},"acceptedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lawyerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"avatar":{"type":"string"},"bio":{"type":"string"},"location":{"type":"string"},"mattersHandled":{"type":"integer"},"responseRate":{"type":"integer"}},"required":["_id","firstName","lastName","email","avatar","bio","location","mattersHandled","responseRate"]}},"required":["_id","inviterId","email","status","inviteNote","invitedAt","acceptedAt","createdAt","updatedAt","lawyerId"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Partner lawyers fetched successfully","data":[{"_id":"6660a7d49b1d4a0012ab3510","inviterId":"665f1c2e9b1d4a0012ab34c1","email":"folake.adeyemi@example.com","status":"contracted","inviteNote":"We list 10-15 Lekki properties a month and need title verification.","invitedAt":"2026-06-04T09:15:22.481Z","acceptedAt":"2026-06-05T14:02:10.107Z","createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","lawyerId":{"_id":"665f1c2e9b1d4a0012ab34c3","firstName":"Folake","lastName":"Adeyemi","email":"folake.adeyemi@example.com","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/folake.jpg","bio":"Property and conveyancing lawyer, called to the Nigerian Bar in 2012.","location":"Lagos, Nigeria","mattersHandled":24,"responseRate":92}}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: AGENT, ADMIN, LANDLORD. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/partnership-invites":{"get":{"tags":["legal"],"operationId":"legal_get_partnership_invites","summary":"List my pending partnership invites","description":"**Access:** Bearer token required. **Roles:** `LAWYER`.\n\nFor lawyers: the invites addressed to the caller that are still `invite_pending`, newest first. Accepted and rejected invites are not returned. `inviterId` is populated with the inviting agent, landlord or admin's profile (`firstName`, `lastName`, `email`, `role`, `avatar`, `phone`, `bio`, `businessName`, `address`); unset profile fields are absent.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/get-partnership-invites","x-short":"For lawyers: the invites addressed to the caller that are still invitepending, newest first.","responses":{"200":{"description":"Pending invites","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"inviterId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"},"businessName":{"type":"string"},"bio":{"type":"string"},"address":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"}},"country":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"}},"required":["addresses","country","state","postalCode"]}},"required":["_id","firstName","lastName","email","phone","avatar","role","businessName","bio","address"]},"lawyerId":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"inviteNote":{"type":"string"},"invitedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","inviterId","lawyerId","email","status","inviteNote","invitedAt","createdAt","updatedAt","__v"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Lawyer invites fetched successfully","data":[{"_id":"6660a7d49b1d4a0012ab3510","inviterId":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","email":"chinedu.okafor@example.com","phone":"+2348031234567","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT","businessName":"Okafor Realty","bio":"Lekki and Ikoyi lettings specialist.","address":{"addresses":["14 Admiralty Way, Lekki Phase 1"],"country":"Nigeria","state":"Lagos","postalCode":"105102"}},"lawyerId":"665f1c2e9b1d4a0012ab34c3","email":"folake.adeyemi@example.com","status":"invite_pending","inviteNote":"We list 10-15 Lekki properties a month and need title verification.","invitedAt":"2026-06-04T09:15:22.481Z","createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}]}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: LAWYER. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/partnership-invites/{inviteId}/accept":{"patch":{"tags":["legal"],"operationId":"legal_patch_partnership_invites_invite_id_accept","summary":"Accept a partnership invite","description":"**Access:** Bearer token required. **Roles:** `LAWYER`. **Also requires:** Caller must be the lawyer the invite is addressed to.\n\nThe invited lawyer accepts: the invite moves `invite_pending` -> `contracted` and `acceptedAt` is set. From then on the inviter can assign this lawyer to their properties. The inviter is emailed (\"Your Legal Partnership Invite Was Accepted\", fire-and-forget); no in-app notification or socket event is emitted. No request body. `data` is the updated invite with unpopulated ids. A malformed `inviteId` is not validated up front and surfaces as a 500. Any unexpected error inside the legal service (including a Mongoose cast or validation failure) is re-thrown as a 500 carrying the underlying error's message plus an `errorData` field holding the serialized underlying error.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/patch-partnership-invites-invite-id-accept","x-short":"The invited lawyer accepts: the invite moves invitepending -> contracted and acceptedAt is set.","parameters":[{"name":"inviteId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the partnership invite."}],"responses":{"200":{"description":"Invite accepted","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"inviterId":{"type":"string"},"lawyerId":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"inviteNote":{"type":"string"},"invitedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"acceptedAt":{"type":"string","format":"date-time"}},"required":["_id","inviterId","lawyerId","email","status","inviteNote","invitedAt","createdAt","updatedAt","__v","acceptedAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Invite accepted successfully","data":{"_id":"6660a7d49b1d4a0012ab3510","inviterId":"665f1c2e9b1d4a0012ab34c1","lawyerId":"665f1c2e9b1d4a0012ab34c3","email":"folake.adeyemi@example.com","status":"contracted","inviteNote":"We list 10-15 Lekki properties a month and need title verification.","invitedAt":"2026-06-04T09:15:22.481Z","createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0,"acceptedAt":"2026-06-05T14:02:10.107Z"}}}}}}},"400":{"description":"The invite is already `contracted` or `rejected`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invite has already been processed","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The invite is addressed to a different lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have access to this invite","data":null}}}}}},"404":{"description":"No invite with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Invite not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/partnership-invites/{inviteId}/reject":{"patch":{"tags":["legal"],"operationId":"legal_patch_partnership_invites_invite_id_reject","summary":"Reject a partnership invite","description":"**Access:** Bearer token required. **Roles:** `LAWYER`. **Also requires:** Caller must be the lawyer the invite is addressed to.\n\nThe invited lawyer declines: the invite moves `invite_pending` -> `rejected` and `rejectedAt` is set. The inviter is **not** emailed or notified. A rejected invite no longer blocks the inviter from sending a new one to the same lawyer. No request body. A malformed `inviteId` surfaces as a 500. Any unexpected error inside the legal service (including a Mongoose cast or validation failure) is re-thrown as a 500 carrying the underlying error's message plus an `errorData` field holding the serialized underlying error.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/patch-partnership-invites-invite-id-reject","x-short":"The invited lawyer declines: the invite moves invitepending -> rejected and rejectedAt is set.","parameters":[{"name":"inviteId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the partnership invite."}],"responses":{"200":{"description":"Invite rejected","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"inviterId":{"type":"string"},"lawyerId":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"inviteNote":{"type":"string"},"invitedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"rejectedAt":{"type":"string","format":"date-time"}},"required":["_id","inviterId","lawyerId","email","status","inviteNote","invitedAt","createdAt","updatedAt","__v","rejectedAt"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Invite rejected successfully","data":{"_id":"6660a7d49b1d4a0012ab3510","inviterId":"665f1c2e9b1d4a0012ab34c1","lawyerId":"665f1c2e9b1d4a0012ab34c3","email":"folake.adeyemi@example.com","status":"rejected","inviteNote":"We list 10-15 Lekki properties a month and need title verification.","invitedAt":"2026-06-04T09:15:22.481Z","createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0,"rejectedAt":"2026-06-05T14:02:10.107Z"}}}}}}},"400":{"description":"The invite is already `contracted` or `rejected`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Only pending invites can be rejected","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The invite is addressed to a different lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have access to this invite","data":null}}}}}},"404":{"description":"No invite with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Invite not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/properties/{propertyId}/assign-lawyer":{"post":{"tags":["legal"],"operationId":"legal_post_properties_property_id_assign_lawyer","summary":"Assign a lawyer to a property","description":"**Access:** Bearer token required. **Roles:** `AGENT`, `ADMIN`, `LANDLORD`. **Also requires:** Caller is the property's agent or landlord, or an admin; Caller has a contracted partnership with the lawyer; Property has no active legal assignment.\n\nOpens a legal verification assignment for a property. The caller must be the property's agent or landlord, or an admin, **and** must have a `contracted` partnership with the lawyer; that partnership check applies to admins too. A property can have only one active assignment (`assigned`, `accepted`, `in_review`, `changes_requested`); use the reassign endpoint to change lawyer. On success the assignment is created with status `assigned`, a `mediaSnapshot` freezing the property's current images and videos is stored on it, the property's `legalStatus` becomes `under_legal_review` and its `activeLegalAssignmentId` points at the new assignment, and a `lawyer_assigned` entry is written to the legal audit log. The lawyer is notified through the notification service (event `lawyer_assigned`, title \"New Legal Assignment\"): a stored in-app notification with a `notifications:new` socket event to their personal room, a push notification, and an email (\"New Legal Assignment on HomeLink Hub\"), each subject to their `lawyerVerificationUpdates` preferences. `data` is the new assignment with unpopulated ids.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/post-properties-property-id-assign-lawyer","x-short":"Opens a legal verification assignment for a property.","parameters":[{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property to verify."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lawyerId":{"type":"string","description":"ObjectId of a user with role `LAWYER` who has accepted the caller's partnership invite."},"notes":{"type":"string","description":"Instructions for the lawyer. Max 5000 characters (model limit)."},"dueDate":{"type":"string","description":"Date the review is due, in any format JavaScript `new Date()` parses (ISO 8601 recommended)."}},"required":["lawyerId"]},"examples":{"default":{"value":{"lawyerId":"665f1c2e9b1d4a0012ab34c3","notes":"Please confirm the C of O and survey plan.","dueDate":"2026-06-12T17:00:00.000Z"}}}}}},"responses":{"201":{"description":"Assignment created","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"lawyerId":{"type":"string"},"assignedBy":{"type":"string"},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":201,"success":true,"message":"Lawyer assigned successfully","data":{"_id":"6660a7d49b1d4a0012ab3501","propertyId":"665f1c2e9b1d4a0012ab34cd","lawyerId":"665f1c2e9b1d4a0012ab34c3","assignedBy":"665f1c2e9b1d4a0012ab34c1","mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"assigned","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}}}}}}},"400":{"description":"- `lawyerId` missing from the body\n- `propertyId` is not a valid ObjectId\n- `lawyerId` is not a valid ObjectId\n- The user exists but their role is not `LAWYER`\n- The caller has no `contracted` partnership with this lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`lawyerId` missing from the body","value":{"status":400,"success":false,"message":"Lawyer ID is required","data":null}},"example2":{"summary":"`propertyId` is not a valid ObjectId","value":{"status":400,"success":false,"message":"Invalid property ID","data":null}},"example3":{"summary":"`lawyerId` is not a valid ObjectId","value":{"status":400,"success":false,"message":"Invalid lawyer ID","data":null}},"example4":{"summary":"The user exists but their role is not `LAWYER`","value":{"status":400,"success":false,"message":"Selected user is not a lawyer","data":null}},"example5":{"summary":"The caller has no `contracted` partnership with this lawyer","value":{"status":400,"success":false,"message":"Lawyer is not contracted with you yet. Send an invite and wait for acceptance before assignment.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"Caller is not the property's agent or landlord and is not an admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to assign a lawyer to this property","data":null}}}}}},"404":{"description":"- No property with that id\n- No user with the given `lawyerId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No property with that id","value":{"status":404,"success":false,"message":"Property not found","data":null}},"example2":{"summary":"No user with the given `lawyerId`","value":{"status":404,"success":false,"message":"Lawyer user not found","data":null}}}}}},"409":{"description":"The property already has an assignment in `assigned`, `accepted`, `in_review` or `changes_requested`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":409,"success":false,"message":"Property already has an active legal assignment. Please reassign instead.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/assignments/{assignmentId}/reassign":{"patch":{"tags":["legal"],"operationId":"legal_patch_assignments_assignment_id_reassign","summary":"Reassign a legal review to another lawyer","description":"**Access:** Bearer token required. **Roles:** `AGENT`, `ADMIN`, `LANDLORD`. **Also requires:** Caller is the property's agent or landlord, or an admin.\n\nCloses an existing assignment and opens a new one for a different lawyer on the same property. The old assignment's status becomes `reassigned`; a new assignment is created with status `assigned`, a fresh `mediaSnapshot` of the property's current media, and the caller as `assignedBy`. The property's `activeLegalAssignmentId` is moved to the new assignment, a `lawyer_reassigned` audit entry is written, and the new lawyer gets the same `lawyer_assigned` notification (in-app + `notifications:new` socket event, push, email) as a first assignment. Things this handler does **not** do, unlike assign: it does not require a contracted partnership with the new lawyer; it does not check that the old assignment is still open (a `verified` or `rejected` assignment can be reassigned and is overwritten to `reassigned`); it does not copy the old `notes`, `dueDate` or submitted documents; it does not change the property's `legalStatus`; and it does not notify the previous lawyer. `data` is the **new** assignment with unpopulated ids. A malformed `lawyerId` surfaces as a 500. Any unexpected error inside the legal service (including a Mongoose cast or validation failure) is re-thrown as a 500 carrying the underlying error's message plus an `errorData` field holding the serialized underlying error.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/patch-assignments-assignment-id-reassign","x-short":"Closes an existing assignment and opens a new one for a different lawyer on the same property.","parameters":[{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the assignment to replace."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lawyerId":{"type":"string","description":"ObjectId of the lawyer taking over. Must be a user with role `LAWYER`."}},"required":["lawyerId"]},"examples":{"default":{"value":{"lawyerId":"665f1c2e9b1d4a0012ab34c5"}}}}}},"responses":{"200":{"description":"New assignment created; the old one is now `reassigned`","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"lawyerId":{"type":"string"},"assignedBy":{"type":"string"},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Lawyer reassigned successfully","data":{"_id":"6660a7d49b1d4a0012ab3502","propertyId":"665f1c2e9b1d4a0012ab34cd","lawyerId":"665f1c2e9b1d4a0012ab34c5","assignedBy":"665f1c2e9b1d4a0012ab34c1","mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"assigned","decision":{"checklist":[]},"documentSubmissions":[],"createdAt":"2026-06-05T14:02:10.107Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0}}}}}}},"400":{"description":"- `lawyerId` missing from the body\n- `assignmentId` is not a valid ObjectId","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`lawyerId` missing from the body","value":{"status":400,"success":false,"message":"New lawyer ID is required","data":null}},"example2":{"summary":"`assignmentId` is not a valid ObjectId","value":{"status":400,"success":false,"message":"Invalid assignment ID","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"Caller is not the property's agent or landlord and is not an admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to reassign this legal assignment","data":null}}}}}},"404":{"description":"- No assignment with that id\n- The assignment's property no longer exists\n- No user with the given `lawyerId`, or the user is not a `LAWYER`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No assignment with that id","value":{"status":404,"success":false,"message":"Assignment not found","data":null}},"example2":{"summary":"The assignment's property no longer exists","value":{"status":404,"success":false,"message":"Property not found","data":null}},"example3":{"summary":"No user with the given `lawyerId`, or the user is not a `LAWYER`","value":{"status":404,"success":false,"message":"New lawyer user not found or is not a lawyer","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/properties/{propertyId}/history":{"get":{"tags":["legal"],"operationId":"legal_get_properties_property_id_history","summary":"Get a property's legal assignment history","description":"**Access:** Bearer token required. **Roles:** `AGENT`, `ADMIN`, `LANDLORD`.\n\nEvery legal assignment ever opened for the property (including `reassigned` ones), newest first, with `lawyerId` and `assignedBy` populated (`firstName`, `lastName`, `avatar`, `role`) and each document submission's `submittedBy` populated (`firstName`, `lastName`). The route is limited to the `AGENT`, `LANDLORD` and `ADMIN` roles, but the handler does **not** check that the caller owns or manages the property: any user with one of those roles can read the legal history of any property by id. An unknown property id returns an empty array, not a 404.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/get-properties-property-id-history","x-short":"Every legal assignment ever opened for the property (including reassigned ones), newest first, with lawyerId and assignedBy populated (firstName, lastName, avatar, role) and eac...","parameters":[{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the property."}],"responses":{"200":{"description":"Assignments for the property, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"lawyerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","avatar","role"]},"assignedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"},"role":{"type":"string"}},"required":["_id","firstName","lastName","avatar","role"]},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"outcome":{"type":"string"},"notes":{"type":"string"},"checklist":{"type":"array","items":{"type":"object","properties":{"item":{"type":"string"},"status":{"type":"string"},"comment":{"type":"string"},"_id":{"type":"string"}},"required":["item","status","comment","_id"]}},"decidedAt":{"type":"string","format":"date-time"}},"required":["outcome","notes","checklist","decidedAt"]},"documentSubmissions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"documents":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"name":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"integer"}},"required":["url","name","mimeType","size"]}},"note":{"type":"string"},"submittedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["_id","firstName","lastName"]},"submittedAt":{"type":"string","format":"date-time"}},"required":["_id","documents","note","submittedBy","submittedAt"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Legal history fetched successfully","data":[{"_id":"6660a7d49b1d4a0012ab3501","propertyId":"665f1c2e9b1d4a0012ab34cd","lawyerId":{"_id":"665f1c2e9b1d4a0012ab34c3","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/folake.jpg","role":"LAWYER"},"assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg","role":"AGENT"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"verified","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"outcome":"verified","notes":"Certificate of Occupancy and survey plan confirmed against the Lagos State Lands Registry.","checklist":[{"item":"Certificate of Occupancy","status":"pass","comment":"Registered, no encumbrance","_id":"6660a7d49b1d4a0012ab3580"}],"decidedAt":"2026-06-06T10:30:00.000Z"},"documentSubmissions":[{"_id":"6660a7d49b1d4a0012ab3505","documents":[{"url":"https://res.cloudinary.com/example/raw/upload/v1717600000/homelinkhub/media/certificate-of-occupancy.pdf","name":"certificate-of-occupancy.pdf","mimeType":"application/pdf","size":482113}],"note":"C of O attached as requested.","submittedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"submittedAt":"2026-06-05T14:02:10.107Z"}],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-06T10:30:00.000Z","__v":2}]}}}}}},"400":{"description":"`propertyId` is not a valid ObjectId","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid property ID","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: AGENT, ADMIN, LANDLORD. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/assignments/{assignmentId}/documents":{"post":{"tags":["legal"],"operationId":"legal_post_assignments_assignment_id_documents","summary":"Send documents to the reviewing lawyer","description":"**Access:** Bearer token required. **Roles:** `AGENT`, `ADMIN`, `LANDLORD`. **Also requires:** Caller assigned the lawyer, or is the property's agent or landlord, or is an admin; Assignment status is `assigned`, `accepted`, `in_review` or `changes_requested`.\n\nThe lister uploads supporting documents for an open legal review. Send `multipart/form-data` with one or more files under the field name `documents` and an optional text field `note`. Up to **10** files per request, 10 MB each; allowed extensions are `jpg`, `jpeg`, `png`, `gif`, `pdf`, `doc`, `docx`, `xls`, `xlsx`, `ppt`, `pptx`, `txt`. Files are uploaded to Cloudinary by the upload middleware **before** the handler validates anything, so a request rejected afterwards has still stored its files. The caller must be the user who assigned the lawyer, the property's agent or landlord, or an admin. The batch is appended to `documentSubmissions` (each file as `url`, `name`, `mimeType`, `size`). If the assignment was `changes_requested`, this is the answer to that request: the assignment returns to `in_review` and the property's `legalStatus` to `under_legal_review`; in `assigned`, `accepted` or `in_review` the documents are simply added. A `documents_submitted` audit entry is written and the lawyer is notified (event `lawyer_documents_submitted`, title \"New Documents to Review\": in-app + `notifications:new` socket event, push, and email \"New Documents to Review on HomeLink Hub\"). `data` is the updated assignment with unpopulated ids. Upload-middleware failures are not converted to 4xx: they reach the error handler as 500s.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/post-assignments-assignment-id-documents","x-short":"The lister uploads supporting documents for an open legal review.","parameters":[{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the legal assignment the documents are for."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"documents":{"contentMediaType":"application/octet-stream","description":"One to ten files (repeat the field for each file). 10 MB per file; jpg, jpeg, png, gif, pdf, doc, docx, xls, xlsx, ppt, pptx or txt."},"note":{"type":"string","description":"Optional message to the lawyer. Trimmed; max 2000 characters (model limit)."}},"required":["documents"]}}}},"responses":{"201":{"description":"Documents stored and the lawyer notified","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"string"},"lawyerId":{"type":"string"},"assignedBy":{"type":"string"},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"documents":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"name":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"integer"}},"required":["url","name","mimeType","size"]}},"note":{"type":"string"},"submittedBy":{"type":"string"},"submittedAt":{"type":"string","format":"date-time"}},"required":["_id","documents","note","submittedBy","submittedAt"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":201,"success":true,"message":"Documents sent to the lawyer","data":{"_id":"6660a7d49b1d4a0012ab3501","propertyId":"665f1c2e9b1d4a0012ab34cd","lawyerId":"665f1c2e9b1d4a0012ab34c3","assignedBy":"665f1c2e9b1d4a0012ab34c1","mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"in_review","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[{"_id":"6660a7d49b1d4a0012ab3505","documents":[{"url":"https://res.cloudinary.com/example/raw/upload/v1717600000/homelinkhub/media/certificate-of-occupancy.pdf","name":"certificate-of-occupancy.pdf","mimeType":"application/pdf","size":482113}],"note":"C of O attached as requested.","submittedBy":"665f1c2e9b1d4a0012ab34c1","submittedAt":"2026-06-05T14:02:10.107Z"}],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":1}}}}}}},"400":{"description":"- `assignmentId` is not a valid ObjectId\n- No file was sent under `documents`\n- The assignment is `verified`, `rejected` or `reassigned`. The status in the message is the assignment's current status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`assignmentId` is not a valid ObjectId","value":{"status":400,"success":false,"message":"Invalid assignment ID","data":null}},"example2":{"summary":"No file was sent under `documents`","value":{"status":400,"success":false,"message":"Attach at least one document","data":null}},"example3":{"summary":"The assignment is `verified`, `rejected` or `reassigned`. The status in the message is the assignment's current status.","value":{"status":400,"success":false,"message":"This legal review is closed (status 'verified'), so documents can no longer be added to it","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"Caller is not on the lister's side of this assignment and is not an admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have permission to submit documents for this property","data":null}}}}}},"404":{"description":"- No assignment with that id\n- The assignment's property no longer exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No assignment with that id","value":{"status":404,"success":false,"message":"Assignment not found","data":null}},"example2":{"summary":"The assignment's property no longer exists","value":{"status":404,"success":false,"message":"Property not found","data":null}}}}}},"500":{"description":"- A file has an extension outside the allowed list (raised by the upload middleware)\n- A file is larger than 10 MB (multer error; the response carries multer's `code`)\n- More than 10 files were sent under `documents`, or a file was sent under another field name (multer error)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"A file has an extension outside the allowed list (raised by the upload middleware)","value":{"status":500,"success":false,"message":"File type not allowed. Allowed types: jpg, jpeg, png, gif, pdf, doc, docx, xls, xlsx, ppt, pptx, txt","data":null}},"example2":{"summary":"A file is larger than 10 MB (multer error; the response carries multer's `code`)","value":{"status":500,"success":false,"message":"File too large","data":null,"code":"LIMIT_FILE_SIZE"}},"example3":{"summary":"More than 10 files were sent under `documents`, or a file was sent under another field name (multer error)","value":{"status":500,"success":false,"message":"Unexpected field","data":null,"code":"LIMIT_UNEXPECTED_FILE"}}}}}}}}},"/api/v1/legal/assignments":{"get":{"tags":["legal"],"operationId":"legal_get_assignments","summary":"List my legal assignments","description":"**Access:** Bearer token required. **Roles:** `LAWYER`.\n\nThe calling lawyer's assignments, newest first, with `propertyId` populated (`title`, `location`, `pricing`) and `assignedBy` populated (`firstName`, `lastName`). **The shape of `data` depends on the query string.** With neither `page` nor `limit`, `data` is a bare array of every matching assignment (legacy behaviour). If either `page` or `limit` is present, `data` is an object with `assignments` (one page), `pagination` and `counts`. `counts` holds the lawyer's total per status plus `all`, and ignores the `status` filter so filter tabs keep their numbers; statuses with zero assignments are absent from it. `status` is matched exactly and not validated: an unknown value returns an empty result. Assignment statuses are `assigned`, `accepted`, `in_review`, `changes_requested`, `verified`, `rejected`, `reassigned`.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/get-assignments","x-short":"The calling lawyer's assignments, newest first, with propertyId populated (title, location, pricing) and assignedBy populated (firstName, lastName).","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Only return assignments with this exact status (`assigned`, `accepted`, `in_review`, `changes_requested`, `verified`, `rejected`, `reassigned`)."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1},"description":"1-based page number. Sending it (or `limit`) switches the response to the paginated shape."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10},"description":"Page size, clamped to 1-50. Sending it (or `page`) switches the response to the paginated shape."}],"responses":{"200":{"description":"- No `page` or `limit` in the query: `data` is a bare array\n- `page` or `limit` present: `data` is a paginated object with per-status counts","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]}},"required":["_id","title","location","pricing"]},"lawyerId":{"type":"string"},"assignedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["_id","firstName","lastName"]},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}}},"required":["status","success","message","data"]},"examples":{"example1":{"summary":"No `page` or `limit` in the query: `data` is a bare array","value":{"status":200,"success":true,"message":"Assignments fetched successfully","data":[{"_id":"6660a7d49b1d4a0012ab3501","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1}},"lawyerId":"665f1c2e9b1d4a0012ab34c3","assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"assigned","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}]}},"example2":{"summary":"`page` or `limit` present: `data` is a paginated object with per-status counts","value":{"status":200,"success":true,"message":"Assignments fetched successfully","data":{"assignments":[{"_id":"6660a7d49b1d4a0012ab3501","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1}},"lawyerId":"665f1c2e9b1d4a0012ab34c3","assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"assigned","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-04T09:15:22.481Z","__v":0}],"pagination":{"page":1,"limit":10,"total":14,"pages":2},"counts":{"all":14,"assigned":2,"accepted":1,"in_review":3,"changes_requested":1,"verified":6,"rejected":1}}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: LAWYER. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/assignments/{assignmentId}":{"get":{"tags":["legal"],"operationId":"legal_get_assignments_assignment_id","summary":"Get one of my legal assignments","description":"**Access:** Bearer token required. **Roles:** `LAWYER`. **Also requires:** Caller must be the lawyer on the assignment.\n\nA single assignment for the lawyer it is assigned to. `propertyId` is populated with `title`, `location`, `pricing`, `details`, `verification` and the property's **current** `media` (compare with `mediaSnapshot`, the media frozen at assignment time); `lawyerId` with `firstName`, `lastName`, `avatar`; `assignedBy` with `firstName`, `lastName`; each document submission's `submittedBy` with `firstName`, `lastName`. `decision` holds only an empty `checklist` until a decision is submitted. Listers cannot use this endpoint; they read assignments through the property history endpoint.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/get-assignments-assignment-id","x-short":"A single assignment for the lawyer it is assigned to.","parameters":[{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the legal assignment."}],"responses":{"200":{"description":"The assignment","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"}},"required":["isVerified"]}},"required":["_id","title","location","details","pricing","media","verification"]},"lawyerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"assignedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["_id","firstName","lastName"]},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"documents":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"name":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"integer"}},"required":["url","name","mimeType","size"]}},"note":{"type":"string"},"submittedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["_id","firstName","lastName"]},"submittedAt":{"type":"string","format":"date-time"}},"required":["_id","documents","note","submittedBy","submittedAt"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Assignment fetched successfully","data":{"_id":"6660a7d49b1d4a0012ab3501","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":["Fitted kitchen"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"verification":{"isVerified":false}},"lawyerId":{"_id":"665f1c2e9b1d4a0012ab34c3","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/folake.jpg"},"assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"in_review","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[{"_id":"6660a7d49b1d4a0012ab3505","documents":[{"url":"https://res.cloudinary.com/example/raw/upload/v1717600000/homelinkhub/media/certificate-of-occupancy.pdf","name":"certificate-of-occupancy.pdf","mimeType":"application/pdf","size":482113}],"note":"C of O attached as requested.","submittedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"submittedAt":"2026-06-05T14:02:10.107Z"}],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":1}}}}}}},"400":{"description":"`assignmentId` is not a valid ObjectId","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid assignment ID","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The assignment belongs to a different lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have access to this assignment","data":null}}}}}},"404":{"description":"No assignment with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Assignment not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/assignments/{assignmentId}/accept":{"patch":{"tags":["legal"],"operationId":"legal_patch_assignments_assignment_id_accept","summary":"Accept a legal assignment","description":"**Access:** Bearer token required. **Roles:** `LAWYER`. **Also requires:** Caller must be the lawyer on the assignment; Assignment status must be `assigned`.\n\nThe assigned lawyer accepts the work: status moves `assigned` -> `accepted`. An `assignment_accepted` audit entry is written and the user who made the assignment is notified. Note the naming quirk: the notification's event type is `lawyer_review_started` and its title is \"Legal Review Started\" even though the review has only been accepted; it is delivered as a stored in-app notification with a `notifications:new` socket event, a push, and an email with subject \"Legal Assignment Accepted\". The property's `legalStatus` is not changed (it is already `under_legal_review`). No request body. `data` is the updated assignment in the populated shape of Get assignment.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/patch-assignments-assignment-id-accept","x-short":"The assigned lawyer accepts the work: status moves assigned -> accepted.","parameters":[{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the legal assignment."}],"responses":{"200":{"description":"Assignment accepted","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"}},"required":["isVerified"]}},"required":["_id","title","location","details","pricing","media","verification"]},"lawyerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"assignedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["_id","firstName","lastName"]},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Assignment accepted successfully","data":{"_id":"6660a7d49b1d4a0012ab3501","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":["Fitted kitchen"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"verification":{"isVerified":false}},"lawyerId":{"_id":"665f1c2e9b1d4a0012ab34c3","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/folake.jpg"},"assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"accepted","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0}}}}}}},"400":{"description":"- `assignmentId` is not a valid ObjectId\n- The assignment is not in `assigned`. The first quoted status in the message is the current one.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`assignmentId` is not a valid ObjectId","value":{"status":400,"success":false,"message":"Invalid assignment ID","data":null}},"example2":{"summary":"The assignment is not in `assigned`. The first quoted status in the message is the current one.","value":{"status":400,"success":false,"message":"Cannot accept assignment. Current status is 'accepted', expected 'assigned'","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The assignment belongs to a different lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have access to this assignment","data":null}}}}}},"404":{"description":"No assignment with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Assignment not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/assignments/{assignmentId}/start-review":{"patch":{"tags":["legal"],"operationId":"legal_patch_assignments_assignment_id_start_review","summary":"Start reviewing an assignment","description":"**Access:** Bearer token required. **Roles:** `LAWYER`. **Also requires:** Caller must be the lawyer on the assignment; Assignment status must be `accepted`.\n\nThe lawyer begins the review: status moves `accepted` -> `in_review`. A `review_started` audit entry is written and the user who made the assignment is emailed (\"Legal Review Has Started\", fire-and-forget). Unlike accept and decision, this step sends **only** the email: no in-app notification, socket event or push. The property is not changed. A decision can only be submitted once the assignment is `in_review`. No request body. `data` is the updated assignment in the populated shape of Get assignment.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/patch-assignments-assignment-id-start-review","x-short":"The lawyer begins the review: status moves accepted -> inreview.","parameters":[{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the legal assignment."}],"responses":{"200":{"description":"Review started","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"}},"required":["isVerified"]}},"required":["_id","title","location","details","pricing","media","verification"]},"lawyerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"assignedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["_id","firstName","lastName"]},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"checklist":{"type":"array","items":{}}},"required":["checklist"]},"documentSubmissions":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Review started successfully","data":{"_id":"6660a7d49b1d4a0012ab3501","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":["Fitted kitchen"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"verification":{"isVerified":false}},"lawyerId":{"_id":"665f1c2e9b1d4a0012ab34c3","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/folake.jpg"},"assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"in_review","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"checklist":[]},"documentSubmissions":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-05T14:02:10.107Z","__v":0}}}}}}},"400":{"description":"- `assignmentId` is not a valid ObjectId\n- The assignment is not in `accepted`. The first quoted status in the message is the current one.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`assignmentId` is not a valid ObjectId","value":{"status":400,"success":false,"message":"Invalid assignment ID","data":null}},"example2":{"summary":"The assignment is not in `accepted`. The first quoted status in the message is the current one.","value":{"status":400,"success":false,"message":"Cannot start review. Current status is 'assigned', expected 'accepted'","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The assignment belongs to a different lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have access to this assignment","data":null}}}}}},"404":{"description":"No assignment with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Assignment not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/legal/assignments/{assignmentId}/decision":{"patch":{"tags":["legal"],"operationId":"legal_patch_assignments_assignment_id_decision","summary":"Submit a legal decision","description":"**Access:** Bearer token required. **Roles:** `LAWYER`. **Also requires:** Caller must be the lawyer on the assignment; Assignment status must be `in_review`.\n\nThe lawyer records the outcome of an `in_review` assignment. The decision (`outcome`, `notes`, `checklist`, `decidedAt`) is stored on the assignment and the assignment status becomes the outcome: `verified`, `rejected` or `changes_requested`. The property is updated to match. **`verified`**: `legalStatus` -> `legally_verified`; `verification.isVerified` -> `true` with `verifiedBy` (the lawyer), `verifiedAt` and `verificationNotes` (the decision notes); and if the property's status is `pending_verification` it becomes `listed`, unless it has an open duplicate flag, in which case it stays held until an admin resolves the flag. **`rejected`**: `legalStatus` -> `legally_rejected`, `verification.isVerified` -> `false`; the listing status is left as it is. **`changes_requested`**: `legalStatus` -> `changes_requested`, `verification.isVerified` -> `false`; the lister answers by uploading documents, which returns the assignment to `in_review`. An audit entry (`decision_verified`, `decision_rejected` or `decision_changes_requested`) is written and the user who made the assignment is notified: event `lawyer_verification_completed` for `verified` and `rejected`, `lawyer_changes_requested` for `changes_requested`, titled `Legal Review Decision: <outcome>`, delivered in-app with a `notifications:new` socket event, by push, and by the generic notification email. Only presence of `outcome` and `notes` is checked by the handler; an `outcome` or checklist `status` outside the allowed values fails Mongoose validation and surfaces as a 500. Any unexpected error inside the legal service (including a Mongoose cast or validation failure) is re-thrown as a 500 carrying the underlying error's message plus an `errorData` field holding the serialized underlying error.","security":[{"bearerAuth":[]}],"x-doc-slug":"legal/patch-assignments-assignment-id-decision","x-short":"The lawyer records the outcome of an inreview assignment.","parameters":[{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string"},"description":"ObjectId of the legal assignment."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"outcome":{"type":"string","description":"`verified`, `rejected` or `changes_requested`."},"notes":{"type":"string","description":"Explanation of the decision. Max 5000 characters (model limit). On `verified` it is copied to the property's `verification.verificationNotes`."},"checklist":{"type":"array","items":{},"description":"Optional list of checked items. Each entry is an object with `item` (string), `status` (`pass`, `fail` or `comment`) and optional `comment` (string). Defaults to an empty list."}},"required":["outcome","notes"]},"examples":{"default":{"value":{"outcome":"verified","notes":"Certificate of Occupancy and survey plan confirmed against the Lagos State Lands Registry.","checklist":[{"item":"Certificate of Occupancy","status":"pass","comment":"Registered, no encumbrance"}]}}}}}},"responses":{"200":{"description":"Decision recorded. `data` is the assignment as loaded before the property update, so the populated `propertyId.verification` may still show the pre-decision values.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"propertyId":{"type":"object","properties":{"_id":{"type":"string"},"title":{"type":"string"},"location":{"type":"object","properties":{"state":{"type":"string"},"lga":{"type":"string"},"community":{"type":"string"},"street":{"type":"string"},"nearestLandmark":{"type":"string"},"coordinates":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["type","coordinates"]}},"required":["state","lga","community","street","nearestLandmark","coordinates"]},"details":{"type":"object","properties":{"bedrooms":{"type":"integer"},"bathrooms":{"type":"integer"},"squareFeet":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}},"required":["bedrooms","bathrooms","squareFeet","features"]},"pricing":{"type":"object","properties":{"rentPrice":{"type":"integer"},"salePrice":{"nullable":true},"currency":{"type":"string"},"rentDurationYears":{"type":"integer"}},"required":["rentPrice","salePrice","currency","rentDurationYears"]},"media":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}},"tag":{"type":"string"}},"required":["address","coordinates","tag"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"verification":{"type":"object","properties":{"isVerified":{"type":"boolean"}},"required":["isVerified"]}},"required":["_id","title","location","details","pricing","media","verification"]},"lawyerId":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"avatar":{"type":"string"}},"required":["_id","firstName","lastName","avatar"]},"assignedBy":{"type":"object","properties":{"_id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"}},"required":["_id","firstName","lastName"]},"mediaSnapshot":{"type":"object","properties":{"images":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"address":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}},"required":["address","coordinates"]},"_id":{"type":"string"}},"required":["url","metadata","_id"]}},"videos":{"type":"array","items":{}}},"required":["images","videos"]},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"notes":{"type":"string"},"decision":{"type":"object","properties":{"outcome":{"type":"string"},"notes":{"type":"string"},"checklist":{"type":"array","items":{"type":"object","properties":{"item":{"type":"string"},"status":{"type":"string"},"comment":{"type":"string"},"_id":{"type":"string"}},"required":["item","status","comment","_id"]}},"decidedAt":{"type":"string","format":"date-time"}},"required":["outcome","notes","checklist","decidedAt"]},"documentSubmissions":{"type":"array","items":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","propertyId","lawyerId","assignedBy","mediaSnapshot","status","dueDate","notes","decision","documentSubmissions","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Decision submitted successfully","data":{"_id":"6660a7d49b1d4a0012ab3501","propertyId":{"_id":"665f1c2e9b1d4a0012ab34cd","title":"3-Bedroom Flat, Lekki Phase 1","location":{"state":"Lagos","lga":"Eti-Osa","community":"Lekki Phase 1","street":"14 Admiralty Way","nearestLandmark":"Lekki Phase 1 Gate","coordinates":{"type":"Point","coordinates":[3.4723,6.4474]}},"details":{"bedrooms":3,"bathrooms":3,"squareFeet":1650,"features":["Fitted kitchen"]},"pricing":{"rentPrice":4500000,"salePrice":null,"currency":"NGN","rentDurationYears":1},"media":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474],"tag":"Living room"},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"verification":{"isVerified":false}},"lawyerId":{"_id":"665f1c2e9b1d4a0012ab34c3","firstName":"Folake","lastName":"Adeyemi","avatar":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/folake.jpg"},"assignedBy":{"_id":"665f1c2e9b1d4a0012ab34c1","firstName":"Chinedu","lastName":"Okafor"},"mediaSnapshot":{"images":[{"url":"https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/living-room.jpg","metadata":{"address":"14 Admiralty Way, Lekki Phase 1, Lagos","coordinates":[3.4723,6.4474]},"_id":"6660a7d49b1d4a0012ab3570"}],"videos":[]},"status":"verified","dueDate":"2026-06-12T17:00:00.000Z","notes":"Please confirm the C of O and survey plan.","decision":{"outcome":"verified","notes":"Certificate of Occupancy and survey plan confirmed against the Lagos State Lands Registry.","checklist":[{"item":"Certificate of Occupancy","status":"pass","comment":"Registered, no encumbrance","_id":"6660a7d49b1d4a0012ab3580"}],"decidedAt":"2026-06-06T10:30:00.000Z"},"documentSubmissions":[],"createdAt":"2026-06-04T09:15:22.481Z","updatedAt":"2026-06-06T10:30:00.000Z","__v":1}}}}}}},"400":{"description":"- `outcome` or `notes` is missing or empty\n- `assignmentId` is not a valid ObjectId\n- The assignment is not in `in_review`. The first quoted status in the message is the current one.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`outcome` or `notes` is missing or empty","value":{"status":400,"success":false,"message":"Decision outcome and notes are required","data":null}},"example2":{"summary":"`assignmentId` is not a valid ObjectId","value":{"status":400,"success":false,"message":"Invalid assignment ID","data":null}},"example3":{"summary":"The assignment is not in `in_review`. The first quoted status in the message is the current one.","value":{"status":400,"success":false,"message":"Cannot submit decision. Current status is 'accepted', expected 'in_review'","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The assignment belongs to a different lawyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"You do not have access to this assignment","data":null}}}}}},"404":{"description":"No assignment with that id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":404,"success":false,"message":"Assignment not found","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/settings":{"get":{"tags":["settings"],"operationId":"settings_get","summary":"Get platform settings","description":"**Access:** Public, no token needed.\n\nPublic read of the single global settings record that clients use to price and gate flows: `paymentMode` (`ESCROW` or `DIRECT`), `platformPropertyFeePercent` (HomeLink's cut, added on top of the base amount for rent/sale payments), `agentCommissionPercent` (the agent's share of a completed purchase), `defaultInspectionFee` (flat NGN fee used when an agent has not set their own), `autoSweepPlatformFees`, `imageGeotagging` (whether listing photos are checked against the listing's pin, how strictly, and the allowed distance in metres) and `defaultLegalPartnerId` (the lawyer new listings are auto-assigned to, or null). The platform's payout bank account is stripped from this response. If no settings record exists yet, this call creates one with the defaults shown below.","security":[],"x-doc-slug":"settings/get","x-short":"Public read of the single global settings record that clients use to price and gate flows: paymentMode (ESCROW or DIRECT), platformPropertyFeePercent (HomeLink's cut, added on t...","responses":{"200":{"description":"The current settings (defaults shown).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"paymentMode":{"type":"string"},"platformPropertyFeePercent":{"type":"integer"},"agentCommissionPercent":{"type":"integer"},"defaultInspectionFee":{"type":"integer"},"autoSweepPlatformFees":{"type":"boolean"},"imageGeotagging":{"type":"object","properties":{"enabled":{"type":"boolean"},"strict":{"type":"boolean"},"maxDistanceMeters":{"type":"integer"}},"required":["enabled","strict","maxDistanceMeters"]},"defaultLegalPartnerId":{"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"}},"required":["_id","paymentMode","platformPropertyFeePercent","agentCommissionPercent","defaultInspectionFee","autoSweepPlatformFees","imageGeotagging","defaultLegalPartnerId","createdAt","updatedAt","__v"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Settings fetched successfully","data":{"_id":"6601a2b3c4d5e6f708192a3b","paymentMode":"ESCROW","platformPropertyFeePercent":1,"agentCommissionPercent":5,"defaultInspectionFee":5000,"autoSweepPlatformFees":false,"imageGeotagging":{"enabled":false,"strict":false,"maxDistanceMeters":500},"defaultLegalPartnerId":null,"createdAt":"2026-01-10T08:00:00.000Z","updatedAt":"2026-11-20T10:00:00.000Z","__v":0}}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}},"patch":{"tags":["settings"],"operationId":"settings_patch","summary":"Update platform settings","description":"**Access:** Bearer token required. **Roles:** `ADMIN`.\n\nAdmin-only partial update of the global settings record (created on first write if missing). Only the six fields listed below are read; `autoSweepPlatformFees` and the platform payout account cannot be changed through this endpoint.\n\n`imageGeotagging` is merged: only the keys sent change, so `{ \"enabled\": true }` keeps the stored distance. `defaultLegalPartnerId` must be the id of an active user with role `LAWYER`; `null` or `\"\"` clears it. Once set, every newly published listing is automatically assigned to that lawyer for legal verification.\n\nThe route has no request validator. The percentages and the inspection fee are not range-checked (any number is stored); an invalid `paymentMode` or a non-numeric value is rejected by the model as `400 Validation Error: ...`, and a request with no JSON body at all fails with a 500. Changes apply to future transactions only, since fees are snapshotted on each escrow at creation.\n\nUnlike `GET /settings`, the response is the full settings document, so it includes `platformBankAccount` (unmasked) when one has been configured.","security":[{"bearerAuth":[]}],"x-doc-slug":"settings/patch","x-short":"Admin-only partial update of the global settings record (created on first write if missing).","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"paymentMode":{"type":"string","description":"`ESCROW` or `DIRECT`."},"platformPropertyFeePercent":{"type":"number","description":"HomeLink's fee as a percentage, added on top of the base amount for property rent/sale payments. Default 1. Not range-checked."},"agentCommissionPercent":{"type":"number","description":"The listing agent's share of a completed property purchase, as a percentage. Default 5. Not range-checked."},"defaultInspectionFee":{"type":"number","description":"Flat inspection fee in NGN used when an agent has not configured their own. Default 5000."},"imageGeotagging":{"type":"object","description":"`{ enabled?: boolean, strict?: boolean, maxDistanceMeters?: number 50-50000 }`. `enabled` turns the photo-location check on; `strict` also rejects photos with no GPS position; `maxDistanceMeters` is how far from the listing's pin a photo may have been taken (default 500). Merged with the stored values."},"defaultLegalPartnerId":{"type":"string","description":"User id of an active lawyer to auto-assign new listings to. `null` or an empty string clears it."}}},"examples":{"default":{"value":{"platformPropertyFeePercent":1.5,"defaultInspectionFee":7500,"imageGeotagging":{"enabled":true,"maxDistanceMeters":300},"defaultLegalPartnerId":"664d3e0b5c1f6a0014dd55ee"}}}}}},"responses":{"200":{"description":"The full settings document after the update. `platformBankAccount` appears here if one is configured.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"_id":{"type":"string"},"paymentMode":{"type":"string"},"platformPropertyFeePercent":{"type":"number"},"agentCommissionPercent":{"type":"integer"},"defaultInspectionFee":{"type":"integer"},"autoSweepPlatformFees":{"type":"boolean"},"imageGeotagging":{"type":"object","properties":{"enabled":{"type":"boolean"},"strict":{"type":"boolean"},"maxDistanceMeters":{"type":"integer"}},"required":["enabled","strict","maxDistanceMeters"]},"defaultLegalPartnerId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"__v":{"type":"integer"},"platformBankAccount":{"type":"object","properties":{"bankName":{"type":"string"},"bankCode":{"type":"string"},"accountNumber":{"type":"string"},"accountName":{"type":"string"}},"required":["bankName","bankCode","accountNumber","accountName"]}},"required":["_id","paymentMode","platformPropertyFeePercent","agentCommissionPercent","defaultInspectionFee","autoSweepPlatformFees","imageGeotagging","defaultLegalPartnerId","createdAt","updatedAt","__v","platformBankAccount"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Settings updated successfully","data":{"_id":"6601a2b3c4d5e6f708192a3b","paymentMode":"ESCROW","platformPropertyFeePercent":1.5,"agentCommissionPercent":5,"defaultInspectionFee":7500,"autoSweepPlatformFees":false,"imageGeotagging":{"enabled":true,"strict":false,"maxDistanceMeters":300},"defaultLegalPartnerId":"664d3e0b5c1f6a0014dd55ee","createdAt":"2026-01-10T08:00:00.000Z","updatedAt":"2026-11-25T14:00:00.000Z","__v":0,"platformBankAccount":{"bankName":"Guaranty Trust Bank","bankCode":"058","accountNumber":"0123456789","accountName":"HomeLink Hub Limited"}}}}}}}},"400":{"description":"- `imageGeotagging.maxDistanceMeters` is not a finite number between 50 and 50000.\n- `imageGeotagging` is null or not an object, or `enabled` / `strict` is not a boolean.\n- `defaultLegalPartnerId` is not a valid id, or the user is missing, inactive or not a `LAWYER`.\n- The model rejected a value, for example an unknown `paymentMode`. The message is Mongoose's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`imageGeotagging.maxDistanceMeters` is not a finite number between 50 and 50000.","value":{"status":400,"success":false,"message":"Image geotagging distance must be between 50 and 50000 metres","data":null}},"example2":{"summary":"`imageGeotagging` is null or not an object, or `enabled` / `strict` is not a boolean.","value":{"status":400,"success":false,"message":"Image geotagging settings are invalid","data":null}},"example3":{"summary":"`defaultLegalPartnerId` is not a valid id, or the user is missing, inactive or not a `LAWYER`.","value":{"status":400,"success":false,"message":"The default legal partner must be an active lawyer","data":null}},"example4":{"summary":"The model rejected a value, for example an unknown `paymentMode`. The message is Mongoose's.","value":{"status":400,"success":false,"message":"Validation Error: Setting validation failed: paymentMode: `CASH` is not a valid enum value for path `paymentMode`.","data":null}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"403":{"description":"The signed-in user does not have one of the allowed roles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":403,"success":false,"message":"Access denied. This action requires one of the following roles: ADMIN. You have role: TENANT","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/webhooks/pandascrow":{"post":{"tags":["webhooks"],"operationId":"webhooks_post_pandascrow","summary":"Receive Pandascrow escrow webhook events","description":"**Access:** No user token. The request is verified by its signature header.\n\nServer-to-server endpoint called by Pandascrow (the escrow provider); not for client use. It is mounted on the app root, outside `/api/v1`, and its responses use Pandascrow's `{ status: boolean, message? }` shape rather than the standard envelope.\n\n**Verification.** The raw request bytes are captured before JSON parsing (any content type, 1 MB limit). `X-Pandascrow-Signature` must be the hex HMAC-SHA256 of that raw body keyed with the Pandascrow secret key; the header is trimmed and lower-cased and compared in constant time. If `X-Pandascrow-Timestamp` (Unix seconds) is present and numeric, it must be within 5 minutes of server time; a missing timestamp is tolerated. The event name is read from the body's `event`, falling back to the `X-Pandascrow-Event` header.\n\n**Events.** The escrow is looked up by `EscrowTransaction.pandascrowEscrowId` = `data.escrow_id` (or `data.escrow_data._id`). `EscrowTransaction.status` is one of `pending`, `funded`, `completed`, `disputed`, `cancelled`.\n\n- `escrow.paid`: `pending` -> `funded` only (so a late or repeated delivery never rolls a completed/disputed escrow back) and `paymentNotifiedAt` is set. The buyer, seller and commission-earning agent get an `escrow_funded` notification, and the buyer's socket room receives `escrow:status_updated` with `{ escrowTxId, status: \"funded\" }`.\n- `escrow.completed`: status -> `completed` with `completedAt`, from any previous status. `escrow_completed` notifications go out only if it was not already completed. Disbursement is then triggered in the background (records the seller's release, pays the agent commission and platform fee; idempotent), and the buyer receives `escrow:status_updated` with `status: \"completed\"`.\n- `escrow.dispute.opened` / `escrow.disputed`: status -> `disputed` unless already disputed; parties get an `escrow_disputed` notification once.\n- `escrow.payout.completed`: records the outcome of Pandascrow's release to the seller's bank from `data.payout` on the seller-proceeds `Payout` row: `bank_succeeded` -> `success`; bank failed but the platform wallet was credited (`wallet_succeeded`) -> `failed`, which returns the proceeds to the seller's withdrawable balance; anything else stays `processing` for manual review. Ignored when the escrow is unknown or was opened without a seller bank account; a payout already recorded as `success` is never downgraded.\n- `milestone.paid`: escrow (id from `data._id` or `data.escrow_id`) -> `funded` with `paymentNotifiedAt`, with no status guard and no notification.\n- `recurring.payment`: logged only (not implemented).\n- `escrow.created`, `invoice.paid`, `wallet.deposit.success`: acknowledged, no action.\n- Any other event: logged as unknown and still acknowledged.\n\nEvery verified delivery is answered with exactly `{ \"status\": true }`, including unknown events and escrow ids that match nothing, because Pandascrow treats any other body as a failed delivery and retries. A handler error returns 500 so Pandascrow retries.","security":[],"x-doc-slug":"webhooks/post-pandascrow","x-short":"Server-to-server endpoint called by Pandascrow (the escrow provider); not for client use.","parameters":[{"name":"X-Pandascrow-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"Hex HMAC-SHA256 of the raw request body, keyed with the Pandascrow secret key."},{"name":"X-Pandascrow-Timestamp","in":"header","required":false,"schema":{"type":"integer"},"description":"Unix time in seconds; rejected when more than 5 minutes from server time."},{"name":"X-Pandascrow-Event","in":"header","required":false,"schema":{"type":"string"},"description":"Event name, used when the body has no `event` field."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","description":"Event name: `escrow.paid`, `escrow.completed`, `escrow.dispute.opened`, `escrow.disputed`, `escrow.payout.completed`, `milestone.paid`, `recurring.payment`, `escrow.created`, `invoice.paid` or `wallet.deposit.success`. Falls back to the `X-Pandascrow-Event` header."},"data":{"type":"object","description":"Event payload. The handler reads `escrow_id` (or `escrow_data._id`), `escrow_data.amount` / `currency` (logging only) and, for `escrow.payout.completed`, the `payout` object (`bank_succeeded`, `wallet_succeeded`, `recipient_uuid`, `amount`, `reference`, `provider_reference`, `failure_reason`, `status`)."},"timestamp":{"type":"integer","description":"Event time as sent by Pandascrow. Only logged; replay protection uses the header."}},"required":["data"]},"examples":{"default":{"value":{"event":"escrow.paid","timestamp":1764062561,"data":{"escrow_id":48213,"escrow_data":{"_id":48213,"status":"funded","amount":4500000,"currency":"NGN"}}}}}}}},"responses":{"200":{"description":"Delivery verified and handled (or acknowledged with no action).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"boolean"}},"required":["status"]},"examples":{"default":{"value":{"status":true}}}}}},"400":{"description":"The body is not valid JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":false,"message":"Invalid JSON body"}}}}}},"401":{"description":"- `X-Pandascrow-Signature` header missing.\n- Signature does not match the raw body.\n- `X-Pandascrow-Timestamp` is more than 5 minutes from server time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"`X-Pandascrow-Signature` header missing.","value":{"status":false,"message":"Missing webhook header: x-pandascrow-signature"}},"example2":{"summary":"Signature does not match the raw body.","value":{"status":false,"message":"Invalid webhook signature"}},"example3":{"summary":"`X-Pandascrow-Timestamp` is more than 5 minutes from server time.","value":{"status":false,"message":"Webhook timestamp outside tolerance"}}}}}},"500":{"description":"- Unexpected error while verifying the signature.\n- An event handler threw (for example a database error). Pandascrow will retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"Unexpected error while verifying the signature.","value":{"status":false,"message":"Webhook validation failed"}},"example2":{"summary":"An event handler threw (for example a database error). Pandascrow will retry.","value":{"status":false,"message":"Webhook processing failed"}}}}}}}}},"/api/v1/calendar/google/status":{"get":{"tags":["calendar"],"operationId":"calendar_get_google_status","summary":"Get Google Calendar connection status","description":"**Access:** Bearer token required.\n\nTells whether the authenticated user has connected Google Calendar, i.e. whether an encrypted Google refresh token is stored on their account. Connected users get paid inspections added to their primary Google calendar automatically. This check does not call Google, so a grant the user revoked on Google's side still reports `connected: true` until the next sync attempt fails and the server drops it.","security":[{"bearerAuth":[]}],"x-doc-slug":"calendar/get-google-status","x-short":"Tells whether the authenticated user has connected Google Calendar, i.e.","responses":{"200":{"description":"Connection state.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"connected":{"type":"boolean"}},"required":["connected"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Calendar status fetched","data":{"connected":true}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/api/v1/calendar/google/url":{"get":{"tags":["calendar"],"operationId":"calendar_get_google_url","summary":"Get the Google Calendar consent URL","description":"**Access:** Bearer token required.\n\nReturns the Google OAuth consent URL the client should open in the browser to connect the user's calendar. The URL requests only the `https://www.googleapis.com/auth/calendar.events` scope with offline access and forced consent, and embeds a signed `state` token (valid for 10 minutes) carrying the user id and the return path. After consent Google redirects the browser to `GET /calendar/google/callback`, which finishes the connection. `returnPath` must be an in-app path matching `/app` or `/app/...` (letters, digits, `_`, `-`, `.`, `/`); anything else is silently replaced by `/app/inspections`.","security":[{"bearerAuth":[]}],"x-doc-slug":"calendar/get-google-url","x-short":"Returns the Google OAuth consent URL the client should open in the browser to connect the user's calendar.","parameters":[{"name":"returnPath","in":"query","required":false,"schema":{"type":"string","default":"/app/inspections"},"description":"In-app path to land on after the flow, e.g. `/app/inspections`. Must start with `/app`; otherwise `/app/inspections` is used."}],"responses":{"200":{"description":"Consent URL generated.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"authUrl":{"type":"string"}},"required":["authUrl"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Google Calendar authorization URL generated","data":{"authUrl":"https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.events&state=<signed-state>&response_type=code&client_id=<client-id>&redirect_uri=<redirect-uri>"}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}},"503":{"description":"The server has no Google client credentials, redirect URI or token-encryption key configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":503,"success":false,"message":"Google Calendar sync is not configured.","data":null}}}}}}}}},"/api/v1/calendar/google/callback":{"get":{"tags":["calendar"],"operationId":"calendar_get_google_callback","summary":"Google Calendar OAuth callback","description":"**Access:** Public, no token needed. **Also requires:** A valid signed `state` from `GET /calendar/google/url`.\n\nRedirect target that Google sends the browser to after the consent screen; clients never call it directly. It takes no bearer token: the user is identified by the signed `state` query parameter issued by `GET /calendar/google/url` (a JWT signed with a dedicated server-side secret, valid for 10 minutes).\n\nOn success the handler exchanges `code` for tokens, stores the refresh token encrypted (AES-256-GCM) on the user, back-fills Google Calendar events for the user's paid, upcoming, not-yet-synced inspections in the background, and answers with a **302 redirect** to `<FRONTEND_URL><returnPath>?calendar=connected`. It redirects with `?calendar=error` instead when `code` is absent (the user declined), Google returns no refresh token, the calendar scope was not granted, or the token exchange fails. A JSON error is returned only when `state` is unusable or the feature is not configured.","security":[],"x-doc-slug":"calendar/get-google-callback","x-short":"Redirect target that Google sends the browser to after the consent screen; clients never call it directly.","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string"},"description":"Authorization code appended by Google. Absent when the user declined consent."},{"name":"state","in":"query","required":true,"schema":{"type":"string"},"description":"Signed state token from the consent URL; identifies the user and the return path."}],"responses":{"302":{"description":"Always a redirect when `state` is valid; there is no JSON body. `Location` is `<FRONTEND_URL><returnPath>?calendar=connected` on success or `...?calendar=error` on any Google-side failure, where `FRONTEND_URL` is the web app origin configured on the server and `returnPath` defaults to `/app/inspections`."},"400":{"description":"`state` is missing, tampered with or older than 10 minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":400,"success":false,"message":"Invalid or expired calendar connect request.","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}},"503":{"description":"Google Calendar sync is not configured on the server.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":503,"success":false,"message":"Google Calendar sync is not configured.","data":null}}}}}}}}},"/api/v1/calendar/google":{"delete":{"tags":["calendar"],"operationId":"calendar_delete_google","summary":"Disconnect Google Calendar","description":"**Access:** Bearer token required.\n\nDisconnects the authenticated user's Google Calendar: the stored refresh token is revoked at Google on a best-effort basis (a failed revoke is only logged) and then removed from the user record. The call is idempotent and returns the same success response when nothing was connected. Events already created on the user's calendar are not deleted, and no further inspections are synced until the user connects again.","security":[{"bearerAuth":[]}],"x-doc-slug":"calendar/delete-google","x-short":"Disconnects the authenticated user's Google Calendar: the stored refresh token is revoked at Google on a best-effort basis (a failed revoke is only logged) and then removed from...","responses":{"200":{"description":"Disconnected (or was never connected).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"connected":{"type":"boolean"}},"required":["connected"]}},"required":["status","success","message","data"]},"examples":{"default":{"value":{"status":200,"success":true,"message":"Google Calendar disconnected","data":{"connected":false}}}}}}},"401":{"description":"- No bearer token was sent.\n- The access token has expired. Refresh it and retry.\n- The token is malformed or signed with another secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"example1":{"summary":"No bearer token was sent.","value":{"status":401,"success":false,"message":"Authentication required. Please provide a valid token.","data":null}},"example2":{"summary":"The access token has expired. Refresh it and retry.","value":{"status":401,"success":false,"message":"Token has expired","data":null}},"example3":{"summary":"The token is malformed or signed with another secret.","value":{"status":401,"success":false,"message":"Invalid token","data":null}}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/og/property/{file}":{"get":{"tags":["og"],"operationId":"og_get_property_file","summary":"Get a listing's link-preview image","description":"**Access:** Public, no token needed.\n\nServes the 1200x630 JPEG preview card (Open Graph image) for a listing, drawn from its first photo, title, price and location. Mounted at `/og` on the API host, outside `/api/v1`. It is meant to be reached through the web app's static site, which rewrites `/og/*` and `/app/property/*` to this service, and is consumed by link-preview crawlers and search engines rather than by API clients. It does not use the JSON envelope.\n\n`file` is the property id followed by `.jpg` (the suffix is optional and case-insensitive). A card exists only for listings that are not deleted and whose status is `listed`, `rented` or `sold`; verification is not required. Cards are cached in memory for 24 hours per listing version, and the `?v=` value the meta tags append is only a cache-buster that the server ignores.\n\nThis endpoint never returns an error status: for a malformed id, a missing or private listing, a failed lookup or a failed render it answers `302` to the site-wide default image (`<SITE_URL>/og-image.jpg`).","security":[],"x-doc-slug":"og/get-property-file","x-short":"Serves the 1200x630 JPEG preview card (Open Graph image) for a listing, drawn from its first photo, title, price and location.","parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"string"},"description":"`<propertyId>.jpg`. The `.jpg` suffix may be omitted."},{"name":"v","in":"query","required":false,"schema":{"type":"string"},"description":"Cache-busting version string; ignored by the server."}],"responses":{"200":{"description":"The listing's preview card as binary JPEG. Sent with `Cache-Control: public, max-age=86400, stale-while-revalidate=604800`."},"302":{"description":"No card can be served for this id (malformed id, listing missing, deleted, draft, pending or unlisted, or rendering failed). Redirects via the `Location` header to `<SITE_URL>/og-image.jpg` with `Cache-Control: public, max-age=300`."},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}}}}},"/og/page/property/{rest}":{"get":{"tags":["og"],"operationId":"og_get_page_property_rest","summary":"Get the web app page for a listing link","description":"**Access:** Public, no token needed.\n\nReturns the tenant web app's own `index.html` (fetched from `<SITE_URL>/index.html` and revalidated every 10 seconds) for a `/app/property/*` URL, with the listing's title, description, canonical URL, Open Graph image tags and JSON-LD structured data spliced into the page's `<!-- seo:start --> ... <!-- seo:end -->` block. Mounted at `/og` on the API host, outside `/api/v1`. It is meant to be reached through the web app's static site, which rewrites `/og/*` and `/app/property/*` to this service, and is consumed by link-preview crawlers and search engines rather than by API clients. It does not use the JSON envelope.\n\n`rest` is a wildcard: everything after `/og/page/property/`. Tags are injected only when it is a single segment that is the id of a public listing (not deleted, status `listed`, `rented` or `sold`). A single segment that is not a valid id, or names a missing or private listing, gets the app page with status 404 and a `noindex` robots tag. Deeper paths (for example a listing's escrow or messages screen), a listing lookup that fails or takes longer than 3 seconds, and an `index.html` without the seo block all get the page exactly as the app built it, with status 200.\n\nEvery HTML response is sent with `Cache-Control: no-cache`.","security":[],"x-doc-slug":"og/get-page-property-rest","x-short":"Returns the tenant web app's own index.html (fetched from <SITEURL>/index.html and revalidated every 10 seconds) for a /app/property/ URL, with the listing's title, description,...","parameters":[{"name":"rest","in":"path","required":true,"schema":{"type":"string"},"description":"Wildcard path after `/og/page/property/`; normally just the property id."}],"responses":{"200":{"description":"The web app page. For a public listing it carries that listing's preview tags and structured data; for deeper paths or when the lookup failed it is the unmodified app page.","content":{"text/html":{"schema":{"type":"string"},"examples":{"default":{"value":"<!doctype html><html><head><!-- seo:start -->\n    <title>Serviced 3-bedroom apartment in Lekki Phase 1 | HomeLink Hub</title>\n    <meta property=\"og:image\" content=\"https://www.homelinkhub.org/og/property/665f1c2e9b1d4a0012ab34cd.jpg?v=1-mhz3k2a0\" />\n    ...\n    <!-- seo:end --></head><body><div id=\"root\"></div></body></html>"}}}}},"404":{"description":"The path is a single segment that is not a valid property id, or the listing does not exist or is not public. The body is still the web app page (so people see the app's own not-found screen), with `<meta name=\"robots\" content=\"noindex\" />` added before `</head>`."},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}},"502":{"description":"The web app's `index.html` could not be loaded and no earlier copy is held in memory.","content":{"text/plain":{"schema":{"type":"string"},"examples":{"default":{"value":"This page could not be loaded. Please refresh."}}}}}}}},"/og/sitemap-listings.xml":{"get":{"tags":["og"],"operationId":"og_get_sitemap_listings_xml","summary":"Get the listings sitemap","description":"**Access:** Public, no token needed.\n\nXML sitemap of every public listing, for search engines; the web app's `robots.txt` points at it. It contains one `<url>` per listing that is `listed`, verified and not deleted (the same set `/api/v1/property/browse` serves), most recently updated first, capped at 45,000 URLs, each with `<loc><SITE_URL>/app/property/<id></loc>` and a `<lastmod>` taken from the listing's `updatedAt`. The document is rebuilt at most once an hour. Mounted at `/og` on the API host, outside `/api/v1`. It is meant to be reached through the web app's static site, which rewrites `/og/*` and `/app/property/*` to this service, and is consumed by link-preview crawlers and search engines rather than by API clients. It does not use the JSON envelope.","security":[],"x-doc-slug":"og/get-sitemap-listings-xml","x-short":"XML sitemap of every public listing, for search engines; the web app's robots.txt points at it.","responses":{"200":{"description":"The sitemap. Sent with `Cache-Control: public, max-age=3600`.","content":{"application/xml":{"schema":{"type":"string"},"examples":{"default":{"value":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url><loc>https://www.homelinkhub.org/app/property/665f1c2e9b1d4a0012ab34cd</loc><lastmod>2026-11-20T10:15:00.000Z</lastmod></url>\n</urlset>\n"}}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"default":{"value":{"status":500,"success":false,"message":"Internal Server Error","data":null}}}}}},"503":{"description":"The listings could not be read. Sent with `Retry-After: 600` so crawlers keep what they have and try again later.","content":{"text/plain":{"schema":{"type":"string"},"examples":{"default":{"value":"Sitemap is temporarily unavailable."}}}}}}}}}}