Cancel a trip in realtime

Important: To cancel or suspend multiple related trips, such as “Cancel all the services for a day,” refer to Cancel trips with alerts.

To cancel a trip in realtime, select a trip with the TripDescriptor.  After the trip is selected, it can be canceled with either a ServiceAlerts or TripUpdates message.

Cancel with a service alert

Provide a service_alert message with a TripDescriptor that matches the affected trip and effect NO_SERVICE. If TripDescriptor is provided in an Alert EntitySelector, the schedule_relationship field is ignored. ServiceAlerts messages with effect value different from NO_SERVICE are only annotated with the alert information.

Trips canceled through service alerts are displayed in the disrupted services section of the results UI.

The recommended way to cancel a non-frequency based trip through an alert is to provide a descriptor that specifies both a trip_id and start_date. To avoid ambiguity, it’s strongly discouraged to provide a trip_id without a start_date. If you only provide the trip_id, the trip field may only resolve a single trip, which may be different from what you expected.

Example code:

alert {
  informed_entity {
    trip: {
      trip_id: "T"
      start_date: "20200818"
      start_time: "07:00:00"
    }
  effect: NO_SERVICE
}

Service alert examples

Example 1:

Example 2:

Cancel with a trip update

Provide a trip_update with TripDescriptor that matches the affected trip, and provide the schedule_relationship as CANCELED. The trip is then removed from search results. After the trip is removed, any updates for the trip must show that it’s canceled so that the search results remain accurate. Learn How data gaps affect realtime feeds.

Example code:

trip_update {
  trip {
    trip_id: “T”
    start_time: 12:34:56
    schedule_relationship: CANCELED
  }
}

Configure ServiceAlerts & TripUpdates

You can’t cancel a trip with the vehicle_position feed because a canceled trip can’t send vehicle position data for the vehicle on that trip. If you use the VehiclePosition feed to provide vehicle updates, then the ServiceAlerts or TripUpdate feed can be configured to provide only the cancellations. If you plan to use the TripUpdates feed to only provide cancellations, then reach out to the support team to set up a TripUpdates feed.

Need more help?

Try these next steps:

Is there something we can help you with?

Chat with a member of Transit team

Search
Clear search
Close search
Google apps
Main menu
10620832786511479115
true
Search Help Center
true
true
true
true
true
82656
false
false