Searching and acquiring ground transport
Important notice
This website does not contain documentation of the newest features.
If you are a new user of the Kiwi.com
APIs, we highly recommend using
tequila.kiwi.com.
To access Tequila documentation, create an account.
If you have any questions, use the Tequila support page.
In this guide, we are going to demonstrate how you can find connections between specific locations (cities, bus stations, and train stations).
Acquiring city IDs with Locations API
The steps below guide you through the process of obtaining city IDs. A hypothetical travel from Prague to London is used as an example (substitute as necessary):
-
Make a GET request to the following URL:
https://api.skypicker.com/locations?
-
Add parameter
term
with valuePrague
. Add parameterlocations_type
with a valuecity
. -
Send the request.
Request example:
https://api.skypicker.com/locations?term=Prague&locations_type=city
-
In a response, find an ID of the city. In this case it is:
"id": "prague_cz"
-
Save the city ID (
prague_cz
) for later use. -
Repeat the second step. Add parameter
term
with valueLondon
.Request example:
https://api.skypicker.com/locations?term=London&locations_type=city
-
In a response, find an ID of the city. In this case it is:
"id": "london_gb",
-
Save the second city IDs for later use in the subchapter Searching connections between locations.
Acquiring station IDs with Locations API
Some of the railway and bus stations have standard IATA codes (e.g. Prague main train station has XYG
code).
Kiwi.com has its IDs for stations without IATA codes (e.g. Brno bus station - CZ-BRNO-BRN0
).
To find IDs of ground transport stations in a particular city follow the steps below (London is used as an example):
-
Make a GET request to the following URL:
https://api.skypicker.com/locations?
-
Add parameter
term
with value of the city ID from subchapter Acquiring city IDs with Locations API. In this example it islondon_gb
. Add parameterlocations_type
with a valuestation, bus_station
. Parameterstation
stands for train stations and parameterbus_station
, as it appears, stands for bus stations.Be aware that airports and train stations can also serve as bus stops. If an airport has a bus or train connection, it also serves as a train station (
station
) or bus station (bus_station
). Same applies for a train station with bus connection; the train station serves as a bus station as well. -
Send the request.
Request example:
https://api.skypicker.com/locations?term=london_gb&locations_type=station, bus_station
-
In a response, find the searched station. For example London Baker Street has an ID
GB-LOND-LON2
.
To use more parameters of Locations API see the following documentation: https://docs.kiwi.com/locations/
To get a list of all locations use dump request through locations API. See the following documentation location API.
Searching connections between locations
To find ground transport connections between locations:
-
Make a GET request to the following endpoint:
https://api.skypicker.com/flights?
-
Now use saved city IDs from subchapter Acquiring city IDs with Locations API. Set the first parameter as
fly_from
with valueprague_cz
. Set the second parameter asfly_to
with valuelondon_gb
-
Add parameter
v
with value3
. -
Add parameter as
vehicle_type
with valuetrain,bus
. -
Add parameter as
date_from
with value of the desired departure date. E.g.20/08/2020
. Add sixth parameter asdate_to
with value of the desired arrival date. E.g.27/08/2020
. -
To specify that the trip should take exactly seven days, add parameter as
nights_in_dst_from
with value 6. Add parameternights_in_dst_to
with value6
. -
Add parameter
partner
and set yourafil ID
as a value. -
Send the request.
Request example:
https://api.skypicker.com/flights?fly_from=prague_cz&fly_to=GB-LOND-LON2&v=3&vehicle_type=train,bus&date_from=20/08/2019&date_to=27/08/2019&nights_in_dst_from=6&nights_in_dst_to=6&partner=YOUR_AFFILID
Optionally, to find connections between stations (and not cities as demonstrated above) use station IDs from subchapter Acquiring station IDs with Locations API in the second step of Searching connections between locations.
To use more parameters of Flights API check the documentation: https://docs.kiwi.com/#flights
Links
-
To obtain a list of all carriers use our Airline API
-
To acquire logos of all carriers substitute
<iata_code>
in the following URL with the actual carrier code.https://images.kiwi.com/airlines/64/<iata_code>.png
Generated by aglio on 22 Feb 2022