API

This page provides an API to retrieve the IP address.

The API specifications are as follows:

IP Address

The API URL is as follows:

Each API returns data in the following format:

https://getip.info/api/ip/

Returns the IP address.

Example:

    
        ${request.headers.get('cf-connecting-ip')}
    

https://getip.info/api/ip/json

Returns the IP address in JSON format.

Example:

    
        {"ip": "${request.headers.get('cf-connecting-ip')}"}
    

https://getip.info/api/ip/xml

Returns the IP address in XML format.

Example:

    
        
        ${request.headers.get('cf-connecting-ip')}
    

Country

The API URL is as follows:

Each API returns data in the following format:

https://getip.info/api/country/

Returns the country.

Example:

    
        ${country}
    

https://getip.info/api/country/json

Returns the country in JSON format.

Example:

    
        {"country": "${country}"}
    

https://getip.info/api/country/xml

Returns the country in XML format.

Example:

    
        
        ${country}
    

Region

The API URL is as follows:

Each API returns data in the following format:

https://getip.info/api/region/

Returns the region.

Example:

    
        ${region}
    

https://getip.info/api/region/json

Returns the region in JSON format.

Example:

    
        {"region": "${region}"}
    

https://getip.info/api/region/xml

Returns the region in XML format.

Example:

    
        
        ${region}
    

Prefecture Code

The API URL is as follows:

Each API returns data in the following format:

https://getip.info/api/prefcode/

Returns the prefecture code.

Example:

    
        ${prefcode}
    

https://getip.info/api/prefcode/json

Returns the prefecture code in JSON format.

Example:

    
        {"prefcode": "${prefcode}"}
    

https://getip.info/api/prefcode/xml

Returns the prefecture code in XML format.

Example:

    
        
        ${prefcode}
    

City

The API URL is as follows:

Each API returns data in the following format:

https://getip.info/api/city/

Returns the city name.

Example:

    
        ${city}
    

https://getip.info/api/city/json

Returns the city name in JSON format.

Example:

    
        {"city": "${city}"}
    

https://getip.info/api/city/xml

Returns the city name in XML format.

Example:

    
        
        ${city}
    

Postal Code

The API URLs are as follows:

Each URL returns data in the following format:

https://getip.info/api/postalcode/

Returns the postal code.

Example:

    
        ${postalcode}
    

https://getip.info/api/postalcode/json

Returns the postal code in JSON format.

Example:

    
        {"postalcode": "${postalcode}"}
    

https://getip.info/api/postalcode/xml

Returns the postal code in XML format.

Example:

    
        
        ${postalcode}
    

Longitude

The API URLs are as follows:

Each URL returns data in the following format:

https://getip.info/api/lon/

Returns the longitude.

Example:

    
        ${lon}
    

https://getip.info/api/lon/json

Returns the longitude in JSON format.

Example:

    
        {"lon": "${lon}"}
    

https://getip.info/api/lon/xml

Returns the longitude in XML format.

Example:

    
        
        ${lon}
    

Latitude

The API URLs are as follows:

Each URL returns data in the following format:

https://getip.info/api/lat/

Returns the latitude.

Example:

    
        ${lat}
    

https://getip.info/api/lat/json

Returns the latitude in JSON format.

Example:

    
        {"lat": "${lat}"}
    

https://getip.info/api/lat/xml

Returns the latitude in XML format.

Example:

    
        
        ${lat}
    

Latitude and Longitude

The API URLs are as follows:

Each URL returns data in the following format:

https://getip.info/api/latlon/

Returns the latitude and longitude.

Example:

    
        ${latlon}
    

https://getip.info/api/latlon/json

Returns the latitude and longitude in JSON format.

Example:

    
        {"latlon": "${latlon}"}
    

https://getip.info/api/latlon/xml

Returns the latitude and longitude in XML format.

Example:

    
        
        ${latlon}
    

Time Zone

The URLs for the API are as follows:

Each URL returns the following data:

https://getip.info/api/timezone/

Returns the timezone.

Example:

    
        ${timezone}
    

https://getip.info/api/timezone/json

Returns the timezone in JSON format.

Example:

    
        {"timezone": "${timezone}"}
    

https://getip.info/api/timezone/xml

Returns the timezone in XML format.

Example:

    
        
        ${timezone}
    

AS Number

The URLs for the API are as follows:

Each URL returns the following data:

https://getip.info/api/asn/

Returns the AS number.

Example:

    
        ${asn}
    

https://getip.info/api/asn/json

Returns the AS number in JSON format.

Example:

    
        {"asn": "${asn}"}
    

https://getip.info/api/asn/xml

Returns the AS number in XML format.

Example:

    
        
        ${asn}
    

Internet Service Provider (ISP)

The URLs for the API are as follows:

Each URL returns the following data:

https://getip.info/api/isp/

Returns the ISP.

Example:

    
        ${isp}
    

https://getip.info/api/isp/json

Returns the ISP in JSON format.

Example:

    
        {"isp": "${isp}"}
    

https://getip.info/api/isp/xml

Returns the ISP in XML format.

Example:

    
        
        ${isp}
    

User Agent

The URLs for the API are as follows:

Each URL returns the following data:

https://getip.info/api/ua/

Returns the User Agent.

Example:

    
        ${ua}
    

https://getip.info/api/ua/json

Returns the User Agent in JSON format.

Example:

    
        {"ua": "${ua}"}
    

https://getip.info/api/ua/xml

Returns the User Agent in XML format.

Example:

    
        
        ${ua}