IP to Country and ASN avatar

IP to Country and ASN

Pricing

from $0.01 / 1,000 results

Go to Apify Store
IP to Country and ASN

IP to Country and ASN

Returns Country and ASN for given IP address

Pricing

from $0.01 / 1,000 results

Rating

0.0

(0)

Developer

md

md

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Categories

Share

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:

FieldTypeRequiredDescription
ipStringYesThe 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:

FieldTypeDescription
ipStringThe looked up IP address
continent_codeStringTwo-letter continent code (e.g. EU, NA)
country_codeStringTwo-letter ISO country code (e.g. US, NL)
country_nameStringFull country name (e.g. United States)
asnStringAutonomous System Number (e.g. 15169)
asn_nameStringShort name of the ASN (e.g. GOOGLE)
asn_orgStringFull organisation name of the ASN
asn_domainStringDomain associated with the ASN
asn_country_codeStringCountry code where the ASN is registered
networkStringCIDR network range (e.g. 8.8.8.0/24)
errorStringError 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