IP to Country and ASN
Pricing
from $0.01 / 1,000 results
Go to Apify Store
IP Lookup Actor
Look up geolocation and ASN information for any IP address using a fast, lightweight API.
Features
- Country and continent detection
- ASN (Autonomous System Number) information
- Network range (CIDR) lookup
- Fast response — no heavy dependencies, just a direct lookup
Input
The Actor accepts the following input:
| Field | Type | Required | Description |
|---|---|---|---|
ip | String | Yes | The IP address to look up (e.g. 8.8.8.8) |
Example input
{"ip": "8.8.8.8"}
Output
The Actor pushes the result to the default dataset. The output contains the following fields:
| Field | Type | Description |
|---|---|---|
ip | String | The looked up IP address |
continent_code | String | Two-letter continent code (e.g. EU, NA) |
country_code | String | Two-letter ISO country code (e.g. US, NL) |
country_name | String | Full country name (e.g. United States) |
asn | String | Autonomous System Number (e.g. 15169) |
asn_name | String | Short name of the ASN (e.g. GOOGLE) |
asn_org | String | Full organisation name of the ASN |
asn_domain | String | Domain associated with the ASN |
asn_country_code | String | Country code where the ASN is registered |
network | String | CIDR network range (e.g. 8.8.8.0/24) |
error | String | Error message if the lookup failed (if any) |
Example output
{"ip": "8.8.8.8","continent_code": "NA","country_code": "US","country_name": "United States","asn": "15169","asn_name": "GOOGLE","asn_org": "Google LLC","asn_domain": "google.com","asn_country_code": "US","network": "8.8.8.0/24"}
Usage via Apify API
You can call this Actor programmatically from your own server or application:
curl -X POST \"https://api.apify.com/v2/acts/YOUR_ACTOR_ID/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \-H "Content-Type: application/json" \-d '{"ip": "8.8.8.8"}'
Error handling
If the IP address is not found in the database, the Actor returns:
{"ip": "192.168.1.1","error": "IP address not found in database."}
If no IP address is provided, the Actor will fail with the message:
No IP address provided.
Attribution
IP address data powered by IPLocate