Introduction
Getting started
Quick start
IP Geo API is used by hundreds of websites and applications to get detailed insights on their visitors. It is designed to be easy to use and integrate into your existing projects. Whether you are building a web application, mobile app, or any other software, IP Geo API can help you enhance your user experience by providing location-based features.
Use Cases
- Personalization: Tailor content and services based on user location.
- Analytics: Gain insights into user demographics and behavior.
- Security: Implement location-based security measures.
- Compliance: Ensure compliance with regional regulations.
API Endpoints
A variety of endpoints are available to access the IP Geo API. Each endpoint serves a specific purpose and returns data in different formats. Below are the main endpoints you can use:
https://api.geoipapi.com/
- Default endpoint that returns the user's IP address.https://api.geoipapi.com/json
- JSON endpoint that returns the user's IP address and additional information in JSON format.https://api.geoipapi.com/jsonp
- JSONP endpoint that returns the user's IP address and additional information in JSONP format. This is useful for callbacks.https://api.geoipapi.com/xml
- XML endpoint that returns the user's IP address and additional information in XML format.https://api.geoipapi.com/yml
- YAML endpoint that returns the user's IP address and additional information in YAML format.
Default Endpoint
The default endpoint for the IP Geo API is https://api.geoipapi.com/
. This endpoint returns the users ip address and nothing more. It is useful for quick checks and testing purposes.
Example Request
curl -X GET "https://api.geoipapi.com/"
Example Response
1.1.1.1
JSON Endpoint
The JSON endpoint for the IP Geo API is https://api.geoipapi.com/json
. This endpoint returns the users ip address and additional information in JSON format. It is useful for applications that require structured data.
Example Request JSON
curl -X GET "https://api.geoipapi.com/json"
Example Response JSON
{
"success": true,
"ip": "1.1.1.1",
"type": "IPv4",
"country": {
"is_eu_member": false,
"currency_code": "AUD",
"continent": "OC",
"country": "Australia",
"country_code": "AU",
"state": "Queensland",
"city": "Brisbane",
"zip": "4000",
"timezone": "Australia/Brisbane",
},
"location": {
"latitude": -27.46794,
"longitude": 153.02809,
},
"asn": {
"number": 13335,
"name": "Cloudflare, Inc.",
"network": "1.1.1.1/32",
"type": "datacenter"
}
}
JSONP Endpoint
The JSONP endpoint for the IP Geo API is https://api.geoipapi.com/jsonp
. This endpoint returns the user's IP address and additional information wrapped in a JSONP callback function. This is useful for making cross-domain requests from client-side JavaScript. You can specify the callback function name using the callback
query parameter. If no callback is specified, it defaults to callback
.
Example Request (Default Callback)
curl -X GET "https://api.geoipapi.com/jsonp"
Example Response (Default Callback)
callback({
"success": true,
"ip": "1.1.1.1",
"type": "IPv4",
"country": {
"is_eu_member": false,
"currency_code": "AUD",
"continent": "OC",
"name": "Australia",
"country_code": "AU",
"state": "Queensland",
"city": "Brisbane",
"zip": "4000",
"timezone": "Australia/Brisbane"
},
"location": {
"latitude": -27.46794,
"longitude": 153.02809
},
"asn": {
"number": 13335,
"name": "Cloudflare, Inc.",
"network": "1.1.1.1/32",
"type": "datacenter"
}
});
Example Request (Custom Callback)
curl -X GET "https://api.geoipapi.com/jsonp?callback=myCustomFunction"
Example Response (Custom Callback)
myCustomFunction({
"success": true,
"ip": "1.1.1.1",
"type": "IPv4",
"country": {
"is_eu_member": false,
"currency_code": "AUD",
"continent": "OC",
"name": "Australia",
"country_code": "AU",
"state": "Queensland",
"city": "Brisbane",
"zip": "4000",
"timezone": "Australia/Brisbane"
},
"location": {
"latitude": -27.46794,
"longitude": 153.02809
},
"asn": {
"number": 13335,
"name": "Cloudflare, Inc.",
"network": "1.1.1.1/32",
"type": "datacenter"
}
});
XML Endpoint
The XML endpoint for the IP Geo API is https://api.geoipapi.com/xml
. This endpoint returns the user's IP address and additional information in XML format. It is suitable for applications that prefer or require XML data.
Example Request XML
curl -X GET "https://api.geoipapi.com/xml"
Example Response XML
<?xml version="1.0" encoding="UTF-8"?>
<geoip>
<success>true</success>
<ip>1.1.1.1</ip>
<type>IPv4</type>
<country>
<is_eu_member>false</is_eu_member>
<currency_code>AUD</currency_code>
<continent>OC</continent>
<name>Australia</name>
<country_code>AU</country_code>
<state>Queensland</state>
<city>Brisbane</city>
<zip>4000</zip>
<timezone>Australia/Brisbane</timezone>
</country>
<location>
<latitude>-27.46794</latitude>
<longitude>153.02809</longitude>
</location>
<asn>
<number>13335</number>
<name>Cloudflare, Inc.</name>
<network>1.1.1.1/32</network>
<type>datacenter</type>
</asn>
</geoip>
YAML Endpoint
The YAML endpoint for the IP Geo API is https://api.geoipapi.com/yml
. This endpoint returns the user's IP address and additional information in YAML format. YAML is often favored for its human readability.
Example Request YML
curl -X GET "https://api.geoipapi.com/yml"
Example Response YML
success: true
ip: 1.1.1.1
type: IPv4
country:
is_eu_member: false
currency_code: AUD
continent: OC
name: Australia
country_code: AU
state: Queensland
city: Brisbane
zip: '4000'
timezone: Australia/Brisbane
location:
latitude: -27.46794
longitude: 153.02809
asn:
number: 13335
name: Cloudflare, Inc.
network: 1.1.1.1/32
type: datacenter