TypeScript SDK
Official TypeScript / Node.js client. One call returns the full payload: geolocation, timezone, flag, currency, connection (ASN/ISP), security, and user-agent when present.
- Source: lavrox/SDK-IPWho-IP-Geolocation-Typescript
- npm:
@ipwho/ipwho - API key: ipwho.org/free-plan
Installation
Section titled “Installation”npm install @ipwho/ipwhoRequires Node.js 18+ (native fetch) or a modern browser.
Quick start
Section titled “Quick start”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 /meconst 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 Statesconsole.log(res.data.connection.asnNumber); // 15169Client class is IPWhoClient (v1 used IPWho).
Migrating from v1
Section titled “Migrating from v1”| v1 | v2 |
|---|---|
getIp(ip) / getLocation(ip) | lookup(ip) then res.data.geoLocation |
getMe() / getLocation() | me() |
getTimezone / getConnection / getSecurity | nested on lookup(ip).data |
| (missing) | bulk(ips) |
Methods
Section titled “Methods”lookup(ip, options?)—GET /ip/{ip}me(options?)—GET /mebulk(ips)—GET /bulk/{a,b,c}; rows ondata.responseArray
Errors: InvalidIPError (404), RateLimitError (429), APIResponseError.