trip
queryInput type for executing a travel search for a trip between two locations. Returns trip patterns describing suggested alternatives for the trip.
The date and time for the earliest time the user is willing to start the journey (if false or not set) or the latest acceptable time of arriving (true). Defaults to now.
The date and time for the latest time the user is expected to book the journey.
Normally this is when the search is performed (now), plus a small grace period to
complete the booking. Services which must be booked before this time is excluded. The
latestBookingTime and minimumBookingPeriod in BookingArrangement (flexible
services only) are used to enforce this. If this parameter is not set, no booking-time
restrictions are applied - all journeys are listed.
The length of the search-window in minutes. This parameter is optional.
The search-window is defined as the duration between the earliest-departure-time (EDT)
and the latest-departure-time (LDT). OTP will search for all itineraries in this
departure window. If arriveBy=true the dateTime parameter is the
latest-arrival-time, so OTP will dynamically calculate the EDT. Using a short
search-window is faster than using a longer one, but the search duration is not linear.
Using a "too" short search-window will waste resources server side, while using a
search-window that is too long will be slow.
OTP will dynamically calculate a reasonable value for the search-window, if not
provided. The calculation comes with a significant overhead (10-20% extra). Whether
you should use the dynamic calculated value or pass in a value depends on your use-case.
For a travel planner in a small geographical area, with a dense network of public
transportation, a fixed value between 40 minutes and 2 hours makes sense. To find the
appropriate search-window, adjust it so that the number of itineraries on average is
around the wanted numTripPatterns. Make sure you set the numTripPatterns to a high
number while testing. For a country wide area like Norway, using the dynamic
search-window is the best.
When paginating, the search-window is calculated using the numTripPatterns in the
original search together with statistics from the search for the last page. This
behaviour is configured server side, and can not be overridden from the client. The
paging may even exceed the maximum value.
The search-window used is returned to the response metadata as searchWindowUsed.
This can be used by the client to calculate the when the next page start/end.
Note! In some cases you may have to page many times to get all the results you want. This is intended. Increasing the search-window beyond the max value is NOT going to be much faster. Instead the client can inform the user about the progress.
Maximum value: 2880 minutes (48h)
Use the cursor to go to the next "page" of itineraries. Copy the cursor from the last
response and keep the original request as is. This will enable you to search for
itineraries in the next or previous search-window. The paging will automatically scale
up/down the search-window to fit the numTripPatterns.
Search for the best trip options within a time window. If true two TripPatterns are considered optimal if one is better on arrival time(earliest wins) and the other is better on departure time (latest wins).In combination with arriveBy this parameter cover the following 3 use cases:
-
Traveler want to find the best alternative within a time window. Set
timetableView=trueandarriveBy=false. This is the default, and if the intention of the traveler is unknown it gives the best result, because it includes the two next use-cases. This option also work well with paging. Setting thearriveBy=true, covers the same use-case, but the input time is interpreted as latest-arrival-time, and not earliest-departure-time. -
Traveler want to find the best alternative with departure after a specific time. For example: I am at the station now and want to get home as quickly as possible. Set
timetableView=falseandarriveBy=false. Do not support paging. -
Traveler want to find the best alternative with arrival before a specific time. For example going to a meeting. Set
timetableView=falseandarriveBy=true. Do not support paging.
Default: true
The list of via locations the journey is required to visit. All locations are visited in the order they are listed.
Whether the trip should depart at dateTime (false, the default), or arrive at dateTime. See timetableView for use-cases where this parameter is relevant.
Whether the trip must be wheelchair accessible. Supported for the street part to the search, not implemented for the transit yet.
The preferable language to use for text targeted the end user. Note! The data quality is limited, only stop and quay names are translates, and not in all places of the API.
The set of access/egress/direct/transit modes to be used for this search. Note that this only works at the Line level. If individual ServiceJourneys have modes that differ from the Line mode, this will NOT be accounted for.
A list of filters for which trips should be included. A trip will be included if it matches with at least one filter. An empty list of filters means that all trips should be included. If a search include this parameter, "whiteListed", "banned" & "modes.transportModes" filters will be ignored.
Relax generalized-cost when comparing trips with a different set of transit-group-priorities. The groups are set server side for service-journey and can not be configured in the API. This mainly helps to return competition neutral services. Long distance authorities are put in different transit-groups.
This relaxes the comparison inside the routing engine for each stop-arrival. If two paths have a different set of transit-group-priorities, then the generalized-cost comparison is relaxed. The final set of paths are filtered through the normal itinerary-filters.
- The
ratiomust be greater or equal to 1.0 and less then 1.2. - The
constantmust be greater or equal to '0s' and less then '1h'.
Wait cost is multiplied by this value. Setting this to a value lower than 1 indicates that waiting is better than staying on a vehicle. This should never be set higher than walkReluctance, since that would lead to walking down a line to avoid waiting.
Bicycle routing preferences. If not provided, default values from the server configuration will be used. Deprecated top-level bike fields (bikeSpeed, bicycleOptimisationMethod, triangleFactors) take precedence if explicitly provided.
Scooter routing preferences. If not provided, default values from the server configuration will be used.
An extra penalty added on transfers (i.e. all boardings except the first one). The transferPenalty is used when a user requests even less transfers. In the latter case, we don't actually optimise for fewest transfers, as this can lead to absurd results. Consider a trip in New York from Grand Army Plaza (the one in Brooklyn) to Kalustyan's at noon. The true lowest transfers trip pattern is to wait until midnight, when the 4 train runs local the whole way. The actual fastest trip pattern is the 2/3 to the 4/5 at Nevins to the 6 at Union Square, which takes half an hour. Even someone optimise for fewest transfers doesn't want to wait until midnight. Maybe they would be willing to walk to 7th Ave and take the Q to Union Square, then transfer to the 6. If this takes less than transferPenalty seconds, then that's what we'll return.
An expected transfer time (in seconds) that specifies the amount of time that must pass between exiting one public transport vehicle and boarding another. This time is in addition to time it might take to walk between stops.
The boardSlack is the minimum extra time to board a public transport vehicle. This is the same as the 'minimumTransferTime', except that this also applies to to the first transit leg in the trip. This is the default value used, if not overridden by the 'boardSlackList'.
The alightSlack is the minimum extra time after exiting a public transport vehicle. This is the default value used, if not overridden by the 'alightSlackList'.
The maximum number of trip patterns to return. Note! This reduce the number of trip patterns AFTER the OTP travel search is done in a post-filtering process. There is little/no performance gain in reducing the number of trip patterns returned. See also the trip meta-data on how to implement paging.
Maximum number of transfers. Note! The best way to reduce the number of transfers is to set the transferPenalty parameter.
Maximum number of additional transfers compared to the best number of transfers allowed. Note! The best way to reduce the number of transfers is to set the transferPenalty parameter.
Configure the itinerary-filter-chain. NOTE! THESE PARAMETERS ARE USED FOR SERVER-SIDE TUNING AND IS AVAILABLE HERE FOR TESTING ONLY.
accessEgressPenalty·[PenaltyForStreetMode]!= [{streetMode: car_park, timePenalty: "20m + 2.0 t", costFactor: 1.5}, {streetMode: car_pickup, timePenalty: "20m + 2.0 t", costFactor: 1.5}, {streetMode: car_rental, timePenalty: "20m + 2.0 t", costFactor: 1.5}, {streetMode: flexible, timePenalty: "10m + 1.3 t", costFactor: 1.3}, {streetMode: taxi, timePenalty: "20m + 2.0 t", costFactor: 1.5}]Time and cost penalty on access/egress modes.
maxAccessEgressDurationForMode·[StreetModeDurationInput]!= [{streetMode: bike_rental, duration: "PT20M"}, {streetMode: scooter_rental, duration: "PT20M"}, {streetMode: car, duration: "PT3H"}]Maximum duration for access/egress for street searches per respective mode. Cannot be higher than default value. This is a performance optimisation parameter, avoid using it to limit the search.
Use the cursor to get the previous page of results. Use this cursor for the pageCursor parameter in the trip query in order to get the previous page. The previous page is a set of itineraries departing BEFORE the first itinerary in this result.