curl --request POST \
--url https://api.anysite.io/api/rome2rio/routes/search \
--header 'Content-Type: application/json' \
--header 'access-token: <api-key>' \
--data '
{
"count": 2,
"timeout": 300,
"origin": "<string>",
"origin_pos": "<string>",
"destination": "<string>",
"destination_pos": "<string>",
"currency": "USD",
"language_code": "en"
}
'import requests
url = "https://api.anysite.io/api/rome2rio/routes/search"
payload = {
"count": 2,
"timeout": 300,
"origin": "<string>",
"origin_pos": "<string>",
"destination": "<string>",
"destination_pos": "<string>",
"currency": "USD",
"language_code": "en"
}
headers = {
"access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
count: 2,
timeout: 300,
origin: '<string>',
origin_pos: '<string>',
destination: '<string>',
destination_pos: '<string>',
currency: 'USD',
language_code: 'en'
})
};
fetch('https://api.anysite.io/api/rome2rio/routes/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.anysite.io/api/rome2rio/routes/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'count' => 2,
'timeout' => 300,
'origin' => '<string>',
'origin_pos' => '<string>',
'destination' => '<string>',
'destination_pos' => '<string>',
'currency' => 'USD',
'language_code' => 'en'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.anysite.io/api/rome2rio/routes/search"
payload := strings.NewReader("{\n \"count\": 2,\n \"timeout\": 300,\n \"origin\": \"<string>\",\n \"origin_pos\": \"<string>\",\n \"destination\": \"<string>\",\n \"destination_pos\": \"<string>\",\n \"currency\": \"USD\",\n \"language_code\": \"en\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.anysite.io/api/rome2rio/routes/search")
.header("access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"count\": 2,\n \"timeout\": 300,\n \"origin\": \"<string>\",\n \"origin_pos\": \"<string>\",\n \"destination\": \"<string>\",\n \"destination_pos\": \"<string>\",\n \"currency\": \"USD\",\n \"language_code\": \"en\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anysite.io/api/rome2rio/routes/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"count\": 2,\n \"timeout\": 300,\n \"origin\": \"<string>\",\n \"origin_pos\": \"<string>\",\n \"destination\": \"<string>\",\n \"destination_pos\": \"<string>\",\n \"currency\": \"USD\",\n \"language_code\": \"en\"\n}"
response = http.request(request)
puts response.read_body[
{
"@type": "Rome2RioRoute",
"name": "<string>",
"canonical_name": "<string>",
"grouping_key": "<string>",
"duration": 123,
"is_connectable": true,
"transport_kinds": [],
"transfer_durations": [],
"origin": {
"@type": "Rome2RioPlace",
"short_name": "<string>",
"canonical_name": "<string>",
"kind": "<string>",
"code": "<string>",
"country_code": "<string>",
"time_zone": "<string>",
"latitude": 123,
"longitude": 123,
"radius": 123,
"nearby_city": "<string>"
},
"destination": {
"@type": "Rome2RioPlace",
"short_name": "<string>",
"canonical_name": "<string>",
"kind": "<string>",
"code": "<string>",
"country_code": "<string>",
"time_zone": "<string>",
"latitude": 123,
"longitude": 123,
"radius": 123,
"nearby_city": "<string>"
},
"indicative_prices": [],
"booking_links": [],
"booking_configuration": {
"@type": "Rome2RioBookingConfiguration",
"max_passengers": 123,
"default_passenger_age": 123,
"age_groups": []
},
"transit_guides": [],
"segments": []
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}/rome2rio/routes/search
Plan all the ways to travel between two places with Rome2Rio’s multimodal trip planner. Give an origin and destination by name or by coordinates and get every ranked route (train, bus, drive, fly, ferry, rideshare and combinations) with total duration, indicative price ranges by class and currency, per-leg segments and transfers, the transport mode and operating carrier of each leg, service frequency and operating days, the boarding and alighting stops, ticket booking deeplinks and the map polyline of each line. Prices are indicative ranges, not live fares.
Price: 5 credits
⚠️ Common errors: 412: No routes found between the given origin and destination
curl --request POST \
--url https://api.anysite.io/api/rome2rio/routes/search \
--header 'Content-Type: application/json' \
--header 'access-token: <api-key>' \
--data '
{
"count": 2,
"timeout": 300,
"origin": "<string>",
"origin_pos": "<string>",
"destination": "<string>",
"destination_pos": "<string>",
"currency": "USD",
"language_code": "en"
}
'import requests
url = "https://api.anysite.io/api/rome2rio/routes/search"
payload = {
"count": 2,
"timeout": 300,
"origin": "<string>",
"origin_pos": "<string>",
"destination": "<string>",
"destination_pos": "<string>",
"currency": "USD",
"language_code": "en"
}
headers = {
"access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
count: 2,
timeout: 300,
origin: '<string>',
origin_pos: '<string>',
destination: '<string>',
destination_pos: '<string>',
currency: 'USD',
language_code: 'en'
})
};
fetch('https://api.anysite.io/api/rome2rio/routes/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.anysite.io/api/rome2rio/routes/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'count' => 2,
'timeout' => 300,
'origin' => '<string>',
'origin_pos' => '<string>',
'destination' => '<string>',
'destination_pos' => '<string>',
'currency' => 'USD',
'language_code' => 'en'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.anysite.io/api/rome2rio/routes/search"
payload := strings.NewReader("{\n \"count\": 2,\n \"timeout\": 300,\n \"origin\": \"<string>\",\n \"origin_pos\": \"<string>\",\n \"destination\": \"<string>\",\n \"destination_pos\": \"<string>\",\n \"currency\": \"USD\",\n \"language_code\": \"en\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.anysite.io/api/rome2rio/routes/search")
.header("access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"count\": 2,\n \"timeout\": 300,\n \"origin\": \"<string>\",\n \"origin_pos\": \"<string>\",\n \"destination\": \"<string>\",\n \"destination_pos\": \"<string>\",\n \"currency\": \"USD\",\n \"language_code\": \"en\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anysite.io/api/rome2rio/routes/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"count\": 2,\n \"timeout\": 300,\n \"origin\": \"<string>\",\n \"origin_pos\": \"<string>\",\n \"destination\": \"<string>\",\n \"destination_pos\": \"<string>\",\n \"currency\": \"USD\",\n \"language_code\": \"en\"\n}"
response = http.request(request)
puts response.read_body[
{
"@type": "Rome2RioRoute",
"name": "<string>",
"canonical_name": "<string>",
"grouping_key": "<string>",
"duration": 123,
"is_connectable": true,
"transport_kinds": [],
"transfer_durations": [],
"origin": {
"@type": "Rome2RioPlace",
"short_name": "<string>",
"canonical_name": "<string>",
"kind": "<string>",
"code": "<string>",
"country_code": "<string>",
"time_zone": "<string>",
"latitude": 123,
"longitude": 123,
"radius": 123,
"nearby_city": "<string>"
},
"destination": {
"@type": "Rome2RioPlace",
"short_name": "<string>",
"canonical_name": "<string>",
"kind": "<string>",
"code": "<string>",
"country_code": "<string>",
"time_zone": "<string>",
"latitude": 123,
"longitude": 123,
"radius": 123,
"nearby_city": "<string>"
},
"indicative_prices": [],
"booking_links": [],
"booking_configuration": {
"@type": "Rome2RioBookingConfiguration",
"max_passengers": 123,
"default_passenger_age": 123,
"age_groups": []
},
"transit_guides": [],
"segments": []
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
API token from the dashboard
Headers
Body
x >= 120 <= x <= 1500^-?\d{1,3}(\.\d+)?,-?\d{1,3}(\.\d+)?$^-?\d{1,3}(\.\d+)?,-?\d{1,3}(\.\d+)?$3Response
Successful Response
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes