Skip to content

Instantly share code, notes, and snippets.

@coderholic
Created April 14, 2018 22:21
Show Gist options
  • Save coderholic/c6dc5420a778c9506453d0d7e4aaff53 to your computer and use it in GitHub Desktop.
Save coderholic/c6dc5420a778c9506453d0d7e4aaff53 to your computer and use it in GitHub Desktop.
# Basic API example, does not require token
$ curl ipinfo.io/8.8.8.8
{
"ip": "8.8.8.8",
"hostname": "google-public-dns-a.google.com",
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.3860,-122.0840",
"postal": "94035",
"phone": "650",
"org": "AS15169 Google LLC"
}
# Standard plan
$ curl ipinfo.io/8.8.8.8/json?token=$IPINFO_TOKEN
{
"ip": "8.8.8.8",
"hostname": "google-public-dns-a.google.com",
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.3860,-122.0840",
"postal": "94035",
"phone": "650",
"asn": {
"asn": "AS15169",
"name": "Google LLC",
"domain": "google.com",
"route": "8.8.8.0/24",
"type": "hosting"
}
$ curl ipinfo.io/38.104.128.99/json?token=$IPINFO_TOKEN
{
"ip": "38.104.128.99",
"city": "San Francisco",
"region": "California",
"country": "US",
"loc": "37.7909,-122.4020",
"postal": "94104",
"asn": {
"asn": "AS174",
"name": "Cogent Communications",
"domain": "cogentco.com",
"route": "38.0.0.0/8",
"type": "isp"
},
"company": {
"name": "American Heart Association",
"domain": "americanheart.org",
"type": "business"
}
}
# Carrier response with Pro plan
$ curl ipinfo.io/66.87.125.72/json?token=$IPINFO_TOKEN
{
"ip": "66.87.125.72",
"hostname": "66-87-125-72.pools.spcsdns.net",
"city": "Southbridge",
"region": "Massachusetts",
"country": "US",
"loc": "42.0707,-72.0440",
"postal": "01550",
"asn": {
"asn": "AS10507",
"name": "Sprint Personal Communications Systems",
"domain": "spcsdns.net",
"route": "66.87.125.0/24",
"type": "isp"
},
"company": {
"name": "Sprint",
"domain": "sprint.com",
"type": "isp"
},
"carrier": {
"name": "Sprint",
"mcc": "310",
"mnc": "120"
}
}
# ASN API, included with Standard or Pro plan
$ curl ipinfo.io/AS25/json?token=$IPINFO_TOKEN
{
"asn": "AS25",
"name": "University of California at Berkeley",
"country": "US",
"allocated": "1984-08-03",
"registry": "arin",
"domain": "berkeley.edu",
"num_ips": 202496,
"prefixes": [
{
"netblock": "128.32.0.0/16",
"id": "UCB-ETHER",
"name": "University of California",
"country": "US"
},
{
"netblock": "136.152.0.0/16",
"id": "UCB-TELECOM",
"name": "University of California at Berkeley",
"country": "US"
},
{
"netblock": "169.229.0.0/16",
"id": "ISTDATA",
"name": "University of California at Berkeley",
"country": "US"
},
{
"netblock": "169.236.240.0/21",
"id": "UCMNET-1",
"name": "University of California, Merced",
"country": "US"
},
{
"netblock": "192.12.234.0/24",
"id": "CEA-NET",
"name": "University of California",
"country": "US"
},
{
"netblock": "192.150.186.0/23",
"id": "UCB-SEQUOIA2",
"name": "University of California, Berkeley",
"country": "US"
},
{
"netblock": "192.154.4.0/23",
"id": "NET-SEQUOIA1",
"name": "University of California, Berkeley",
"country": "US"
},
{
"netblock": "192.154.6.0/24",
"id": "NET-SEQUOIA3",
"name": "University of California, Berkeley",
"country": "US"
},
{
"netblock": "192.195.74.0/24",
"id": "ISATNET",
"name": "University of California at Berkeley, Electronics Research Lab",
"country": "US"
},
{
"netblock": "192.31.105.0/24",
"id": "UCB-VISIT-NET",
"name": "University of California at Berkeley",
"country": "US"
},
{
"netblock": "192.35.209.0/24",
"id": "UCOP-K3RDNET",
"name": "University of California - Office of the President",
"country": "US"
},
{
"netblock": "208.68.240.0/22",
"id": "SETIATHOME",
"name": "SETIATHOME",
"country": "US"
},
{
"netblock": "209.129.246.0/24",
"id": "EBCLC-209-129-246-0-255",
"name": "East Bay Community Law Center",
"country": "US"
},
{
"netblock": "67.21.36.0/24",
"id": "PSG",
"name": "RGnet, LLC",
"country": "US"
}
],
"prefixes6": [
{
"netblock": "2607:f140::/32",
"id": "UCBV6",
"name": "University of California at Berkeley",
"country": "US"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment