IPQuery Docs

Home to the main documentation for ipquery.io. IPQuery aims to provide a straightforward and simplistic api for working with ip address's.

Basic Request

GET /

Returns your IP Address.

Defaults the response format to text when fetching your own ip address. If you want to include additional fields checkout the Changing Response Formats section.

Python Example

import requests

req = requests.get("https://api.ipquery.io/")
print(req.text) # Your ip address

Response

1.1.1.1

Query Specific IP Address

GET /1.1.1.1

Returns the ip address queried along with all of the fields.

Defaults the response format to json when querying a specific ip address. To change this checkout the Changing Response Formats section.

Python Example

import requests

req = requests.get("https://api.ipquery.io/1.1.1.1")
print(req.text)

Response

{
    "ip": "1.1.1.1",
    "isp": {
        "asn": "AS13335",
        "org": "Cloudflare, Inc.",
        "isp": "Cloudflare, Inc."
    },
    "location": {
        "country": "Australia",
        "country_code": "AU",
        "city": "Sydney",
        "state": "New South Wales",
        "zipcode": "1001",
        "latitude": -33.854548400186665,
        "longitude": 151.20016200912815,
        "timezone": "Australia/Sydney",
        "localtime": "2024-09-03T22:22:52"
    },
    "risk": {
        "is_mobile": false,
        "is_vpn": false,
        "is_tor": false,
        "is_proxy": false,
        "is_datacenter": true,
        "risk_score": 0
    }
}

Bulk Query A List of IP Address's

IPQuery supports bulk lookups, each address can be seperated with a comma.

The maximum number of allowed lookups in batch mode is capped at 10,000.

GET /1.1.1.1,2.2.2.2

Python Example

import requests

req = requests.get("https://api.ipquery.io/1.1.1.1,2.2.2.2")
print(req.text)

Response Example

[
    {
        "ip": "1.1.1.1",
        "isp": {
            "asn": "AS13335",
            "org": "Cloudflare, Inc.",
            "isp": "Cloudflare, Inc."
        },
        "location": {
            "country": "Australia",
            "country_code": "AU",
            "city": "Sydney",
            "state": "New South Wales",
            "zipcode": "1001",
            "latitude": -33.854548400186665,
            "longitude": 151.20016200912815,
            "timezone": "Australia/Sydney",
            "localtime": "2024-09-03T22:23:42"
        },
        "risk": {
            "is_mobile": false,
            "is_vpn": false,
            "is_tor": false,
            "is_proxy": false,
            "is_datacenter": true,
            "risk_score": 0
        }
    },
    ... // Results for 2.2.2.2
]

Changing Response Formats

IPQuery supports the following response formats:

  • Text

  • JSON

  • YAML

  • XML

The response format can be changed by adding the ?format= parameter.

GET /1.1.1.1?format=yaml

Python Example

import requests

req = requests.get("https://api.ipquery.io/1.1.1.1?format=yaml")
print(req.text)

Response

ip: 1.1.1.1
isp:
  asn: AS13335
  org: Cloudflare, Inc.
  isp: Cloudflare, Inc.
location:
  country: Australia
  country_code: AU
  city: Sydney
  state: New South Wales
  zipcode: "1001"
  latitude: -33.854548400186665
  longitude: 151.20016200912815
  timezone: Australia/Sydney
  localtime: 2024-09-03T22:45:50
risk:
  is_mobile: false
  is_vpn: false
  is_tor: false
  is_proxy: false
  is_datacenter: true
  risk_score: 0

GET /1.1.1.1?format=xml

Python Example

import requests

req = requests.get("https://api.ipquery.io/1.1.1.1?format=xml")
print(req.text)

Response

<IPInfo>
    <ip>1.1.1.1</ip>
    <isp>
        <asn>AS13335</asn>
        <org>Cloudflare, Inc.</org>
        <isp>Cloudflare, Inc.</isp>
    </isp>
    <location>
        <country>Australia</country>
        <country_code>AU</country_code>
        <city>Sydney</city>
        <state>New South Wales</state>
        <zipcode>1001</zipcode>
        <latitude>-33.854548400186665</latitude>
        <longitude>151.20016200912815</longitude>
        <timezone>Australia/Sydney</timezone>
        <localtime>2024-09-03T22:51:11</localtime>
    </location>
    <risk>
        <is_datacenter>true</is_datacenter>
    </risk>
</IPInfo>

Last updated