> ## Documentation Index
> Fetch the complete documentation index at: https://rideshare.docs.sumit-dhondikar.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit Feedback

> Rate a completed ride and leave a comment.

Submit a rating and optional comment for a ride you participated in. The ride must be in `COMPLETED` status before feedback can be accepted.

**Authentication required** — include `Authorization: Bearer <token>` in the request header.

## Request

**`POST /rides/feedback/{rideId}`**

<ParamField path="rideId" type="number" required>
  The unique ID of the completed ride.
</ParamField>

<ParamField body="rating" type="integer" required>
  Your rating for the ride. Must be an integer between `1` and `5` (inclusive).
</ParamField>

<ParamField body="comment" type="string">
  Optional written feedback. Stored in `riderFeedback` on the ride (up to 600 characters).
</ParamField>

## Response

<ResponseField name="id" type="number">
  Unique ride identifier.
</ResponseField>

<ResponseField name="status" type="string">
  Remains `COMPLETED` after feedback is submitted.
</ResponseField>

<ResponseField name="riderRating" type="number">
  The rating you submitted (1–5).
</ResponseField>

<ResponseField name="riderFeedback" type="string">
  The comment you submitted, or an empty string if none was provided.
</ResponseField>

<ResponseField name="riderId" type="number">
  ID of the rider.
</ResponseField>

<ResponseField name="driverId" type="number">
  ID of the driver.
</ResponseField>

<ResponseField name="fare" type="number">
  Fare for the ride.
</ResponseField>

<ResponseField name="pickupLocation" type="string">
  Pickup address.
</ResponseField>

<ResponseField name="dropLocation" type="string">
  Drop-off address.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of ride creation.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "http://localhost:8080/rides/feedback/1021" \
    -H "Authorization: Bearer <token>" \
    -H "Content-Type: application/json" \
    -d '{
      "rating": 5,
      "comment": "Great driver, very smooth ride!"
    }'
  ```

  ```json Response theme={null}
  {
    "id": 1021,
    "status": "COMPLETED",
    "riderId": 42,
    "driverId": 7,
    "fare": 145.00,
    "pickupLocation": "MG Road, Bangalore",
    "dropLocation": "Indiranagar, Bangalore",
    "riderRating": 5,
    "riderFeedback": "Great driver, very smooth ride!",
    "createdAt": "2026-04-02T10:15:30Z"
  }
  ```
</CodeGroup>

<Note>
  Feedback can only be submitted for rides with status `COMPLETED`. Attempting to submit feedback on a ride in any other status returns a `400 Bad Request`.
</Note>

<Warning>
  If `rating` is missing, non-numeric, or outside the range 1–5, the server returns `400 Bad Request` with the message: `"Rating must be a number between 1 and 5."`
</Warning>

<Tip>
  Omitting the `comment` field is valid — the server stores an empty string for `riderFeedback` in that case. You must still provide a valid `rating`.
</Tip>
