Skip to main content
Two endpoints manage ride status: a public GET to read the current state of any ride, and an authenticated POST to drive the ride through its lifecycle. A separate GET /rides/requested endpoint lists all rides awaiting driver acceptance.

Get ride status

No authentication required — this is a public endpoint. GET /rides/status/{rideId}
rideId
number
required
The unique ID of the ride.

Response

Returns the full Ride object for the given rideId. Returns 404 if the ride does not exist.
id
number
Unique ride identifier.
status
string
Current status of the ride. One of REQUESTED, ACCEPTED, PICKED, COMPLETED, CANCELLED.
riderId
number
ID of the rider.
driverId
number
ID of the assigned driver, or null if not yet accepted.
fare
number
Fare for the ride.
createdAt
string
ISO 8601 timestamp of ride creation.
acceptedAt
string
ISO 8601 timestamp of when a driver accepted the ride, or null.

Example

curl -X GET "http://localhost:8080/rides/status/1021"

Update ride status

Authentication required — include Authorization: Bearer <token> in the request header. POST /rides/status/{rideId}
rideId
number
required
The unique ID of the ride to update.
status
string
required
The target status. Must be one of ACCEPTED, PICKED, COMPLETED, or CANCELLED.
driverId
string
Required when setting status to ACCEPTED. The ID of the driver accepting the ride.
otp
string
Required when setting status to PICKED or COMPLETED. Must match the corresponding OTP on the ride (startOtp for PICKED, endOtp for COMPLETED).

Status transitions

FromToRequired fields
REQUESTEDACCEPTEDdriverId
ACCEPTEDPICKEDotp (must match startOtp)
PICKEDCOMPLETEDotp (must match endOtp)
Any non-terminalCANCELLED

Response

Returns the updated Ride object with the new status applied.

Example

curl -X POST "http://localhost:8080/rides/status/1021" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "ACCEPTED",
    "driverId": "7"
  }'

List requested rides

No authentication required — this is a public endpoint. GET /rides/requested Returns all rides currently in REQUESTED status. Drivers use this endpoint to discover available rides.

Response

An array of Ride objects with status: "REQUESTED".

Example

curl -X GET "http://localhost:8080/rides/requested"
Sending an invalid OTP when transitioning to PICKED or COMPLETED returns a 400 Bad Request. The status is not updated.