UrbanCribs API v 1.0.0

The UrbanCribs API is a RESTful API that allows you to access the data of the UrbanCribs platform. The API is available at UrbaCribs API and is currently in beta. The API is available in one version: v1.0.0. Other than accessing data from the API, you can also use the UrbanCribs platform API to create, edit, and delete listings depending on the permissions.

Root API url https://urbancribs.onrender.com/api/v1copy

Register User

POSThttps://urbancribs.onrender.com/api/v1/registercopy

This is an endpoint that allows you to register a new user. The user being registered must be a new user and must not have registered before. The user must have a valid email or phone number. Note: Make sure to capture the authToken from the response. authToken are generated by the server and are used to authenticate the user(login) and are required to access some endpoints in the API. At that point when you want to access the API, you will need to send the authToken in the header of the request as a bearer token. When the user registers the user is immediately logged in and the authToken is returned to the user.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require any authorization.
username string Body Required The username of the user being registered. The username must be unique. The username must be at least 3 characters long. The username can only contain letters, numbers, and underscores.
email string Body Required The email of the user being registered. The email must be unique. The email must be a valid email address. Note that the account verification process will send the verification OTP to this email.
password string Body Required The password of the user being registered. The password must be at least 6 characters long. The password should contain at least one number, one uppercase letter, and one lowercase letter. The password should also contain at least one special character.
user_location string Body Required The location of the user being registered. The location must be a valid location. The location must be at least 3 characters long. The location can only contain letters, numbers, and underscores.
type string Body Required The type of the user being registered. The type must be a valid type. The api allows for registration of agent, realtor, landlord and normal user. For normal type, only username, email, password, and user_location are required with a chance to update the profile later and add more information. When the user is an agent, realtor, or landlord, the user must also add the phone and either website twitter link, or facebook link or instagram link or linkedin link or all of them.
phone string Body optional for normal user | Required for realtor, agent, landlord The phone number of the user being registered. The phone number must be unique. The phone number must be a valid phone number.
website string Body optional The website of the user being registered. The website must be a valid website url.
facebook string Body optional The facebook link of the user being registered. The facebook link must be a valid facebook url.
twitter string Body optional The twitter link of the user being registered. The twitter link must be a valid twitter url.
instagram string Body optional The instagram link of the user being registered. The instagram link must be a valid instagram url.
linkedin string Body optional The linkedin link of the user being registered. The linkedin link must be a valid linkedin url.
youtube string Body optional The youtube link of the user being registered. The youtube link must be a valid youtube url.
Sample Request Body
                      
{
    "username":"john",
    "email":"johndoe6@gmail.com",
    "password":"Qwerty1234$",
    "user_location":"Mombasa",
    "type":"realtor",
    "phone":"07212345678",
    "twitter":"https://www.twitter.com/johndoe"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 201,
    "message": "User created successfully, john check your email for a verification code to verify your account",
    "body": {
        "user": {
            "id": 3,
            "username": "john",
            "email": "johndoe6@gmail.com",
            "password": "password not returned to client for security reasons",
            "userLocation": "Mombasa",
            "userTypeId": 4,
            "profilePlatform": "manual",
            "membershipLevelId": 4,
            "isVerified": false,
            "updatedBy": "",
            "phone": "07212345678",
            "website": null,
            "facebook": null,
            "twitter": "https://www.twitter.com/johndoe",
            "instagram": null,
            "linkedin": null,
            "youtube": "",
            "otp": "",
            "updatedAt": "2022-06-11T08:51:28.393Z",
            "createdAt": "2022-06-11T08:51:28.393Z",
            "userImage": null,
            "otpCreationTime": null,
            "profileCompletionPercentage": null
        },
        "Otp": "3151",
        "otpCreationTime": 1654937500443,
        "authToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywidXNlcm5hbWUiOiJSeWFuIiwiZW1haWwiOiJyeWFubXdha2lvNkBnbWFpbC5jb20iLCJwYXNzd29yZCI6IiQyYiQxMCRscWR1a2JsYk15bXRUd25zMS9LM3AuSnh3VFczT2FUakRnWlQzMUtUNjRrTFJLSzNUT2gxbSIsInVzZXJMb2NhdGlvbiI6Ik1vbWJhc2EiLCJ1c2VyVHlwZUlkIjo0LCJwcm9maWxlUGxhdGZvcm0iOiJtYW51YWwiLCJtZW1iZXJzaGlwTGV2ZWxJZCI6NCwiaXNWZXJpZmllZCI6ZmFsc2UsInVwZGF0ZWRCeSI6IiIsInBob25lIjoiMDcyMTIzNDU2NzgiLCJ3ZWJzaXRlIjpudWxsLCJmYWNlYm9vayI6bnVsbCwidHdpdHRlciI6Imh0dHBzOi8vd3d3LnR3aXR0ZXIuY29tL3J5YW5td2FraW8iLCJpbnN0YWdyYW0iOm51bGwsImxpbmtlZGluIjpudWxsLCJ5b3V0dWJlIjoiIiwib3RwIjoiIiwidXBkYXRlZEF0IjoiMjAyMi0wNi0xMVQwODo1MToyOC4zOTNaIiwiY3JlYXRlZEF0IjoiMjAyMi0wNi0xMVQwODo1MToyOC4zOTNaIiwidXNlckltYWdlIjpudWxsLCJvdHBDcmVhdGlvblRpbWUiOm51bGwsInByb2ZpbGVDb21wbGV0aW9uUGVyY2VudGFnZSI6bnVsbCwiaWF0IjoxNjU0OTM3NTAwLCJleHAiOjE2NTUwMjM5MDB9.wuJZk5r2REQv7dizILWfCVejjkk8nX0V7AuEw2EIJVo",
        "user_location": {
            "latitude": -4.054686,
            "longitude": 39.665622,
            "type": "locality",
            "name": "Mombasa",
            "number": null,
            "postal_code": null,
            "street": null,
            "confidence": 1,
            "region": "Coast",
            "region_code": "CO",
            "county": "Mombasa",
            "locality": "Mombasa",
            "administrative_area": null,
            "neighbourhood": null,
            "country": "Kenya",
            "country_code": "KEN",
            "continent": "Africa",
            "label": "Mombasa, CO, Kenya"
        }
    },
    "error": []
}
copy

Verify OTP

POSThttps://urbancribs.onrender.com/api/v1/verify-otpcopy

This is an endpoint that allows a user to verify their account and also a way to validate the legitimacy of email or phone number provided. The OTP is sent to the user's email address or phone and must pass it back to the app for the user to be verified.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header. Authorization token is generated when a user registers or logs in.
otp string Body Required The OTP sent to the user's email address. It is a 4 digit number. For example, if the OTP is 1234, then the user will enter 1234 in the OTP field.
email string Body Required The email address of the user. This is the email address that the OTP was sent to.
Sample Request Body
                      
{
    "otp":"6612",
    "email":"john@gmail.com"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User verified successfully",
    "body": {
        "user": {
            "id": 5,
            "username": "john",
            "email": "johndoe6@gmail.com",
            "password": "password not returned to client for security reasons",
            "userLocation": "Mombasa",
            "profilePlatform": "manual",
            "userTypeId": 1,
            "membershipLevelId": 4,
            "userImage": "",
            "isVerified": true,
            "updatedBy": "",
            "phone": "07212345678",
            "website": null,
            "facebook": null,
            "twitter": "https://www.twitter.com/johndoe",
            "instagram": null,
            "linkedin": null,
            "youtube": "",
            "otp": "$2b$10$sHS/7ZTVFEAsalQV2z/69.7GtEf.JoK41qWofmncjOP01MSx6ZtBC",
            "otpCreationTime": "1654941204147",
            "profileCompletionPercentage": null,
            "createdAt": "2022-06-11T09:53:12.769Z",
            "updatedAt": "2022-06-11T09:53:24.147Z"
        }
    },
    "error": []
}

Login User

POSThttps://urbancribs.onrender.com/api/v1/logincopy

This is an endpoint that allows a user to login to the system. The user can login with their email address and password. Capture the authToken that is returned in the response. The authToken will be used to authenticate the user in consecutive requests to the various api endpoints.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token to be passed to the header.
email string Body Required The email address of the user. This is the email used during registration.
password string Body Required The password of the user. This is the password used to login.
Sample Request Body
                      
{
    "email":"john6@gmail.com",
    "password":"Qwerty1234$"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User logged in successfully",
    "body": {
        "user": {
            "id": 5,
            "username": "john",
            "email": "johndoe6@gmail.com",
            "password": "password not returned to client for security reasons",
            "userLocation": "Mombasa",
            "profilePlatform": "manual",
            "userTypeId": 1,
            "membershipLevelId": 4,
            "userImage": "",
            "isVerified": true,
            "updatedBy": "",
            "phone": "07212345678",
            "website": null,
            "facebook": null,
            "twitter": "https://www.twitter.com/johndoe",
            "instagram": null,
            "linkedin": null,
            "youtube": "",
            "otp": "$2b$10$sHS/7ZTVFEAsalQV2z/69.7GtEf.JoK41qWofmncjOP01MSx6ZtBC",
            "otpCreationTime": "1654941204147",
            "profileCompletionPercentage": null,
            "createdAt": "2022-06-11T09:53:12.769Z",
            "updatedAt": "2022-06-11T09:54:59.363Z"
        },
        "authToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NSwidXNlcm5hbWUiOiJSeWFuIiwiZW1haWwiOiJyeWFubXdha2lvNkBnbWFpbC5jb20iLCJwYXNzd29yZCI6IiQyYiQxMCQ1V0N1ZGxhT3NTaXViSERFQnlqQlMuSXJ4TWxXbjI4dm8wTDlVTERKZTRscTJSeFBOelF5VyIsInVzZXJMb2NhdGlvbiI6Ik1vbWJhc2EiLCJwcm9maWxlUGxhdGZvcm0iOiJtYW51YWwiLCJ1c2VyVHlwZUlkIjoxLCJtZW1iZXJzaGlwTGV2ZWxJZCI6NCwidXNlckltYWdlIjoiIiwiaXNWZXJpZmllZCI6dHJ1ZSwidXBkYXRlZEJ5IjoiIiwicGhvbmUiOiIwNzIxMjM0NTY3OCIsIndlYnNpdGUiOm51bGwsImZhY2Vib29rIjpudWxsLCJ0d2l0dGVyIjoiaHR0cHM6Ly93d3cudHdpdHRlci5jb20vcnlhbm13YWtpbyIsImluc3RhZ3JhbSI6bnVsbCwibGlua2VkaW4iOm51bGwsInlvdXR1YmUiOiIiLCJvdHAiOiIkMmIkMTAkc0hTLzdaVFZGRUFzYWxRVjJ6LzY5LjdHdEVmLkpvSzQxcVdvZm1uY2pPUDAxTVN4Nlp0QkMiLCJvdHBDcmVhdGlvblRpbWUiOiIxNjU0OTQxMjA0MTQ3IiwicHJvZmlsZUNvbXBsZXRpb25QZXJjZW50YWdlIjpudWxsLCJjcmVhdGVkQXQiOiIyMDIyLTA2LTExVDA5OjUzOjEyLjc2OVoiLCJ1cGRhdGVkQXQiOiIyMDIyLTA2LTExVDA5OjU0OjU5LjM2M1oiLCJpYXQiOjE2NTQ5NDIwNzIsImV4cCI6MTY1NTAyODQ3Mn0.60KGF-OMqxWtFUvs8VhBfjLrY-3g4_a0KFQPGuE4pao"
    },
    "error": []
}

Logout user

POSThttps://urbancribs.onrender.com/api/v1/logoutcopy

This is an endpoint to logout a user. The endpoint will check if the user is logged in and if so, it will log the user out. The endpoint will return a success message if the user is logged out successfully.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header. Authorization token is generated when a user registers or logs in.

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User logged out successfully",
    "body": {},
    "error": []
}

Authenticate with Google

GEThttps://urbancribs.onrender.com/api/v1/auth/googlecopy

This is an endpoint to authenticate a user with Google. The endpoint will check if the user is already logged in and if so, it will return the user's details. If the user is not logged in, it will authenticate the user with Google and return the user's details.

Request

Response

will redirect to google login page, and if successful redirect to root of the api https://urbancribs.onrender.com/api/v1

Confirm Email Before Password Reset

POSThttps://urbancribs.onrender.com/api/v1/reset-password-confirm-emailcopy

This is an endpoint to confirm email before password reset. On hitting this endpoint, the user will be given an OTP sent to the user's email. The user will have to enter the OTP to reset the password.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token to be passed to the header.
email string body required This is the email address of the user. The email address must be registered with the system. If the email address is not registered, the user will be given an error.
Sample Request Body
                      
{
    "email":"johndoe6@gmail.com"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "A verification code has been sent to your email or phone number",
    "body": {},
    "error": []
}

Reset Password

POSThttps://urbancribs.onrender.com/api/v1/reset-passwordcopy

This is an endpoint to reset a users password. The user will pass the OTP sent to their email or phone number along with the newPassword to reset their password. The server will check if password is valid and not similar to old password and if so, it will update the password.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token to be passed to the header.
email string body required This is the email address of the user. The email address must be registered with the system. If the email address is not registered, the user will be given an error.
otp string body required This is the OTP sent to the user's email or phone number. The OTP must be valid. If the OTP is not valid, the user will be given an error.
newPassword string body required This is the new password that the user wants to change to. The password must be valid. If the password is not valid, the user will be given an appropriate error.
Sample Request Body
                      
