1.0.13 • Published 5 years ago
@smartip/js v1.0.13
SmartIP.io Official Javascript library
This is the official Javascript Library for SmartIP.io, which allows a fast lookup of any IP address or ASN. Our main features are:
- IP Geolocation data (country, city, postal codes, latitude, longitude)
- Timezone data
- Currency data
- Security data (TOR insights, Crawler insights, Proxy insigths)
- Crypto data (Bitcoin nodes)
- ASN data (number of IPs managed by an ASN, the organization name, the list of IP blocks managed by a given ASN)
- User Agent detection
Getting started
In order to use SmartIP.io API, you will need to register a free account at https://smartip.io and get an API KEY. All data fields are always enabled regardless of the subscription tier.
- The Free tier will allow up to 125,000 requests a month.
- The PRO tier will allow for an unlimited number of requests a month.
More pricing info are available at: https://smartip.io/#pricing-section
Installation
Npm
$ npm install @smartip/js
Yarn
$ yarn add @smartip/js
Usage example
IP Lookup:
const {SmartIP} = require("@smartip/js")
let testApiKey = '249C35CF-81E7-4B49-8F9F-ACA72C9F5CD7';
const client = new SmartIP(testApiKey);
let hostname = true;
let userAgent = true;
let ipInfo = await client.requestIPData('8.8.8.8', hostname, userAgent);
console.log(ipInfo);
ASN Lookup:
const {SmartIP} = require("@smartip/js")
let testApiKey = '249C35CF-81E7-4B49-8F9F-ACA72C9F5CD7';
const client = new SmartIP(testApiKey);
let asnInfo = await client.requestAsnData("AS15169");
console.log(asnInfo);