Update README.md

This commit is contained in:
Tizian Maxime Weigt 2025-08-24 16:23:49 +02:00 committed by GitHub
parent 21c5d43abc
commit 95608888ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,13 +1,15 @@
# IP-to-ASN Lookup API (fast hehe) # IP-to-ASN Lookup API (fast hehe)
This API allows you to lookup the **ASN**, **country**, and **provider name** for a given IPv4 or IPv6 address. This API allows you to lookup the **ASN**, **country**, **country name**, and **provider name** for a given IPv4 or IPv6 address.
## Base URL ## Base URL
``` ```
https://cdn.t-w.dev/whois?ip={IP} https://cdn.t-w.dev/whois?ip={IP}&locale={locale}
``` ```
* `locale` (optional) `de`, `en`, or `both` (default: `both`)
--- ---
## Request ## Request
@ -18,9 +20,10 @@ https://cdn.t-w.dev/whois?ip={IP}
### Parameters ### Parameters
| Name | Type | Required | Description | | Name | Type | Required | Description |
| ---- | ------ | -------- | ----------------------------- | | ------ | ------ | -------- | ----------------------------------------------- |
| ip | string | Yes | IPv4 or IPv6 address to query | | ip | string | Yes | IPv4 or IPv6 address to query |
| locale | string | No | Language for `country_name`: `de`, `en`, `both` |
--- ---
@ -28,13 +31,14 @@ https://cdn.t-w.dev/whois?ip={IP}
### Success (200) ### Success (200)
| Field | Type | Description | | Field | Type | Description |
| ----------- | ------ | ---------------------------------- | | ------------- | ------ | ----------------------------------------- |
| ip | string | The queried IP address | | ip | string | The queried IP address |
| asn | string | Autonomous System Number | | asn | string | Autonomous System Number |
| country | string | 2-letter country code of the ASN | | country | string | 2-letter country code of the ASN |
| description | string | Cleaned provider name (normalized) | | country\_name | string | Localized country name (`locale` applied) |
| logo | string | Provider logo (not all) | | description | string | Cleaned provider name (normalized) |
| logo | string | Provider logo (not all) |
**Example:** **Example:**
@ -43,6 +47,7 @@ https://cdn.t-w.dev/whois?ip={IP}
"ip": "8.8.8.8", "ip": "8.8.8.8",
"asn": "15169", "asn": "15169",
"country": "US", "country": "US",
"country_name": "United States / Vereinigte Staaten",
"description": "Google", "description": "Google",
"logo": "https://cdn.t-w.dev/img/Google.webp" "logo": "https://cdn.t-w.dev/img/Google.webp"
} }
@ -80,6 +85,6 @@ flowchart TD
D -- No --> E[Return Error: Invalid IP address] D -- No --> E[Return Error: Invalid IP address]
D -- Yes --> F[Lookup IP in ASN database] D -- Yes --> F[Lookup IP in ASN database]
F --> G{ASN found?} F --> G{ASN found?}
G -- Yes --> H[Return JSON with ip, asn, country, description] G -- Yes --> H[Return JSON with ip, asn, country, country_name, description, logo]
G -- No --> I[Return Error: ASN not found] G -- No --> I[Return Error: ASN not found]
``` ```