RapidAPI logo

Sign Up

Log In

geolocation

FREEMIUM
By damngoodapis
Updated 3 months ago
Data
-/10
Popularity Score
-
Latency
-
Success Rate

geolocation API Documentation

Geolocation api. Have you ever needed to know where the person visiting your website is coming from? Just use this API.

If you use it in your front-end javascript code, you may even leave the IP argument empty. Just hit the root of the API and you'll be given information on the whereabouts of your visitor.

Using in the backend is as simple! All you have to do is pass a "ip" argument with the ip address of the given user.

View API Details
GETgeolocation
GETgeolocation

This endpoint returns geolocation information for the given IP address. If no IP address is specified, then the current IP address is used.

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Optional Parameters
callbackSTRING
OPTIONALIf this argument is specified, the geolocation API will return the results as JSONP. If this is not specified, a JSON response is sent.
ipSTRING
OPTIONALIP Address to be looked upon. If this argument is omitted, the current user's IP address is used.
Request Snippet
unirest.get("https://geo.p.rapidapi.com/?callback=callback12345&ip=200.192.123.145")
.header("X-RapidAPI-Host", "geo.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
Log inSign up

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://geo.p.rapidapi.com/?callback=callback12345&ip=200.192.123.145")
.header("X-RapidAPI-Host", "geo.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