{
    "email":"johndoe6@gmail.com",
    "otp":"1373",
    "newPassword":"Qwerty1234#"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Password reset successfully",
    "body": {},
    "error": []
}

Get Logged In User

GEThttps://urbancribs.onrender.com/api/v1/profile/mecopy

This is an endpoint to get the currently logged in user. The user will pass the JWT token to the header. The server will check if the token is valid and if so, it will return the user details.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
Sample Request Body
                      
// pass the authorization token on header as Bearer Token
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User found",
    "body": {
        "id": 5,
        "username": "john",
        "email": "johndoe6@gmail.com",
        "password": "password not returned to client for security reasons",
        "userLocation": "Mombasa",
        "profilePlatform": "manual",
        "userTypeId": 1,
        "membershipLevelId": 4,
        "userImage": "",
        "isVerified": true,
        "updatedBy": "",
        "phone": "07212345678",
        "website": null,
        "facebook": null,
        "twitter": "https://www.twitter.com/johndoe",
        "instagram": null,
        "linkedin": null,
        "youtube": "",
        "otp": "$2b$10$mgd65POy6UQHoBSiaLbvOOxhpC76LH5F.y2dKvpQOK80K3ixcLql.",
        "otpCreationTime": "1654944266078",
        "profileCompletionPercentage": null,
        "createdAt": "2022-06-11T09:53:12.769Z",
        "updatedAt": "2022-06-11T11:08:08.793Z"
    },
    "error": []
}

Update Profile / User

PUThttps://urbancribs.onrender.com/api/v1/profile/update-profilecopy

This is an endpoint to update the profile of the user. The user will pass the JWT token to the header. The server will check if the token is valid and if so, it will update the user details.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
phone string body optional This endpoint requires authorization token to be passed to the header.
website string body optional This endpoint requires authorization token to be passed to the header.
facebook string body optional This endpoint requires authorization token to be passed to the header.
twitter string body optional This endpoint requires authorization token to be passed to the header.
instagram string body optional This endpoint requires authorization token to be passed to the header.
linkedin string body optional This endpoint requires authorization token to be passed to the header.
youtube string body optional This endpoint requires authorization token to be passed to the header.
Sample Request Body
                      
{
    "phone":"07123452222",
    "instagram":"https://www.instagram.com/johndoe",
    "twitter":"https://www.twitter.com/johndoe"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "profile updated for john",
    "body": {
        "id": 5,
        "username": "john",
        "email": "johndoe6@gmail.com",
        "password": "password is not returned to client for security reasons",
        "userLocation": "Mombasa",
        "profilePlatform": "manual",
        "userTypeId": 1,
        "userImage": "",
        "isVerified": true,
        "updatedBy": "johndoe6@gmail.com",
        "phone": "07123452222",
        "website": null,
        "facebook": null,
        "twitter": "https://www.twitter.com/johndoe",
        "instagram": "https://www.instagram.com/johndoe",
        "linkedin": null,
        "youtube": "",
        "otp": "$2b$10$mgd65POy6UQHoBSiaLbvOOxhpC76LH5F.y2dKvpQOK80K3ixcLql.",
        "otpCreationTime": "1654944266078",
        "profileCompletionPercentage": null,
        "createdAt": "2022-06-11T09:53:12.769Z",
        "updatedAt": "2022-06-11T15:34:01.612Z"
    },
    "error": []
}

Get Profile By Id

GEThttps://urbancribs.onrender.com/api/v1/profile/get-by-id/?id=10copy

This is an endpoint to get profile by id. The endpoint requires authorization token to be passed to the header. The endpoint is accessible to only the user logged in or the admins.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
Id number url required This endpoint requires id to be passed to the url as a query parameter.
Sample Request Url
                      
https://urbancribs.onrender.com/api/v1/profile/get-by-id/?id=6
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User found",
    "body": {
        "id": 6,
        "username": "john1",
        "email": "johndoe1@gmail.com",
        "password": "password not returned to client for security reasons",
        "userLocation": "Mombasa",
        "profilePlatform": "manual",
        "userTypeId": 6,
        "membershipLevelId": 4,
        "userImage": "",
        "isVerified": false,
        "updatedBy": "",
        "phone": "07212345678",
        "website": null,
        "facebook": null,
        "twitter": "https://www.twitter.com/johndoe",
        "instagram": null,
        "linkedin": null,
        "youtube": "",
        "otp": "$2b$10$bhooJCFXm530WCX8HxeES.f9jPuOr4WPs3udcsMxA1dYuFrVDDooy",
        "otpCreationTime": "1654965404360",
        "profileCompletionPercentage": null,
        "createdAt": "2022-06-11T16:36:31.329Z",
        "updatedAt": "2022-06-11T16:36:44.361Z"
    },
    "error": []
}

Get Profile By Email

GEThttps://urbancribs.onrender.com/api/v1/profile/get-by-email/?email=johndoe6@gmail.comcopy

This is an endpoint to get profile by email. The endpoint requires authorization token to be passed to the header. The endpoint is accessible to only the user logged in or the admins.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
email string url required This endpoint requires email to be passed to the url as a query parameter.
Sample Request Url
                      
https://urbancribs.onrender.com/api/v1/profile/get-by-email/?email=johndoe6@gmail.com
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User found",
    "body": {
        "id": 5,
        "username": "john",
        "email": "johndoe6@gmail.com",
        "password": "$2b$10$jMLmBnM9ZrULHQpV9Uaj8.YT2/05vYj/Pyq78OZ6vBirqKrbqySTK",
        "userLocation": "Mombasa",
        "profilePlatform": "manual",
        "userTypeId": 1,
        "membershipLevelId": 4,
        "userImage": "",
        "isVerified": true,
        "updatedBy": "johndoe6@gmail.com",
        "phone": "07123452222",
        "website": null,
        "facebook": null,
        "twitter": "https://www.twitter.com/johndoe",
        "instagram": "https://www.instagram.com/johndoe",
        "linkedin": null,
        "youtube": "",
        "otp": "$2b$10$mgd65POy6UQHoBSiaLbvOOxhpC76LH5F.y2dKvpQOK80K3ixcLql.",
        "otpCreationTime": "1654944266078",
        "profileCompletionPercentage": null,
        "createdAt": "2022-06-11T09:53:12.769Z",
        "updatedAt": "2022-06-11T15:34:01.612Z"
    },
    "error": []
}

Get Profile Completion Percentage

GEThttps://urbancribs.onrender.com/api/v1/profile/calculate-percentagecopy

