The UncoverIP Geo Location APIs use Bearer Authentication. You can get the API Key after Sign Up. Include the API key in your requests in the Authorization header as follows:
Authorization: Bearer YOUR_API_KEY
This API returns the location for a specified IP address.
https://uncoverip.com/api/v1/location/192.168.0.1
curl -H "Authorization: Bearer YOUR_API_KEY" https://uncoverip.com/api/v1/location/192.168.0.1
fetch('https://uncoverip.com/api/v1/location/192.168.0.1', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://uncoverip.com/api/v1/location/192.168.0.1',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_KEY'
)
));
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
print_r($data);
import requests
headers = {'Authorization': 'Bearer YOUR_API_KEY'}
response = requests.get('https://uncoverip.com/api/v1/location/192.168.0.1', headers=headers)
data = response.json()
print(data)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static readonly HttpClient client = new HttpClient();
static async Task Main()
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
HttpResponseMessage response = await client.GetAsync("https://uncoverip.com/api/v1/location/192.168.0.1");
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
#include <iostream>
#include <string>
#include <curl/curl.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* out)
{
size_t totalSize = size * nmemb;
out->append((char*)contents, totalSize);
return totalSize;
}
int main()
{
CURL* curl = curl_easy_init();
if(curl) {
std::string readBuffer;
curl_easy_setopt(curl, CURLOPT_URL, "https://uncoverip.com/api/v1/location/192.168.0.1");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
std::cout << readBuffer << std::endl;
}
return 0;
}
{ "ip": "192.168.0.1", "location": "Bangalore, India", "isp": "BSNL", //...other response data }
{ "status": "error", "message": "Request limit reached" }
After each request, the remaining API calls can be found in the headers of the response:
X-RateLimit-Remaining: number_of_remaining_requests