.NET SDK · Feature

ASN & DNS Lookups in .NET

Resolve the network and DNS layer behind an IP or domain: which autonomous system owns an address, who registered a domain, what a host's PTR record is, and which mail servers a domain uses — all from the same client.

Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
What it does

Network ownership and DNS in one client

Behind every IP and domain is a network and DNS layer that tells you who owns the address space, when a domain was registered, and how its mail and hostnames resolve. ip-api.io exposes ASN, WHOIS, reverse/forward DNS, and MX lookups through the same client, so you can enrich logs, verify ownership, and feed fraud rules without juggling separate DNS libraries.

Prerequisites

1

Autonomous system with AsnAsync

Returns the ASN, owning organization, network range, and country for an IP — and whether it belongs to a datacenter. Nullable fields are C# nullable types.

var client = new IpApiClient(Environment.GetEnvironmentVariable("IP_API_IO_KEY")!);

var asn = await client.AsnAsync("8.8.8.8");

Console.WriteLine(asn.Asn);           // 15169
Console.WriteLine(asn.Organization);  // "Google LLC"
Console.WriteLine(asn.IsDatacenter);  // True
2

Domain registration with WhoisAsync

WHOIS record for a domain: registrar, registration/expiry/update dates, name servers, status codes, and the raw WHOIS text.

var whois = await client.WhoisAsync("example.com");

Console.WriteLine(whois.Registrar?.Name);
Console.WriteLine(whois.RegisteredOn);  // "1995-08-14"
Console.WriteLine(string.Join(", ", whois.NameServers));
3

DNS with ReverseDnsAsync, ForwardDnsAsync & MxRecordsAsync

Resolve a PTR record, resolve a hostname to addresses, or list a domain's mail servers.

var rdns = await client.ReverseDnsAsync("8.8.8.8");
Console.WriteLine(rdns.Hostname); // "dns.google"

var fdns = await client.ForwardDnsAsync("dns.google");
foreach (var record in fdns.Addresses)
    Console.WriteLine($"{record.Type} {record.Address} {record.Ttl}"); // "A" "8.8.8.8" 300

var mx = await client.MxRecordsAsync("example.com");
foreach (var record in mx.MxRecords)
    Console.WriteLine($"{record.Priority} {record.Hostname} {record.Ttl}");
Reference

Response reference

MethodReturnsKey properties
AsnAsync(ip)AsnLookupIp, Asn, Organization, Network, IsDatacenter, Country, CountryCode
WhoisAsync(domain)WhoisDomain, Registrar, RegisteredOn, ExpiresOn, UpdatedOn, NameServers, Status, Raw
ReverseDnsAsync(ip)ReverseDnsIp, Hostname, PtrRecord, Ttl
ForwardDnsAsync(hostname)ForwardDnsHostname, Addresses (each Type, Address, Ttl)
MxRecordsAsync(domain)MxLookupDomain, MxRecords (each Priority, Hostname, Ttl)
FAQ

Frequently asked questions

How do I find the ASN and owner of an IP in C#?

Call await client.AsnAsync(ip). It returns the ASN number, owning organization, network range, country, and whether the IP belongs to a datacenter. Nullable fields are C# nullable types.

How do I do a WHOIS lookup in C#?

Use await client.WhoisAsync(domain). It returns the registrar, registration/expiry/update dates, name servers, status codes, and the raw WHOIS text for a domain.

Can I do reverse and forward DNS lookups?

Yes. await client.ReverseDnsAsync(ip) returns the PTR hostname for an IP, and await client.ForwardDnsAsync(hostname) resolves a hostname to its A/AAAA addresses. await client.MxRecordsAsync(domain) returns a domain's mail servers.

What's the difference between MxRecordsAsync here and email validation?

MxRecordsAsync(domain) returns the raw MX records (priority, hostname, ttl) for DNS inspection. The email validation methods use MX presence as one input to a deliverability verdict for a specific address.

Start building with the ip-api.io .NET SDK

Run dotnet add package IpApiIo, drop in your free API key, and ship in minutes — one async client for geolocation, fraud detection, and email validation.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Found a bug in the SDK?

The IpApiIo package is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub