Distance

FREEMIUM
By Distance.to
Updated 2 months ago
Mapping
7.3/10
Popularity Score
725ms
Latency
100%
Success Rate

Distance API Documentation

Calculate distances and travel time between cities, addresses, postcodes or airports. Geocoding, car or foot directions, airline and many more data included.

View API Details
GETGet distance
GETGet distance

Get a distance between locations

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
routeSTRING
REQUIREDA route is described of an array of point objects. Every point object exists of a "t" property, which describes the name of the point. (Can be address, city, iata or lat,lng ) and an optional "c" propertie which describes the country in ISO 3166-1 alpha-2 or alpha-3 (DE or DEU, ES, US,...) Example: [{"t":"TXL"},{"t":"Hamburg"}]
Optional Parameters
carBOOLEAN
OPTIONALAdd car route distance and duration
footBOOLEAN
OPTIONALAdd foot route distance and duration
Code Snippet
unirest.get("https://distanceto.p.rapidapi.com/get?car=false&foot=false")
.header("X-RapidAPI-Host", "distanceto.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://distanceto.p.rapidapi.com/get
Request Method: GET
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.get("https://distanceto.p.rapidapi.com/get?car=false&foot=false")
.header("X-RapidAPI-Host", "distanceto.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication