Ratings¶
Post-ride ratings for drivers and customers. Both parties can rate after a ride reaches COMPLETED status.
Submit a rating¶
POST /api/rides/{rideId}/rate 🔒 CUSTOMER or DRIVER
Submits a rating for a completed ride. Each user can only rate once per ride.
The ratee is resolved automatically based on the caller's role: - CUSTOMER rates → driver receives the rating - DRIVER rates → customer receives the rating
Path parameter: rideId — must be a ride in COMPLETED status
Request body
json
{
"score": 5,
"comment": "Smooth ride, great driver."
}
| Field | Type | Constraints |
|---|---|---|
score |
integer | Required. Min: 1, Max: 5 |
comment |
string | Optional. Max 500 characters |
Response 201 Created
json
{
"id": 88,
"rideId": 42,
"raterId": 3,
"rateeId": 7,
"score": 5,
"comment": "Smooth ride, great driver.",
"createdAt": "2026-04-02T15:30:00"
}
Error responses
| Status | Condition |
|---|---|
400 Bad Request |
score out of 1–5 range or comment exceeds 500 chars |
404 Not Found |
Ride not found |
409 Conflict |
Ride is not COMPLETED |
409 Conflict |
Caller already rated this ride |
409 Conflict |
Caller is not a participant of this ride |
409 Conflict |
Ride has no assigned driver (customer trying to rate) |
Get driver rating¶
GET /api/drivers/{driverId}/rating Public
Returns the aggregate rating for a driver across all completed rides.
Path parameter: driverId — the driver's numeric ID
Response 200 OK
json
{
"driverId": 7,
"averageScore": 4.8,
"totalRatings": 142
}
averageScore is rounded to one decimal place. Returns null if the driver has no ratings yet.
Error responses
| Status | Condition |
|---|---|
404 Not Found |
Driver not found |