You can try using https://ip-api.io - geo location api that returns country among other IP information.
For example with Node.js
const request = require('request-promise')
request('http://ip-api.io/api/json/1.2.3.4')
.then(response => console.log(JSON.parse(response)))
.catch(err => console.log(err))