Registers a new user by creating a user account with the provided information.
POST
The request body should be in JSON format and include the following fields:
fullname
(object):firstname
(string, required): User's first name (minimum 3 characters).lastname
(string, optional): User's last name (minimum 3 characters).
email
(string, required): User's email address (must be a valid email).password
(string, required): User's password (minimum 6 characters).
user
(object):fullname
(object).firstname
(string): User's first name (minimum 3 characters).lastname
(string): User's last name (minimum 3 characters).
email
(string): User's email address (must be a valid email).password
(string): User's password (minimum 6 characters).
token
(String): JWT Token
Authenticates a user using their email and password, returning a JWT token upon successful login.
POST
/users/login
The request body should be in JSON format and include the following fields:
email
(string, required): User's email address (must be a valid email).password
(string, required): User's password (minimum 6 characters).
user
(object):fullname
(object).firstname
(string): User's first name (minimum 3 characters).lastname
(string): User's last name (minimum 3 characters).
email
(string): User's email address (must be a valid email).password
(string): User's password (minimum 6 characters).
token
(String): JWT Token
Retrieves the profile information of the currently authenticated user.
GET
Requires a valid JWT token in the Authorization header:
Authorization: Bearer <token>
user
(object):fullname
(object).firstname
(string): User's first name (minimum 3 characters).lastname
(string): User's last name (minimum 3 characters).
email
(string): User's email address (must be a valid email).
Logout the current user and blacklist the token provided in cookie or headers
GET
Requires a valid JWT token in the Authorization header or cookie:
user
(object):fullname
(object).firstname
(string): User's first name (minimum 3 characters).lastname
(string): User's last name (minimum 3 characters).
email
(string): User's email address (must be a valid email).password
(string): User's password (minimum 6 characters).
token
(String): JWT Token##/captains/register
Endpoint
Registers a new captain by creating a captain account with the provided information.
POST
The request body should be in JSON format and include the following fields:
fullname
(object):firstname
(string, required): Captain's first name (minimum 3 characters)lastname
(string, optional): Captain's last name
email
(string, required): Captain's email address (must be a valid email)password
(string, required): Captain's password (minimum 6 characters)vehicle
(object):color
(string, required): Vehicle color (minimum 3 characters)plate
(string, required): Vehicle plate number (minimum 3 characters)capacity
(number, required): Vehicle passenger capacity (minimum 1)vehicleType
(string, required): Type of vehicle (must be 'car', 'motorcycle', or 'auto')
Registers a new captain by creating a captain account with the provided information.
POST
The request body should be in JSON format and include the following fields:
fullname
(object):firstname
(string, required): Captain's first name (minimum 3 characters).lastname
(string, optional): Captain's last name (minimum 3 characters).
email
(string, required): Captain's email address (must be a valid email).password
(string, required): Captain's password (minimum 6 characters).vehicle
(object):color
(string, required): Vehicle color (minimum 3 characters).plate
(string, required): Vehicle plate number (minimum 3 characters).capacity
(number, required): Vehicle passenger capacity (minimum 1).vehicleType
(string, required): Type of vehicle (must be 'car', 'motorcycle', or 'auto').
captain
(object):fullname
(object).firstname
(string): Captain's first name (minimum 3 characters).lastname
(string): Captain's last name (minimum 3 characters).
email
(string): Captain's email address (must be a valid email).password
(string): Captain's password (minimum 6 characters).vehicle
(object):color
(string): Vehicle color.plate
(string): Vehicle plate number.capacity
(number): Vehicle passenger capacity.vehicleType
(string): Type of vehicle.
token
(String): JWT Token
Authenticates a captain using their email and password, returning a JWT token upon successful login.
POST
/captains/login
The request body should be in JSON format and include the following fields:
email
(string, required): Captain's email address (must be a valid email).password
(string, required): Captain's password (minimum 6 characters).
captain
(object):fullname
(object).firstname
(string): Captain's first name (minimum 3 characters).lastname
(string): Captain's last name (minimum 3 characters).
email
(string): Captain's email address (must be a valid email).password
(string): Captain's password (minimum 6 characters).vehicle
(object):color
(string): Vehicle color.plate
(string): Vehicle plate number.capacity
(number): Vehicle passenger capacity.vehicleType
(string): Type of vehicle.
token
(String): JWT Token
Retrieves the profile information of the currently authenticated captain.
GET
Requires a valid JWT token in the Authorization header:
Authorization: Bearer <token>
captain
(object):fullname
(object).firstname
(string): Captain's first name (minimum 3 characters).lastname
(string): Captain's last name (minimum 3 characters).
email
(string): Captain's email address (must be a valid email).vehicle
(object):color
(string): Vehicle color.plate
(string): Vehicle plate number.capacity
(number): Vehicle passenger capacity.vehicleType
(string): Type of vehicle.
Logout the current captain and blacklist the token provided in cookie or headers.
GET
Requires a valid JWT token in the Authorization header or cookie.
message
(string): Logout successfully.
Retrieves the coordinates (latitude and longitude) for a given address.
GET
address
(string, required): The address for which to retrieve coordinates.
GET /maps/get-coordinates?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA
{
"ltd": 37.4224764,
"lng": -122.0842499
}
400 Bad Request
: If the address parameter is missing or invalid.404 Not Found
: If the coordinates for the given address could not be found.
{
"message": "Coordinates not found"
}
Retrieves the distance and estimated travel time between two locations.
GET
origin
(string, required): The starting address or location.destination
(string, required): The destination address or location.
GET /maps/get-distance-time?origin=New+York,NY&destination=Los+Angeles,CA
{
"distance": {
"text": "2,789 miles",
"value": 4486540
},
"duration": {
"text": "1 day 18 hours",
"value": 154800
}
}
400 Bad Request
: If the origin or destination parameter is missing or invalid.404 Not Found
: If the distance and time for the given locations could not be found.
{
"message": "No routes found"
}
Retrieves autocomplete suggestions for a given input string.
GET
input
(string, required): The input string for which to retrieve suggestions.
GET /maps/get-suggestions?input=1600+Amphitheatre
[
"1600 Amphitheatre Parkway, Mountain View, CA, USA",
"1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA"
]
400 Bad Request
: If the input parameter is missing or invalid.500 Internal Server Error
: If there is an error retrieving suggestions.
{
"message": "Unable to fetch suggestions"
}
Creates a new ride with the provided information.
POST
Requires a valid JWT token in the Authorization header:
Authorization: Bearer <token>
The request body should be in JSON format and include the following fields:
pickup
(string, required): The pickup address (minimum 3 characters).destination
(string, required): The destination address (minimum 3 characters).vehicleType
(string, required): The type of vehicle (must be 'auto', 'car', or 'moto').
ride
(object):user
(string): User ID.pickup
(string): Pickup address.destination
(string): Destination address.fare
(number): Fare amount.status
(string): Ride status.duration
(number): Duration in seconds.distance
(number): Distance in meters.otp
(string): OTP for the ride.
400 Bad Request
: If any required field is missing or invalid.500 Internal Server Error
: If there is an error creating the ride.
{
"message": "Error message"
}
Retrieves the fare estimate for a ride between the provided pickup and destination addresses.
GET
Requires a valid JWT token in the Authorization header: `Authorization:
Bear
er `
pickup
(string, required): The pickup address (minimum 3 characters).destination
(string, required): The destination address (minimum 3 characters).
GET /rides/get-fare?pickup=1600+Amphitheatre+Parkway,+Mountain+View,+CA&destination=1+Infinite+Loop,+Cupertino,+CA
{
"auto": 50.0,
"car": 75.0,
"moto": 40.0
}
400 Bad Request
: If any required parameter is missing or invalid.500 Internal Server Error
: If there is an error calculating the fare.
{
"message": "Error message"
}