v3.0.0 Breaking Changes — All public types have been renamed to follow .NET naming conventions for two-letter acronyms. See the Migration Guide for details.
ipdata.co is a fast, reliable and clean service that allows you to look up the location of an IP Address and other data.
NuGet package install using package manager:
Install-Package IPData -Version 3.0.0NuGet package install using .NET CLI:
dotnet add package IPData --version 3.0.0All usage examples you can find on samples folder.
var client = new IPDataClient("API_KEY");
// Get IP data from my IP
var myIp = await client.Lookup();
Console.WriteLine($"Country name for {myIp.Ip} is {myIp.CountryName}");
// Get IP data from IP
var ipInfo = await client.Lookup("8.8.8.8");
Console.WriteLine($"Country name for {ipInfo.Ip} is {ipInfo.CountryName}");
// Get single field from IP
var countryName = await client.Lookup("8.8.8.8", x => x.CountryName);
Console.WriteLine($"Country name for 8.8.8.8 is {countryName}");
// Get multiple fields from IP
var geolocation = await client.Lookup("8.8.8.8", x => x.Latitude, x => x.Longitude);
Console.WriteLine($"Geolocation for 8.8.8.8 is lat: {geolocation.Latitude} long: {geolocation.Longitude}");From ipdata.co docs:
Note that bulk lookups are only available to paid users and are currently limited to a 100 at a time. Reach out to support if you need to lookup larger batches.
var client = new IPDataClient("API_KEY");
var ipInfoList = await client.Lookup(new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" });
foreach (var ipInfo in ipInfoList)
{
Console.WriteLine($"Country name for {ipInfo.Ip} is {ipInfo.CountryName}");
}var client = new IPDataClient("API_KEY");
var carrierInfo = await client.Carrier("69.78.70.144");
Console.WriteLine($"Carrier name: {carrierInfo.Name}");var client = new IPDataClient("API_KEY");
var companyInfo = await client.Company("69.78.70.144");
Console.WriteLine($"Company name: {companyInfo.Name}");var client = new IPDataClient("API_KEY");
var asnInfo = await client.Asn("69.78.70.144");
Console.WriteLine($"ASN name: {asnInfo.Name}");var client = new IPDataClient("API_KEY");
var timezoneInfo = await client.TimeZone("69.78.70.144");
Console.WriteLine($"TimeZone name: {timezoneInfo.Name}");var client = new IPDataClient("API_KEY");
var currencyInfo = await client.Currency("69.78.70.144");
Console.WriteLine($"Currency name: {currencyInfo.Name}");var client = new IPDataClient("API_KEY");
var threatInfo = await client.Threat("69.78.70.144");
Console.WriteLine($"Threat is Tor: {threatInfo.IsTor}");To ensure your data stays in the EU, use the EU endpoint by passing a custom base URL:
var client = new IPDataClient("API_KEY", new Uri("https://eu-api.ipdata.co"));
var ipInfo = await client.Lookup("8.8.8.8");v3.0.0 renames all public types to follow .NET naming conventions for two-letter acronyms. It also adds EU endpoint support and a Company lookup.
| v2 | v3 |
|---|---|
IpDataClient |
IPDataClient |
IIpDataClient |
IIPDataClient |
IpInfo |
IPLookupResult |
- using IpData;
- using IpData.Models;
+ using IPData;
+ using IPData.Models;The package ID has changed from IpData to IPData:
dotnet remove package IpData
dotnet add package IPData --version 3.0.0- EU endpoint — Pass a custom base URL to route requests through EU servers:
var client = new IPDataClient("API_KEY", new Uri("https://eu-api.ipdata.co"));
- Company lookup — Fetch company info for an IP:
var companyInfo = await client.Company("8.8.8.8");
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details