ASN Lookup API - WHOIS Records, CIDR Blocks & BGP Peer Data
The APIFreaks ASN API gives you a complete, structured view of any network operator. Pass an AS number and get back the organization's full WHOIS registration, every IPv4 and IPv6 prefix they advertise, their upstream providers, downstream customers, BGP peers, and the raw WHOIS text from the authoritative Regional Internet Registry - all in a single JSON response.
Built for security engineers building threat intelligence pipelines, network teams monitoring BGP changes, and developers adding network attribution to their products. Supports ARIN, RIPE NCC, APNIC, LACNIC, and AFRINIC.
What You Get in Every Response
Live WHOIS from the Authoritative RIR
No cached intermediaries. Every query hits the source - whichever of the five Regional Internet Registries manages that ASN. ARIN for the Americas, RIPE NCC for Europe and the Middle East, APNIC for Asia-Pacific, LACNIC for Latin America, AFRINIC for Africa. The whoisHost field tells you exactly where the data came from.
Structured fields include asName, orgName, country, allocationStatus, dateAllocated, and ASN type (ISP, BUSINESS, EDUCATIONAL, GOVERNMENT), plus full technical and abuse contacts.
Full CIDR Block Inventory
The routeObjects array returns every prefix the ASN currently advertises - IPv4 and IPv6. Each entry includes the CIDR route, origin ASN, ISP name, and total IP count. The top-level numOfIPv4Routes and numOfIPv6Routes fields give you the counts upfront.
Use it to build network-level blocklists by operator, audit address space allocation, or detect unexpected prefix changes between API calls.
BGP Peer, Upstream & Downstream Relationships
Three arrays cover the complete routing picture: upstreams (the transit providers carrying traffic to the internet), downstreams (networks receiving transit), and peers (direct BGP neighbors). Each entry includes AS number, description, and country.
Useful for BGP monitoring, peering policy verification, traffic engineering analysis, and attributing infrastructure during incident response.
Structured JSON and Raw WHOIS - Both in One Response
The response includes two formats. The structured object - with clean fields for org, routes, peers, and contacts - drops straight into any application. parsedWhoisResponse breaks out the RIR contact records (handles, emails, phone numbers) for programmatic use.
The raw whoisResponse string is the complete, unprocessed text from the registry. Use it when the original source record must be preserved intact - forensic investigations, compliance documentation, or training data pipelines.
Built for These Use Cases
Threat intelligence enrichment
A single ASN API call surfaces the network operator behind an entire address block. Pair it with the IP Geolocation API and IP WHOIS API to build full-layer context per IP - geolocation, allocation record, and operator profile in three parallel calls. Security teams use this to attribute infrastructure by carrier or hosting provider, not just by individual IP.
BGP change monitoring
Store the routeObjects array for each ASN you monitor and diff on a schedule. New prefixes, withdrawn blocks, or unexpected origin ASN changes surface immediately. The response structure is stable and consistent across all five RIRs, making this straightforward to automate.
Network attribution at scale
Determine which network operator controls any IP range without maintaining your own ASN database. Pull the AS number from an IP Geolocation API response and pass it here for the operator's full profile - address space, registration details, and routing relationships - in one additional call.
Adding ASN context to your product
If your platform surfaces network data to users - security dashboards, developer tooling, infrastructure monitoring - the structured response gives you everything you need to display ASN context alongside IP and DNS data. Clean fields, consistent schema, no parsing required.
API Endpoint
How to Guides
Pass any AS number using the asn parameter. Both formats work - AS1234 and 1234 are identical. Case is ignored: as1234 and AS1234 return the same response.
Three parts of the response are worth knowing before you integrate:
routeObjects is an array of all CIDR prefixes the ASN advertises. Each entry has route, origin, isp, and numberOfIps. Iterate this to work with individual blocks.
upstreams, downstreams, and peers are BGP relationship arrays. Each entry has asNumber, description, and country.
parsedWhoisResponse contains the structured RIR contact data - technical and abuse contact handles, emails, and phone numbers. The raw whoisResponse string is the full unprocessed registry text.
# ASN WHOIS Lookup with prefix 'AS'
curl -X 'GET' 'https://api.apifreaks.com/v1.0/asn/whois/live?asn=AS1234&apiKey=API-KEY'# ASN WHOIS Lookup without prefix 'AS'
curl -X 'GET' 'https://api.apifreaks.com/v1.0/asn/whois/live?asn=1234&apiKey=API-KEY'
# Response
{
"asNumber": "1234",
"asName": "FORTUM-AS",
"orgName": "Fortum",
"description": "Fortum",
"orgHandle": "FORTUM-AS",
"country": "EU",
"domain": "ripe.net",
"website": "http://ripe.net",
"allocationStatus": "allocated",
"numOfIPv4Routes": "5",
"numOfIPv6Routes": "0",
"whoisHost": "RIPE",
"dateAllocated": "1993-09-01",
"type": "BUSINESS",
"routeObjects": [
{
"route": "137.96.0.0/16",
"origin": "AS1234",
"originName": "Fortum",
"isp": "Fortum Oyj",
"numberOfIps": 65536
},
{
"route": "132.171.128.0/17",
"origin": "AS1234",
"originName": "Fortum",
"isp": "Fortum Oyj",
"numberOfIps": 32768
},
If you're starting from an IP address rather than an AS number, the IP Geolocation API returns the ASN in the asn.as_number field of every response. For allocation-level detail on a specific IP block, the IP WHOIS API is the right call - it returns the inet_nums record including the originating ASN.
FAQs
The IP WHOIS API takes an IP address and returns the allocation record for that specific subnet - who received it, when, and the contact details for that assignment. The ASN API takes an AS number and returns the operator's full network profile: all their address space, every BGP relationship, and their organizational registration.
IP WHOIS answers: "who was assigned this IP block?"
ASN API answers: "what does this entire network operator look like?"
Pricing
To use the ASN Lookup API, API credits are required. Charges apply only for successful queries, indicated by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits previously charged will be refunded.
For each successful request, 15 credits will be charged for ASN lookup. Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.