Skip to content

TypeScript SDK

npm version GitHub

Official TypeScript / Node.js client. One call returns the full payload: geolocation, timezone, flag, currency, connection (ASN/ISP), security, and user-agent when present.

Terminal window
npm install @ipwho/ipwho

Requires Node.js 18+ (native fetch) or a modern browser.

import { IPWhoClient } from '@ipwho/ipwho';
const client = new IPWhoClient(process.env.IPWHO_API_KEY);
const res = await client.lookup('8.8.8.8'); // GET /ip/{ip}
const me = await client.me(); // GET /me
const bulk = await client.bulk(['8.8.8.8', '1.1.1.1']); // GET /bulk/{a,b,c}
console.log(res.data.ip);
console.log(res.data.geoLocation.country); // United States
console.log(res.data.connection.asnNumber); // 15169

Client class is IPWhoClient (v1 used IPWho).

v1v2
getIp(ip) / getLocation(ip)lookup(ip) then res.data.geoLocation
getMe() / getLocation()me()
getTimezone / getConnection / getSecuritynested on lookup(ip).data
(missing)bulk(ips)
  • lookup(ip, options?)GET /ip/{ip}
  • me(options?)GET /me
  • bulk(ips)GET /bulk/{a,b,c}; rows on data.responseArray

Errors: InvalidIPError (404), RateLimitError (429), APIResponseError.