PiriAPI Docs
IP2Location API
Look up geolocation data for any IPv4 or IPv6 address. Get country, region, city, coordinates, and timezone information.
IP Geolocation Lookup
Returns geolocation data for a given IP address.
POST
/api/v1/ip2locationRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
| ip | string | Yes | IPv4 or IPv6 address |
Example
curl -X POST \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"ip": "8.8.8.8"}' \
https://api-piriapi.kaanksc.com/api/v1/ip2location Response
{
"country_code": "us",
"country_name": "United States",
"region": "California",
"city": "Mountain View",
"latitude": 37.4056,
"longitude": -122.0775,
"zip_code": "94043",
"timezone": "America/Los_Angeles"
} Response Type
IPLocation
interface IPLocation {
country_code: string; // ISO 3166-1 alpha-2 lowercase (e.g. "us", "gb")
country_name: string; // Full country name
region: string; // State/Region
city: string; // City name
latitude: number; // Latitude coordinate
longitude: number; // Longitude coordinate
zip_code: string; // Postal/ZIP code
timezone: string; // IANA timezone (e.g. "America/Los_Angeles")
} Error Responses
| Status | Description |
|---|---|
| 400 | Invalid IP address format |
| 401 | Missing or invalid API key |
| 404 | IP address not found in database |
| 429 | Rate limit exceeded |