The endpoint requires authorization token to be passed to the header. The endpoint is accessible to only the user logged in or the admins. It gets the profile completion percentage of the user.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
Sample Request Url
                      
https://urbancribs.onrender.com/api/v1/profile/calculate-percentage
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Profile percentage calculated",
    "body": {
        "percentage": 61
    },
    "error": []
}

Make A User Admin

POSThttps://urbancribs.onrender.com/api/v1/profile/make-admincopy

The endpoint requires authorization token to be passed to the header. The endpoint is accessible to only the admins. It makes a user admin. Note: Only admins can make other users admin.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
email string header required This endpoint requires the email of the user that is to be made admin to be passed to the body.
Sample Request Url
{
    "email":"johndoe6@gmail.com"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User made admin",
    "body": {
        "id": 5,
        "username": "john",
        "email": "johndoe6@gmail.com",
        "password": "password is not returned to client for security reasons",
        "userLocation": "Mombasa",
        "profilePlatform": "manual",
        "userTypeId": 2,
        "membershipLevelId": 4,
        "userImage": "",
        "isVerified": true,
        "updatedBy": "johndoe6@gmail.com",
        "phone": "07123452222",
        "website": null,
        "facebook": null,
        "twitter": "https://www.twitter.com/johndoe",
        "instagram": "https://www.instagram.com/johndoe",
        "linkedin": null,
        "youtube": "",
        "otp": "otp not returned to client for security reasons",
        "otpCreationTime": "1654944266078",
        "profileCompletionPercentage": null,
        "createdAt": "2022-06-11T09:53:12.769Z",
        "updatedAt": "2022-06-11T18:09:07.910Z"
    },
    "error": []
}

Make A User Landlord

POSThttps://urbancribs.onrender.com/api/v1/profile/make-landlordcopy

The endpoit requires authorization token to be passed to the header. The endpoint is accessible to all users. It makes a user landlord.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
email string header required This endpoint requires the email of the user that is to be made landlord to be passed to the body.
Sample Request Url
{
    "email":"johndoe6@gmail.com"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User made landlord",
    "body": {
        "id": 8,
        "username": "john",
        "email": "johndoe6@gmail.com",
        "password": "password is not returned to client for security reasons",
        "userLocation": "Mombasa",
        "profilePlatform": "manual",
        "userTypeId": 1,
        "membershipLevelId": 4,
        "userImage": "",
        "isVerified": false,
        "updatedBy": "",
        "phone": "07212345678",
        "website": null,
        "facebook": null,
        "twitter": "https://www.twitter.com/johndoe",
        "instagram": null,
        "linkedin": null,
        "youtube": "",
        "otp": "otp not returned to client for security reasons",
        "otpCreationTime": "1654971105290",
        "profileCompletionPercentage": null,
        "createdAt": "2022-06-11T18:11:34.253Z",
        "updatedAt": "2022-06-11T18:11:45.291Z"
    },
    "error": []
}

Make A User Agent

POSThttps://urbancribs.onrender.com/api/v1/profile/make-agentcopy

The endpoit requires authorization token to be passed to the header. The endpoint is accessible to all users. It makes a user agent.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
email string header required This endpoint requires the email of the user that is to be made agent to be passed to the body.
Sample Request Url
{
    "email":"johndoe6@gmail.com"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User made agent",
    "body": {
        "id": 8,
        "username": "john",
        "email": "johndoe6@gmail.com",
        "password": "$2b$10$9SCTh5K3aCB8HpX0qWgrzOSeqjj5ZMa.S3uCgnTMsLFlyJiJeqaJq",
        "userLocation": "Mombasa",
        "profilePlatform": "manual",
        "userTypeId": 1,
        "membershipLevelId": 4,
        "userImage": "",
        "isVerified": false,
        "updatedBy": "",
        "phone": "07212345678",
        "website": null,
        "facebook": null,
        "twitter": "https://www.twitter.com/johndoe",
        "instagram": null,
        "linkedin": null,
        "youtube": "",
        "otp": "$2b$10$upZGhoF38tNpFifsgRik.uAJxX/hZnVlQhI7cRLaGxClJ3z54vZZG",
        "otpCreationTime": "1654971105290",
        "profileCompletionPercentage": null,
        "createdAt": "2022-06-11T18:11:34.253Z",
        "updatedAt": "2022-06-11T18:11:45.291Z"
    },
    "error": []
}

Delete A User

DELETEhttps://urbancribs.onrender.com/api/v1/profile/delete-profilecopy

The endpoit requires authorization token to be passed to the header. The endpoint is accessible to all users. It deletes a user.

Request

Content-Type: application/json

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
Sample Request Url
Authorization Bearer token is passed to header
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "User deleted",
    "body": {},
    "error": []
}

Search For A Listing Through String

GEThttps://urbancribs.onrender.com/api/v1/search/listings?text={search_text}copy

The endpoit searches for a listing through a string. The endpoint is accessible to all users. Use cases include having a user search for a listing by its title, description, or category. This could be a search form taking a serch term and redirecting to a search results page/view with the found results.

Request

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token to be passed to the header.
text string url required This is the search term.
Sample Request Body
https://urbancribs.onrender.com/api/v1/search/listings?text=Nai

or

https://urbancribs.onrender.com/api/v1/search/listings?text=ai&&page=1&&limit=10
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "listings": [
            {
                "id": 8,
                "userId": 12,
                "title": "lari estate",
                "description": "a new development in kenya",
                "price": 70000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_a7f0b3ce-b398-4dc4-a096-952fb2fca4d2-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_3316d97d-f5a3-42e6-9d85-45c96ea379ae-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_12dd9f44-af76-4470-829a-4ac22289f2bd-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_001afbc9-b608-464f-b73d-bb9eaabad3ff-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_a84669f1-9a31-499c-aa24-aea653097111-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/8f979bc0-8695-49fe-91ea-280481517065-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/06e4e4db-4d83-4b8e-a5ec-2a17047e0eb3-.pdf",
                "image1Name": "urbcrbs_a7f0b3ce-b398-4dc4-a096-952fb2fca4d2-.jpg",
                "image2Name": "urbcrbs_3316d97d-f5a3-42e6-9d85-45c96ea379ae-.jpg",
                "image3Name": "urbcrbs_12dd9f44-af76-4470-829a-4ac22289f2bd-.jpg",
                "image4Name": "urbcrbs_001afbc9-b608-464f-b73d-bb9eaabad3ff-.jpg",
                "image5Name": "urbcrbs_a84669f1-9a31-499c-aa24-aea653097111-.jpg",
                "videoName": "8f979bc0-8695-49fe-91ea-280481517065-.mp4",
                "floorPlanName": "06e4e4db-4d83-4b8e-a5ec-2a17047e0eb3-.pdf",
                "location": "kasarani nairobi",
                "available": true,
                "city": "nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "nairobi area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-14T12:29:33.529Z",
                "updatedAt": "2022-06-14T12:29:36.815Z"
            }
        ]
    },
    "error": []
}

