|
| 1 | +# IPData.info .NET SDK — Free IP Geolocation & Threat Intelligence API |
| 2 | + |
| 3 | +[](https://www.nuget.org/packages/IPDataInfo.Sdk/) [](../../actions/workflows/ci.yml) [](./LICENSE) |
| 4 | + |
| 5 | +Official .NET client for [**ipdata.info**](https://ipdata.info) — a free, fast |
| 6 | +IP geolocation, ASN, and threat-intelligence API. Look up country, city, ASN, |
| 7 | +timezone, currency, and security flags (proxy/VPN/Tor/hosting) for any IPv4 or |
| 8 | +IPv6 address. Powered by [ipdata.info](https://ipdata.info). |
| 9 | + |
| 10 | +## Get a free API key |
| 11 | + |
| 12 | +The public endpoint is **free — 50 requests/min, no signup, no key**. For higher |
| 13 | +rate limits and batch lookups, [**create a free API key at |
| 14 | +ipdata.info/register**](https://ipdata.info/register) and manage it in your |
| 15 | +[dashboard](https://ipdata.info/dashboard). |
| 16 | + |
| 17 | +## Install |
| 18 | + |
| 19 | +``` |
| 20 | +dotnet add package IPDataInfo.Sdk |
| 21 | +``` |
| 22 | + |
| 23 | +## Quickstart |
| 24 | + |
| 25 | +```csharp |
| 26 | +using IPDataInfo; |
| 27 | + |
| 28 | +using var client = new IPDataClient(); // free tier; or new IPDataClient(apiKey: "KEY") |
| 29 | +
|
| 30 | +var info = await client.LookupAsync("8.8.8.8"); |
| 31 | +Console.WriteLine($"{info.City}, {info.Country} ({info.AsnOrg})"); // Mountain View, United States (Google LLC) |
| 32 | +``` |
| 33 | + |
| 34 | +## Methods |
| 35 | + |
| 36 | +| Method | What it returns | |
| 37 | +|--------|-----------------| |
| 38 | +| `LookupAsync(ip?)` | Full geolocation record (own IP if `ip` omitted) | |
| 39 | +| `GeoAsync(ip)` | Geo subset (city/region/country/lat/lon/tz) | |
| 40 | +| `AsnAsync(ip)` | ASN + ISP/registry for an IP | |
| 41 | +| `BatchAsync(ips)` | Many IPs at once (**requires an API key**) | |
| 42 | +| `AsnDetailAsync(n)` | ASN detail incl. prefixes | |
| 43 | +| `AsnWhoisHistoryAsync(n)` | ASN whois history | |
| 44 | +| `AsnChangesAsync()` | ASN change feed | |
| 45 | +| `ThreatDomainAsync/ThreatHashAsync/ThreatUrlAsync(x)` | Threat-intel lookup (domain / file hash / URL) | |
| 46 | + |
| 47 | +Full response schema: [ipdata.info API docs](https://ipdata.info/docs) · |
| 48 | +[SDK list](https://ipdata.info/docs/sdks). |
| 49 | + |
| 50 | +## Configuration |
| 51 | + |
| 52 | +```csharp |
| 53 | +new IPDataClient( |
| 54 | + apiKey: "KEY", // sent as X-Api-Key; switches to pro.ipdata.info |
| 55 | + baseUrl: "https://ipdata.info", // override the host |
| 56 | + httpClient: customHttpClient, // bring your own HttpClient (proxy, handlers, ...) |
| 57 | + timeout: TimeSpan.FromSeconds(5)); // ignored when httpClient is supplied |
| 58 | +``` |
| 59 | + |
| 60 | +Errors from non-2xx responses are thrown as `IPDataInfo.IpDataException` with |
| 61 | +`StatusCode` and `Message`. |
| 62 | + |
| 63 | +## Rate limits |
| 64 | + |
| 65 | +- Free (`ipdata.info`): 50 req/min, no key. |
| 66 | +- Paid (`pro.ipdata.info`): higher limits + `BatchAsync`, with an |
| 67 | + [API key](https://ipdata.info/register). |
| 68 | + |
| 69 | +## Other SDKs |
| 70 | + |
| 71 | +12 official SDKs — see the full list at |
| 72 | +[**ipdata.info/docs/sdks**](https://ipdata.info/docs/sdks): Python, Node.js, Go, |
| 73 | +PHP, Java, Rust, .NET, Kotlin, Swift, Dart, Bash, Objective-C. |
| 74 | + |
| 75 | +## License |
| 76 | + |
| 77 | +MIT © [ipdata.info](https://ipdata.info) |
0 commit comments