Here we give you a comprehensive guide on how to use our API.
All requests to the endpoints should include a valid JWT in the Authorization
header.
Authorization: Bearer <JWT>
| Method | Route | Description |
|---|---|---|
GET |
/user |
Get the current user |
GET |
/user/email |
Get user by email |
POST |
/user |
Create a new user |
GET |
/user/requests/sent |
Retrieves all requests by this user |
GET |
/user/requests/received |
Retrieves all requests for this user |
GET |
/user/rides/created |
Retrieves all rides created by this user |
GET |
/user/rides/completed |
Retrieves all rides completed by this user |
GET |
/user/rides/joined |
Retrieves all rides joined by this user |
POST |
/user/bookmarks/create/:rideId |
Create a bookmark for a ride |
DELETE |
/user/bookmarks/delete/:rideId |
Delete a bookmark for a ride |
GET |
/user/bookmarks/get |
Get all user bookmarks |
POST |
/user/tokens |
Register Firebase Cloud Messaging token |
This endpoint reads the email from the authorization header and returns the user corresponding to that email.
No body required. Email is extracted from JWT.
{
phoneNumber: string;
name: string | null;
email: string;
}- 200: Success
- 400: Email not provided in JWT
- 404: User not found
This endpoint retrieves a user by their email address.
Query Parameters:
{
email: string; // Valid email address
}{
phoneNumber: string;
name: string | null;
email: string;
}- 200: Success
- 404: User not found
This endpoint creates a new user based on the email from the authorization header, and the name and phone number from the request body.
{
phoneNumber: string; // Exactly 10 digits, numeric only
name: string | null | undefined; // Optional, will use JWT name if not provided
}{
message: "User created successfully";
}- 201: User created successfully
- 400: Email not provided or invalid phone number format
- 409: User already exists
This endpoint returns all join requests sent by the current user.
No body required.
{
status: "accepted" | "declined" | "pending";
id: number;
createdBy: string;
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string;
rideEndLocation: string;
isBookmarked: boolean;
}
[];- 200: Success
- 400: Email not provided
- 404: No requests found
This endpoint returns all join requests received by the current user (user is the ride owner).
No body required.
{
requestSender: string; // Email of user who sent request
status: "accepted" | "declined" | "pending";
id: number;
createdBy: string;
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string;
rideEndLocation: string;
isBookmarked: boolean;
}
[];- 200: Success
- 400: Email not provided
- 404: No requests found
All rides which have been created by the current user.
No body required.
{
id: number;
createdBy: string;
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string;
rideEndLocation: string;
isBookmarked: boolean;
}
[];- 200: Success
- 400: Email not provided
- 404: User has not created any rides
All rides which have been completed by the current user (rides where departureEndTime is in the past).
No body required.
{
id: number;
createdBy: string;
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string;
rideEndLocation: string;
isBookmarked: boolean;
}
[];- 200: Success
- 400: Email not provided
- 404: User has not completed any rides
All rides which have been joined by the current user (excluding rides they created).
No body required.
{
id: number;
createdBy: string;
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string;
rideEndLocation: string;
isBookmarked: boolean;
}
[];- 200: Success
- 400: Email not provided
- 404: User has not joined any rides
Allows a user to create a bookmark for a ride.
URL Parameters:
{
rideId: number; // Ride ID to bookmark
}No body required.
{
message: "Bookmark Created Successfully.";
}- 200: Success
- 400: Email not provided
- 404: Ride not found
Allows a user to delete a bookmark for a ride.
URL Parameters:
{
rideId: number; // Ride ID to unbookmark
}No body required.
Empty response on success.
- 200: Success
- 400: Email not provided
- 404: Bookmark not found
Gets all bookmarks for the current user.
No body required.
{
id: number;
createdBy: string;
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string;
rideEndLocation: string;
isBookmarked: boolean; // Always true for bookmarked rides
}
[];- 200: Success
- 400: Email not provided
- 404: No bookmarks found for user
Register a Firebase Cloud Messaging (FCM) device token for push notifications.
{
token: string; // FCM device token from Firebase
}Empty response on success.
- 200: Success
- 400: Email not provided
| Method | Route | Description |
|---|---|---|
GET |
/rides/get/:rideId |
Get a specific ride by ID |
POST |
/rides/create |
Create a new ride |
POST |
/rides/request/:rideId |
Create a ride request |
DELETE |
/rides/request/:rideId |
Cancel a ride request |
DELETE |
/rides/exit/:rideId |
Leave a ride |
GET |
/rides/search |
Search for rides |
GET |
/rides/members/:rideId |
Get all members of ride |
GET |
/rides/search/location |
Search locations by name |
POST |
/rides/manage/requests/:rideId |
Accept/Deny ride request |
PUT |
/rides/manage/update/:rideId |
Update a ride |
DELETE |
/rides/manage/delete/:rideId |
Delete a ride |
DELETE |
/rides/manage/dismiss/:rideId |
Remove a user from a ride |
Retrieves a specific ride by its ID.
URL Parameters:
{
rideId: number; // Ride ID
}No body required.
{
id: number;
createdBy: string; // Email of ride creator
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string; // Location name or ID
rideEndLocation: string; // Location name or ID
isBookmarked: boolean;
}- 200: Success
- 400: Email not provided
- 404: Ride not found
Creates a new ride. The current user is automatically added as a ride member.
{
departureStartTime: string; // ISO datetime, must be >= now
departureEndTime: string; // ISO datetime, must be > departureStartTime
comments: string | null; // Optional comments about the ride
maxMemberCount: number; // Must be >= 1 (includes creator)
rideStartLocation: string; // Starting location name
rideEndLocation: string; // Ending location name
}Empty response on success.
- 200: Success
- 400: Email not provided or invalid times/parameters
- 409: Conflict with data
Sends a request to join a ride. Ride owner will receive a notification.
URL Parameters:
{
rideId: number; // Ride ID to request join
}No body required.
Empty response on success.
- 200: Success (or already requested)
- 400: Email not provided
- 404: Ride not found
- 409: User is already a member or ride is full
- 503: Ride is full
Cancels a pending join request. Can only delete requests that haven't been reviewed yet.
URL Parameters:
{
rideId: number; // Ride ID to cancel request for
}No body required.
Empty response on success.
- 200: Success
- 400: Email not provided
- 404: Request not found
- 423: Cannot delete request (already accepted or declined)
Allows a user to leave a ride. Ride owners cannot leave (must delete instead). Notifies ride owner and members.
URL Parameters:
{
rideId: number; // Ride ID to exit
}No body required.
Empty response on success.
- 200: Success
- 400: Email not provided
- 404: Ride not found or user not a member
- 409: User is the ride owner
Searches for rides based on location and time. Uses fuzzy matching on location names.
Query Parameters:
{
searchStartLocation: string; // Starting location to search for
searchEndLocation: string; // Ending location to search for
from?: string; // ISO datetime - find rides departing around this time
by?: string; // ISO datetime - find rides arriving around this time
// Note: Exactly one of 'from' or 'by' must be provided
}No body required.
{
id: number;
createdBy: string;
comments: string | null;
departureStartTime: string; // ISO datetime
departureEndTime: string; // ISO datetime
maxMemberCount: number;
rideStartLocation: string;
rideEndLocation: string;
isBookmarked: boolean;
}
[];
// Results are ordered by location similarity (highest first), then by time proximity- 200: Success (may return empty array)
- 400: Email not provided or invalid query parameters
Gets all members of a specific ride.
URL Parameters:
{
rideId: number; // Ride ID
}No body required.
{
phoneNumber: string;
name: string | null;
email: string;
}
[];- 200: Success
- 404: Ride not found
Searches for locations by name using fuzzy matching. Returns up to 5 results.
Query Parameters:
{
searchParam: string; // Location name to search for
}string[]; // list of locations- 200: Success (may return empty array)
- 400: Email not provided
Accept or decline a join request for a ride. Only the ride owner can perform this action.
URL Parameters:
{
rideId: number; // Ride ID
}Body:
{
requestUserEmail: string; // Email of user whose request to handle
status: "accepted" | "declined"; // Action to take
}Empty response on success.
- 200: Success
- 400: Email not provided
- 401: User is not the ride owner
- 404: Ride or request not found
- 409: User is already a member
- 503: Ride is full (cannot accept)
Updates ride details. Only the ride owner can perform this action. At least one field must be provided.
URL Parameters:
{
rideId: number; // Ride ID
}Body (all fields optional, but at least one required):
{
departureStartTime?: string; // ISO datetime
departureEndTime?: string; // ISO datetime
comments?: string | null; // Update comments
maxMemberCount?: number; // Must be >= current member count
rideStartLocation?: string; // New start location
rideEndLocation?: string; // New end location
}Empty response on success.
- 200: Success
- 400: Email not provided, no fields provided, or invalid data
- 401: User is not the ride owner
- 404: Ride not found
- 409: Max member count less than current members
Deletes a ride. Only the ride owner can perform this action. All members are notified. Cascade deletes members and requests.
URL Parameters:
{
rideId: number; // Ride ID to delete
}No body required.
Empty response on success.
- 200: Success
- 400: Email not provided
- 401: User is not the ride owner
- 404: Ride not found
Removes a user from a ride. Only the ride owner can perform this action. The ride owner cannot be dismissed.
URL Parameters:
{
rideId: number; // Ride ID
}Body:
{
dismissUserEmail: string; // Email of user to remove from ride
}Empty response on success.
- 200: Success
- 400: Email not provided
- 401: User is not the ride owner
- 404: Ride not found or user not a member
- 409: Cannot dismiss the ride owner