Create listing

POSThttps://urbancribs.onrender.com/api/v1/listingscopy

The endpoit requires authorization token to be passed to the header. The endpoint is accessible to landlords, realtors, agents and admins. It creates a new listing.

Request

Accept: application/json


Parameter Type Position # Description
Authorization string header required This endpoint requires authorization token to be passed to the header.
title string body required The title of the listing.
description text body required The description of the listing.
location string body required The location of the listing.
city string body required The city where the listing is located.
price integer body required The price of the listing.
bedrooms integer body required The number of bedrooms in the listing.
bathrooms integer body required The number of bathrooms in the listing.
sqft integer body required The square footage of the listing. The size of area property is measured in square feet.
type string body required The type of the listing. Could be a house, apartment, warehouse, commercial etc.
yearBuilt string body required The year the listing was built.
parking boolean body required The parking availability of the listing.
pets boolean body required Whether the listing allows pets.
furnished boolean body required Whether the listing is furnished.
wifi boolean body required Whether the listing has wifi.
img1 file body required The first image of the listing. The image must be a jpg/jpeg or png file.
img2 file body required The second image of the listing. The image must be a jpg/jpeg or png file.
img3 file body required The third image of the listing. The image must be a jpg/jpeg or png file.
img4 file body required The fourth image of the listing. The image must be a jpg/jpeg or png file.
img5 file body required The fifth image of the listing. The image must be a jpg/jpeg or png file.
video file body required The video of the listing. The video should be in mp4 format.
floorplan file body required The video of the listing. The floorplan should be in pdf format.
available boolean body required The availability of the listing.
forSale boolean body required Whether the listing is for sale.
forRent boolean body required Whether the listing is for rent.
featured boolean body required Whether the listing is featured.
category string body required The category of the listing. The category must be one of the following: rent, sale, hire.
Sample Request Body
multipart/form-data
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listing created successfully",
    "body": {
        "newListing": {
            "id": 3,
            "userId": 11,
            "title": "Lari Estate",
            "description": "A new development in Kenya",
            "price": 24000,
            "bedrooms": 3,
            "bathrooms": 1,
            "sqft": 1200,
            "type": "house",
            "category": null,
            "yearBuilt": 2020,
            "parking": true,
            "pets": true,
            "furnished": false,
            "wifi": true,
            "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
            "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
            "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
            "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
            "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
            "videoUrl": "http://127.0.0.1:8000/uploads/1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
            "floorPlanUrl": "http://127.0.0.1:8000/uploads/89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
            "image1Name": "urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
            "image2Name": "urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
            "image3Name": "urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
            "image4Name": "urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
            "image5Name": "urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
            "videoName": "1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
            "floorPlanName": "89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
            "location": "Kasarani Nairobi",
            "available": true,
            "city": "Nairobi",
            "featured": true,
            "createdBy": "johndoe6@gmail.com",
            "updatedBy": "johndoe6@gmail.com",
            "forRent": true,
            "forSale": false,
            "county": "Nairobi",
            "views": 0,
            "latitude": "-1.28333",
            "longitude": "36.81667",
            "region": "Nairobi Area",
            "published": false,
            "verified": false,
            "createdAt": "2022-06-12T10:42:38.222Z",
            "updatedAt": "2022-06-12T10:42:39.988Z"
        }
    },
    "error": []
}

Get All Listings

GEThttps://urbancribs.onrender.com/api/v1/listingscopy

The endpoit returns all listings in the database. It returns the list starting from the most recent listing. The endpoint does not require authorization token to be accessed.

Request

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
Sample Request
No authorization token is required to access this endpoint.
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 3,
        "listings": [
            {
                "id": 3,
                "userId": 11,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
                "image1Name": "urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
                "image2Name": "urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
                "image3Name": "urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
                "image4Name": "urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
                "image5Name": "urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
                "videoName": "1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
                "floorPlanName": "89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": true,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-12T10:42:38.222Z",
                "updatedAt": "2022-06-12T10:42:39.988Z"
            }
        ]
    },
    "error": []
}

Get Listing By Id

GEThttps://urbancribs.onrender.com/api/v1/listings/{id}copy

The endpoint returns a single listing by id. The listing is returned in the body of the response. The endpoint does not require authorization token to access. It requires the id of the listing to be retrieved to be passed in the url as a url parameter.

Request

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
id integer url required The id of the listing to be retrieved. It is passed as a url parameter.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/3
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 3,
        "listings": [
            {
                "id": 3,
                "userId": 11,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
                "image1Name": "urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
                "image2Name": "urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
                "image3Name": "urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
                "image4Name": "urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
                "image5Name": "urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
                "videoName": "1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
                "floorPlanName": "89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": true,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-12T10:42:38.222Z",
                "updatedAt": "2022-06-12T10:42:39.988Z"
            }
        ]
    },
    "error": []
}

Get Listing By Count (how many listings do you want)

GEThttps://urbancribs.onrender.com/api/v1/listings/count/get-by-count?count=1copy

The endpoint returns the number of listings specified from the database. The number of listings to be returned is passed as a url query value to the count key.

Request

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
count integer url optional The count of listings to be returned. If the count is greater than the total number of listings in the database, the total number of listings in the database will be returned. If no count is specified, the default count is 10.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/count/get-by-count?count=1
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 3,
        "listings": [
            {
                "id": 3,
                "userId": 11,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
                "image1Name": "urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
                "image2Name": "urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
                "image3Name": "urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
                "image4Name": "urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
                "image5Name": "urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
                "videoName": "1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
                "floorPlanName": "89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": true,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-12T10:42:38.222Z",
                "updatedAt": "2022-06-12T10:42:39.988Z"
            }
        ]
    },
    "error": []
}

Get Listings Paginated

GEThttps://urbancribs.onrender.com/api/v1/listings/paginate/all?page=2&&limit=1copy

The endpoint returns a paginated list of listings. Paginated by the page and limit (how many listings to return per page).

Request

Accept: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
page integer url optional The page number to return. Default is 1.
limit integer url optional The number of listings to return per page. Default is 10.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/paginate/all?page=2&&limit=1
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "page": "2",
        "listings": [
            {
                "id": 2,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "image1Name": "urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Name": "urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Name": "urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Name": "urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Name": "urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoName": "51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanName": "8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": true,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:42:57.733Z",
                "updatedAt": "2022-06-11T14:42:59.006Z"
            }
        ]
    },
    "error": []
}

Update Listing By Id

PUThttps://urbancribs.onrender.com/api/v1/listings/{id}copy

