Fleet Engine provides the `SearchTripsRequest` endpoint that you can use to find
trips. This document describes two scenarios where you might use this feature.

See `SearchTripsRequest` for [gRPC](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1.md.txt#searchtripsrequest) or `trips.Search` for [REST](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.trips/search.md.txt).

> [!NOTE]
> **Note:** Trips remain active in Fleet Engine for 7 days, after which they are deleted, so `SearchTrips` only shows trips that have been active within the past 7 days.

## Determine active trips for a vehicle

To do find the active trips for a specific fields, use the `SearchTripsRequest`
message to set the `vehicle_id` to the vehicle under consideration and set
`active_trips_only` to `true`.

## Reconcile vehicle availability between your system and Fleet Engine

In some situations, you might see results returned by `SearchVehicles` that
don't correspond with the vehicles you know to be available in your system and
your fleet. This happens because `SearchVehicles` either doesn't show vehicles
with active trips, or pushes them down in the results ranking. One cause of this
is when vehicles have completed trips, but the trip status not been properly set
to either `COMPLETE` or `CANCELED`. By using `SearchTrips` to find open trips,
you can evaluate vehicles to ensure that `TripStatus` in your system matches
that of Fleet Engine.

To use `SearchTrips` in this way, set the following in the `SearchTripsRequest`
message:

- `vehicle_id` should be empty.
- `active_trips_only` should be `true`.
- `minimum_staleness` should be a time greater than most trip durations; for example, one hour.

The results of such a request include Trips that are neither `COMPLETE` nor
`CANCELED`, and have not been updated in over an hour. You can then examine
these trips to ensure that their status in Fleet Engine is properly updated.

## What's next

- [Delete Trip](https://developers.google.com/maps/documentation/mobility/fleet-engine/journeys/trips/delete-trip.md.txt)