The autonomous system (AS) behind any IPv4 or IPv6 address: its number, the organization that runs it, what kind of organization that is (hosting provider, ISP, business, university, government or bank), the announced route and the abuse contact. The data comes from the ipapi.is API, which combines BGP routing tables with the WHOIS records of all registries for more than 82,000 active ASNs. No dependencies; Node.js 18 or newer, and browsers.
npm install asn-from-ipconst { ipToASN } = require('asn-from-ip');
await ipToASN('95.91.211.148');
// { asn: 3209, org: 'Vodafone GmbH' }That is what a lookup without an API key returns, for up to 30 lookups per day and IP address.
A free account includes 1,000 lookups a day, commercial use allowed, and the complete record. Put the key in the environment as IPAPI_KEY, or pass it as ipToASN(ip, { key }):
await ipToASN('95.91.211.148');{
asn: 3209,
abuser_score: '0.0001 (Very Low)',
route: '95.88.0.0/14',
descr: 'VODANET - Vodafone GmbH, DE',
country: 'de',
active: true,
org: 'Vodafone GmbH',
domain: 'vodafone.de',
abuse: 'abuse.de@vodafone.com',
type: 'isp',
created: '2002-09-11',
updated: '2026-11-12',
rir: 'RIPE'
}| Field | |
|---|---|
asn |
The AS number |
org, domain |
The organization holding the AS and its domain |
type |
hosting, isp, business, education, government or banking |
route |
The announced prefix that contains the address |
descr, country |
The AS's description and the country it is registered in |
abuse |
Where to send abuse reports |
abuser_score |
The share of the AS's addresses seen in abuse, with a label from Very Low to Very High |
active |
Whether the AS announces any routes |
created, updated, rir |
Registration date, last change and registry |
ipToASN() resolves to null when no AS announces the address. A failed lookup rejects with an Error that carries the HTTP status and the API's error_code as code, for example ERR_INVALID_IP_OR_ASN or ERR_FREE_TIER_EXHAUSTED.
Pass an AS number instead of an address (this needs a key):
const as = await ipToASN('AS50673');
as.org; // 'Serverius Holding B.V.'
as.prefixes; // [ '5.178.64.0/21', '5.178.64.0/24', '5.188.12.0/22', … ] 71 in total
as.prefixesIPv6; // [ '2001:67c:b0::/48', '2001:67c:e98::/48', … ] 12 in totalWithout an address, the lookup is for the caller, so this shows a visitor their own network:
<script src="https://unpkg.com/asn-from-ip@2"></script>
<script>
ipToASN().then((as) => {
document.body.textContent = as ? `You are on AS${as.asn}, ${as.org}` : 'No AS found';
});
</script>Use it without a key there: a key in page JavaScript is public. Each visitor has their own 30 lookups a day.
Since 1 September 2026 the API returns the full asn object only with an API key, so version 1 resolves to a string such as "AS3209 Vodafone GmbH". Version 2 always resolves to an object. Errors now reject instead of resolving to null, and the browser file is index.js instead of dist/ipToASN.min.js.
- The same lookup also says who owns the address, where it is, and whether it is a datacenter, a VPN (and which one), a proxy, a Tor exit or a known abuser: API documentation.
- ipapi.is-node: the full response, bulk lookups and an Express middleware that blocks VPN, proxy and Tor traffic.
- For lookups without a network call, the IP to ASN Database has every AS and route in CSV, MMDB and JSON. Samples.
ISC license.