This endpoint allows you to update a listing by id. You can update the various fields of a listing. Fields that are not updated will remain the same. The endpoint requires a user to be logged in to perform this action, this will be checked by the server thereby ensuring that only the owner of the listing can update it.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization string header required This endpoint does require authorization token.
id integer url required The id of the listing you want to update.
all fields(fields created while creating the listing) string | integer | boolean body optional All fields that can be updated.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/3

{
    "category":"rent",
    "location":"Thika"
}
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listing updated successfully",
    "body": {
        "listing": {
            "id": 3,
            "userId": 11,
            "title": "Lari Estate",
            "description": "A new development in Kenya",
            "price": 24000,
            "bedrooms": 3,
            "bathrooms": 1,
            "sqft": 1200,
            "type": "house",
            "category": "rent",
            "yearBuilt": 2020,
            "parking": true,
            "pets": true,
            "furnished": false,
            "wifi": true,
            "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
            "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
            "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
            "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
            "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
            "videoUrl": "http://127.0.0.1:8000/uploads/1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
            "floorPlanUrl": "http://127.0.0.1:8000/uploads/89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
            "image1Name": "urbcrbs_d581c129-c3fd-45dd-81b4-dc6ad6bd1beb-.jpg",
            "image2Name": "urbcrbs_d9d59318-204c-4909-a8f7-c8c5de00a49b-.jpg",
            "image3Name": "urbcrbs_6d530d47-30b1-44bb-8060-24d965e19235-.jpg",
            "image4Name": "urbcrbs_006286b5-d73d-4913-b0f7-150866290cbb-.jpg",
            "image5Name": "urbcrbs_346962ed-c2b4-4adb-a47b-1f855df09166-.jpg",
            "videoName": "1241679d-a05a-4227-b3e4-9349f4a05815-.mp4",
            "floorPlanName": "89fc8c90-0841-4405-9a6d-3a40bca61f05-.pdf",
            "location": "Thika",
            "available": true,
            "city": "Nairobi",
            "featured": true,
            "createdBy": 12,
            "updatedBy": "johndoe6@gmail.com",
            "forRent": true,
            "forSale": false,
            "county": "Thika",
            "views": 11,
            "latitude": -1.03326,
            "longitude": 37.06933,
            "region": "Central",
            "published": false,
            "verified": false,
            "createdAt": "2022-06-12T10:42:38.222Z",
            "updatedAt": "2022-06-13T10:00:29.112Z"
        }
    },
    "error": []
}

Delete Listing By Id

DELETEhttps://urbancribs.onrender.com/api/v1/listings/{id}copy

This endpoint deletes a listing by id. The endpoint takes the id of the listing you want to delete. It checks if the listing exists and if the user is the owner of the listing. If the listing exists and the user is the owner or the user is admin, the listing is deleted.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization string header required This endpoint does require authorization token.
id integer url required The id of the listing you want to delete.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/3
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listing deleted successfully",
    "body": {},
    "error": []
}

Get Listings Lowest Priced First

GEThttps://urbancribs.onrender.com/api/v1/listings/lowest-price/allcopy

This endpoint returns all listings in the database sorted by price in ascending order.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/lowest-price/all
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Featured listings retrieved successfully",
    "body": {
        "count": 1,
        "listings": [
            {
                "id": 2,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "image1Name": "urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Name": "urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Name": "urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Name": "urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Name": "urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoName": "51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanName": "8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": true,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:42:57.733Z",
                "updatedAt": "2022-06-11T14:42:59.006Z"
            }
        ]
    },
    "error": []
}

Get Listings highest Priced First

GEThttps://urbancribs.onrender.com/api/v1/listings/price-range/all?min=10000&&max=111000&&page=2&&limit=1copy

This endpoint returns the listings in descending order of price. It takes two query parameters, page and limit. The page parameter is used to paginate the results. The limit parameter is used to limit the number of results returned. The default value for page is 1 and the default value for limit is 10.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
page integer url optional This parameter is used to paginate the results.
limit integer url optional This parameter is used to limit the results.
min integer url optional The minimum price of the range for the listings.
max integer url optional The maximum price of the range for the listings.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/price-range/all?min=10000&&max=111000&&page=2&&limit=1
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "page": "2",
        "listings": [
            {
                "id": 1,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "image1Name": "urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Name": "urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Name": "urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Name": "urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Name": "urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoName": "311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanName": "85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:09:03.274Z",
                "updatedAt": "2022-06-11T14:09:05.529Z"
            }
        ]
    },
    "error": []
}

Get Listings by number of bedrooms ascending

GEThttps://urbancribs.onrender.com/api/v1/listings/bedrooms-asc/allcopy

This endpoint returns all the listings in the database sorted by number of bedrooms in ascending order.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/bedrooms-asc/all
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "page": "2",
        "listings": [
            {
                "id": 1,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "image1Name": "urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Name": "urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Name": "urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Name": "urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Name": "urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoName": "311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanName": "85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:09:03.274Z",
                "updatedAt": "2022-06-11T14:09:05.529Z"
            }
        ]
    },
    "error": []
}

Get Listings by county

GEThttps://urbancribs.onrender.com/api/v1/listings/county/all?county=Mombasa&&page=2&&limit=10copy

This endpoint returns all listings in a county. It takes a county as a parameter. The county is a string.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
county string url optional The county where the listing is located.
page integer url optional The page number of the paginated results.
limit integer url optional The number of listings to return per page.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/county/all?county=Mombasa&&page=2&&limit=10
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "page": "2",
        "listings": [
            {
                "id": 1,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "image1Name": "urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Name": "urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Name": "urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Name": "urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Name": "urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoName": "311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanName": "85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:09:03.274Z",
                "updatedAt": "2022-06-11T14:09:05.529Z"
            }
        ]
    },
    "error": []
}

Get Listings by combination filters

GEThttps://urbancribs.onrender.com/api/v1/listings/combination-filters/all?page=1&&county=Nairobi&&location=Kasarani&&min=10000&&max=200000copy

This endpoint returns all listings that match the combination of filters provided. The response is paginated and in a descending order of createdAt thereby you get the most recent listings first that matches the filter.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
county string url optional The county where the listing is located.
page integer url optional The page number of the paginated results.
limit integer url optional The number of listings to return per page.
location integer url optional The location where the listing is located.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/combination-filters/all?page=1&&county=Nairobi&&location=Kasarani&&min=10000&&max=200000
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "page": "2",
        "listings": [
            {
                "id": 1,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "image1Name": "urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Name": "urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Name": "urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Name": "urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Name": "urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoName": "311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanName": "85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:09:03.274Z",
                "updatedAt": "2022-06-11T14:09:05.529Z"
            }
        ]
    },
    "error": []
}

Get Listings that are for rent

GEThttps://urbancribs.onrender.com/api/v1/listings/for-rent/allcopy

This endpoint returns all the listings that are for rent.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/for-rent/all
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "page": "2",
        "listings": [
            {
                "id": 1,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "image1Name": "urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Name": "urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Name": "urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Name": "urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Name": "urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoName": "311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanName": "85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:09:03.274Z",
                "updatedAt": "2022-06-11T14:09:05.529Z"
            }
        ]
    },
    "error": []
}

Get Listings that are for rent by price range

GEThttps://urbancribs.onrender.com/api/v1/listings/for-rent-price-range/all?min=1000&&max=100000copy

This endpoint returns all the listings that are for rent by price range.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
min integer url optional The minimum price of the listing.
max integer url optional The maximum price of the listing.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/for-rent-price-range/all?min=1000&&max=10000
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "page": "2",
        "listings": [
            {
                "id": 1,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "image1Name": "urbcrbs_76eefb12-6728-4443-91cd-0f2f79f7b58e-.jpg",
                "image2Name": "urbcrbs_da52d7c8-af4a-473c-aa35-50734583776b-.jpg",
                "image3Name": "urbcrbs_f6285f26-a34f-494d-924c-996c072d6718-.jpg",
                "image4Name": "urbcrbs_c6643755-fdb7-4418-971b-f2798de6ca11-.jpg",
                "image5Name": "urbcrbs_82e896ee-cee0-4ae9-9af0-50b798b4fa4f-.jpg",
                "videoName": "311710af-a0df-4c0c-b53b-d4abbe69615f-.mp4",
                "floorPlanName": "85c05f8b-a553-4ae8-aa78-77ee8ec0ae69-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:09:03.274Z",
                "updatedAt": "2022-06-11T14:09:05.529Z"
            }
        ]
    },
    "error": []
}

Get Listings that are for sale

GEThttps://urbancribs.onrender.com/api/v1/listings/for-sale/allcopy

This endpoint returns all the listings that are for rent by price range.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/for-sale/all
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 0,
        "listings": []
    },
    "error": []
}

Publish A Listing

PUThttps://urbancribs.onrender.com/api/v1/listings/make-published/4copy

This endpoint allows you to make a listing featured. Note that only the creator of the listing and admins can publish a listing.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization string header required This endpoint does require authorization token.
id integer url required The id of the listing you want to publish.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/make-published/4
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listing published successfully",
    "body": {
        "newListing": {
            "id": 4,
            "userId": 12,
            "title": "Lari Estate",
            "description": "A new development in Kenya",
            "price": 70000,
            "bedrooms": 3,
            "bathrooms": 1,
            "sqft": 1200,
            "type": "house",
            "category": null,
            "yearBuilt": 2020,
            "parking": true,
            "pets": true,
            "furnished": false,
            "wifi": true,
            "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_9ef2b9f8-0545-4b3a-b2d0-f65a1552368e-.jpg",
            "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_2478a51c-6c9b-4035-bada-873e22db737b-.jpg",
            "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_5508bafb-16c9-4235-8154-ba11ad1ffa9a-.jpg",
            "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_0e9fafd9-bac1-4ee7-b2df-963b7a9ae63e-.jpg",
            "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_8cc814d8-a4b5-4dbf-b429-3bad34eaaa9b-.jpg",
            "videoUrl": "http://127.0.0.1:8000/uploads/123f9d4e-7d81-45ba-ad0e-1d02574460a5-.mp4",
            "floorPlanUrl": "http://127.0.0.1:8000/uploads/efb6a015-a29c-4de5-8fc7-72b8d2e8b235-.pdf",
            "image1Name": "urbcrbs_9ef2b9f8-0545-4b3a-b2d0-f65a1552368e-.jpg",
            "image2Name": "urbcrbs_2478a51c-6c9b-4035-bada-873e22db737b-.jpg",
            "image3Name": "urbcrbs_5508bafb-16c9-4235-8154-ba11ad1ffa9a-.jpg",
            "image4Name": "urbcrbs_0e9fafd9-bac1-4ee7-b2df-963b7a9ae63e-.jpg",
            "image5Name": "urbcrbs_8cc814d8-a4b5-4dbf-b429-3bad34eaaa9b-.jpg",
            "videoName": "123f9d4e-7d81-45ba-ad0e-1d02574460a5-.mp4",
            "floorPlanName": "efb6a015-a29c-4de5-8fc7-72b8d2e8b235-.pdf",
            "location": "Kasarani Nairobi",
            "available": true,
            "city": "Nairobi",
            "featured": false,
            "createdBy": "johndoe6@gmail.com",
            "updatedBy": "johndoe6@gmail.com",
            "forRent": true,
            "forSale": false,
            "county": "Nairobi",
            "views": 0,
            "latitude": "-1.28333",
            "longitude": "36.81667",
            "region": "Nairobi Area",
            "published": true,
            "verified": false,
            "createdAt": "2022-06-13T12:01:22.370Z",
            "updatedAt": "2022-06-13T15:30:28.955Z"
        }
    },
    "error": []
}

Unpublish a listing

PUThttps://urbancribs.onrender.com/api/v1/listings/make-unpublished/4copy

This endpoint returns all listings in the database sorted by price in ascending order.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
id integer url required The id of the listing to be unpublished.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/make-unpublished/4
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Featured listings retrieved successfully",
    "body": {
        "count": 1,
        "listings": [
            {
                "id": 2,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "image1Name": "urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Name": "urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Name": "urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Name": "urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Name": "urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoName": "51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanName": "8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": true,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:42:57.733Z",
                "updatedAt": "2022-06-11T14:42:59.006Z"
            }
        ]
    },
    "error": []
}

Verify a listing

PUThttps://urbancribs.onrender.com/api/v1/listings/make-verified/4copy

This endpoint returns all listings in the database sorted by price in ascending order.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
id integer url required The id of the listing to be unpublished.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/make-verified/4
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Featured listings retrieved successfully",
    "body": {
        "count": 1,
        "listings": [
            {
                "id": 2,
                "userId": 5,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 24000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "image1Name": "urbcrbs_c138ebe8-5227-49d1-9c2d-50ef6287bd76-.jpg",
                "image2Name": "urbcrbs_980315ae-3f14-4108-98c9-d2c21ee22a56-.jpg",
                "image3Name": "urbcrbs_8b824bda-5787-4669-969a-bfe6781ebb01-.jpg",
                "image4Name": "urbcrbs_42dcb6f1-ab53-47c3-bd12-90c7f274a9cb-.jpg",
                "image5Name": "urbcrbs_a5fe1752-4824-40b6-9b6c-6bed54648dff-.jpg",
                "videoName": "51049e7e-cfc7-41f5-9c6f-34912052753c-.mp4",
                "floorPlanName": "8bf3f2ca-c452-4bba-8788-26a18b3e853c-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": true,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": false,
                "createdAt": "2022-06-11T14:42:57.733Z",
                "updatedAt": "2022-06-11T14:42:59.006Z"
            }
        ]
    },
    "error": []
}

Combination of search filters

GEThttps://urbancribs.onrender.com/api/v1/listings/filter/all?page=1&&limit=1&&county=Nairobi&&location=Kasa&&min=1000&&max=500000&&forRent=true&&type=housecopy

This endpoint returns all listings in the database sorted by price in ascending order.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization none none none This endpoint does not require authorization token.
page integer url optional The page of of the query. If not provided will default to page 1.
limit integer url optional How many results on one page. If not provided will default to 10.
county string url optional The county location of the listing. If not provided will default to Nairobi.
location string url optional The location of the listing. If not provided will default to Kasarani.
min integer url optional The minimun price range for the search. If not provided will default to 0.
max integer url optional The maximun price range for the search. If not provided will default to 1000000000000.
forRent boolean url optional The property is it for rent. If not provided will default to true else it is either true or false(which will mean it's for sale)
type string url optional The type of property (house, warehouse, apartment, land, commercial). If not provided will default to house.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/filter/all?page=1&&limit=1&&county=Nairobi&&location=Kasa&&min=1000&&max=500000&&forRent=true&&type=house
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Listings retrieved successfully",
    "body": {
        "count": 1,
        "listings": [
            {
                "id": 4,
                "userId": 12,
                "title": "Lari Estate",
                "description": "A new development in Kenya",
                "price": 70000,
                "bedrooms": 3,
                "bathrooms": 1,
                "sqft": 1200,
                "type": "house",
                "category": null,
                "yearBuilt": 2020,
                "parking": true,
                "pets": true,
                "furnished": false,
                "wifi": true,
                "image1Url": "http://127.0.0.1:8000/uploads/urbcrbs_9ef2b9f8-0545-4b3a-b2d0-f65a1552368e-.jpg",
                "image2Url": "http://127.0.0.1:8000/uploads/urbcrbs_2478a51c-6c9b-4035-bada-873e22db737b-.jpg",
                "image3Url": "http://127.0.0.1:8000/uploads/urbcrbs_5508bafb-16c9-4235-8154-ba11ad1ffa9a-.jpg",
                "image4Url": "http://127.0.0.1:8000/uploads/urbcrbs_0e9fafd9-bac1-4ee7-b2df-963b7a9ae63e-.jpg",
                "image5Url": "http://127.0.0.1:8000/uploads/urbcrbs_8cc814d8-a4b5-4dbf-b429-3bad34eaaa9b-.jpg",
                "videoUrl": "http://127.0.0.1:8000/uploads/123f9d4e-7d81-45ba-ad0e-1d02574460a5-.mp4",
                "floorPlanUrl": "http://127.0.0.1:8000/uploads/efb6a015-a29c-4de5-8fc7-72b8d2e8b235-.pdf",
                "image1Name": "urbcrbs_9ef2b9f8-0545-4b3a-b2d0-f65a1552368e-.jpg",
                "image2Name": "urbcrbs_2478a51c-6c9b-4035-bada-873e22db737b-.jpg",
                "image3Name": "urbcrbs_5508bafb-16c9-4235-8154-ba11ad1ffa9a-.jpg",
                "image4Name": "urbcrbs_0e9fafd9-bac1-4ee7-b2df-963b7a9ae63e-.jpg",
                "image5Name": "urbcrbs_8cc814d8-a4b5-4dbf-b429-3bad34eaaa9b-.jpg",
                "videoName": "123f9d4e-7d81-45ba-ad0e-1d02574460a5-.mp4",
                "floorPlanName": "efb6a015-a29c-4de5-8fc7-72b8d2e8b235-.pdf",
                "location": "Kasarani Nairobi",
                "available": true,
                "city": "Nairobi",
                "featured": false,
                "createdBy": "johndoe6@gmail.com",
                "updatedBy": "johndoe6@gmail.com",
                "forRent": true,
                "forSale": false,
                "county": "Nairobi",
                "views": 0,
                "latitude": "-1.28333",
                "longitude": "36.81667",
                "region": "Nairobi Area",
                "published": false,
                "verified": true,
                "createdAt": "2022-06-13T12:01:22.370Z",
                "updatedAt": "2022-06-13T17:18:55.870Z"
            }
        ]
    },
    "error": []
}

Add A Listing Review

POSThttps://urbancribs.onrender.com/api/v1/listings/reviews/{id}/addcopy

This endpoint allows you to add a review to a listing.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization string header required This endpoint does require authorization token.
id integer url required The id of the listing you want to add a review to.
review text body required The review you want to add to the listing.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/reviews/5/add
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Review added successfully",
    "body": {
        "newReview": {
            "id": 2,
            "listingId": 5,
            "userId": "12",
            "review": "A very good listing",
            "updatedAt": "2022-06-14T08:39:11.737Z",
            "createdAt": "2022-06-14T08:39:11.737Z"
        }
    },
    "error": []
}

Get Reviews For A Listing

GEThttps://urbancribs.onrender.com/api/v1/listings/reviews/{id}/allcopy

This endpoint allows you to get all reviews for a listing.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization string header required This endpoint does require authorization token.
id integer url required The id of the listing you want to get reviews for.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/reviews/5/all
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Review added successfully",
    "body": {
        "newReview": {
            "id": 2,
            "listingId": 5,
            "userId": "12",
            "review": "A very good listing",
            "updatedAt": "2022-06-14T08:39:11.737Z",
            "createdAt": "2022-06-14T08:39:11.737Z"
        }
    },
    "error": []
}

Delete A Listing Review

DELETEhttps://urbancribs.onrender.com/api/v1/listings/reviews/{id}/removecopy

This endpoint allows you to delete a review for a listing. Note that you can a user only delete their own review or admins can delete any review.

Request

Accept: application/json

Content-Type: application/json


Parameter Type Position # Description
Authorization string header required This endpoint does require authorization token.
id integer url required The id of the review you want to delete.
Sample Request
https://urbancribs.onrender.com/api/v1/listings/reviews/2/remove
                    
copy

Response

{
    "successful": true,
    "status": "success",
    "statusCode": 200,
    "message": "Review deleted successfully",
    "body": {},
    "error": []
}

The various status codes used and meaning are as follows:

# Code Meaning
1 200 successful
2 201 Created
3 202 Accepted
4 404 Not Found
5 401 Unauthorized
6 403 Forbidden
7 500 Internal Server Error