IP Geolocation API Javascript Client Side Plugin


Overview

This document provides a comprehensive guide for setting up and using the IP Geolocation API client side JavaScript SDK. It includes detailed descriptions of configuration options, example usage, and error handling. The SDK lets you use two APIs: the IP Geolocation API (Free, Standard or Advance) and the IP Security API , so you can add geolocation and IP threat detection features to your website or app.

This plugin helps you get accurate geolocation details for any IPv4 or IPv6 address. It provides important information such as country, state, city, ZIP code, latitude, longitude, accuracy radius, confidence, dma code, connection type, ISP/Company information, and ASN data. These details are useful for showing location-based content or understanding where your users are coming from. You can also get abuse contact information, which is helpful for reporting suspicious or malicious activity.

Along with location data, the plugin also includes security lookups capability if you have a Security plan subscription. It can detect VPNs, proxy usage, Tor connections, anonymous activity, known attackers, bots, spam sources, and cloud hosting providers, and also provides a threat score to assess risk.

The plugin further offers extra features like timezone details, currency information, and device data from the User-Agent string. These details can help you customize content, set correct time zones, or display prices in the user’s local currency.


Client Side SDK Purpose

With our Free Plan, you get basic location details like country, state, city, ZIP code, and currency. The Standard Plan gives more information in addition to geolocation like timezone, network details (ASN and ISP), and user data such as browser and operating system. The Security Plan focuses on online safety and risk detection. It adds advanced security checks like VPN, proxy, and Tor detection, and provides a threat score to help identify suspicious or harmful activity. Our Advance Plan gives you everything, plus extra details like abuse information, privacy detection, connection type, and DMA codes to help with fraud detection, better marketing, and following local rules.

Important

For a side-by-side comparison of features in each plan, please see the table on our Billing page.

This SDK allows developers to integrate and utilize IP geolocation data within their web projects. Developers can use this SDK for various purposes, such as:

  1. Geographic Redirection: Redirect visitors to region-specific site versions to enhance user experience and compliance with local regulations.
  2. Analytics Enhancement: Use geolocation data to analyze web traffic and user behavior, enhancing site and content strategies.
  3. Marketing Geo-targeting & Region Segmentation: Personalize content, offers, or marketing campaigns based on the visitor’s region, DMA code, or currency for higher engagement and conversion.
  4. Form Automation: Pre-fill forms with country, state, city, zip code, and currency information, speeding up the checkout and registration processes.
  5. Digital Rights Management: Restrict or grant access to content based on the user's location to comply with legal restrictions.
  6. ISP & ASN Attribution: Determine the internet service provider and ASN ownership behind an IP address for auditing, routing analysis, and attribution.
  7. Suspicious Traffic Detection & Filtering: Detect and mitigate malicious activities by identifying traffic from suspicious locations or those using VPNs, proxies, tors, and known attackers.
  8. Abuse Contact Identification: Identify abusive or malicious IPs by retrieving their registered abuse contacts, enabling automated reporting and proactive threat response.
  9. Access Control: Block or restrict access from specific countries to comply with export controls or to reduce fraud and abuse.
  10. Hostname Resolution (DB, Live, Fallback): Retrieve the hostname of an IP using a fast internal database, live DNS lookup, or a fallback of both. Useful for reverse DNS auditing and attribution.
  11. Client Environment Profiling: Gain insights into the client's device, browser, and operating system to support adaptive UI/UX and environment-specific optimizations.
  12. Timezone Synchronization: Display times and dates in the local timezone for events, posts, or deadlines, ensuring clarity and consistency for global users.
  13. Language and Currency Customization: Automatically display content in the user's language and currency based on their geographic location.
Tip

Our JavaScript plugin let you easily integrate location and security intelligence directly into your website or web application. It enables you to deliver dynamic, personalized, and secure user experiences by providing real-time features such as geolocation details, security threat detection, and more without requiring complex backend setup.


Requirements


How to Get Your API Key

  1. Sign up here: https://app.ipgeolocation.io/signup
  2. (optional) Verify your email, if you signed up using email.
  3. Log in to your account: https://app.ipgeolocation.io/login
  4. After logging in, navigate to your Dashboard to find your API key: https://app.ipgeolocation.io/dashboard

Configurations


1. Authentication & Input

OptionTypeDescription
apiKeystringYour API key. Required unless request origin is whitelisted (available only in Paid Plans).
ipAddressstringIPv4, IPv6, or domain name to query. If omitted, the SDK auto-detects the user’s IP.

2. Basic Response Customization (Free & Paid)

OptionTypeDescription
fieldsstringComma-separated list of fields to include in the response. Available in all plans.
excludesstringComma-separated list of fields to exclude from the response. Available in all plans.
langstringLanguage code for translated fields (default: en). Requires Standard plan or higher.

3. include fields availability

OptionTypeDescriptionFreeStandardSecurityAdvance
includeHostnamebooleanInclude hostname from IPGeolocation database.CrossTickTickTick
includeLiveHostnamebooleanUse live sources to resolve hostname.CrossTickTickTick
includeHostnameFallbackLivebooleanTry DB first, fallback to live sources.CrossTickTickTick
includeTimezonebooleanInclude timezone information.CrossTickTickTick
includeUserAgentbooleanInclude client browser and device info.CrossTickTickTick
includeLocationbooleanInclude geolocation details such as city, state, and country.CrossCrossTickCross
includeNetworkbooleanInclude network-related data like ASN and ISP.CrossCrossTickCross
includeCurrencybooleanInclude currency information based on geolocation.CrossCrossTickCross
includeCountryMetadatabooleanInclude extra metadata about the user's country.CrossCrossTickCross
includeSecuritybooleanInclude VPN/proxy/Tor detection.CrossCrossCrossTick
includeAbusebooleanInclude IP abuse contact information.CrossCrossCrossTick
includeDMAbooleanInclude Designated Market Area (DMA) code.CrossCrossCrossTick
Note

No include field available in the Free plan.


4. Storage Option

OptionTypeDescription
saveToSessionStoragebooleanIf enabled, stores the geolocation data in sessionStorage to avoid making repeated API calls during the same browser session, improving performance and reducing API usage.

Setup Plugin

To access this service, add the following JavaScript call (usually within the head block of your pages).

<script src="https://static.ipgeolocation.io/ipgeolocation-api-plugin.v2.0.0.js"></script>

API Key Usage Example

Demonstrates how to use the Plugin with and without an API key. API key is optional if the request originates from a whitelisted domain (available only in paid plans).


1. No API Key (Request Origin is Whitelisted)

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI();

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

2. With API Key

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_IPGEOLOCATION_API_KEY",
        });

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Developer (Free) Plan Examples


1. Get IPGeo Default fields

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_IPGEOLOCATION_API_KEY",
        });

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2  "ip": "8.8.8.8",
3  "location": {
4    "continent_code": "NA",
5    "continent_name": "North America",
6    "country_code2": "US",
7    "country_code3": "USA",
8    "country_name": "United States",
9    "country_name_official": "United States of America",
10    "country_capital": "Washington, D.C.",
11    "state_prov": "California",
12    "state_code": "US-CA",
13    "district": "Santa Clara",
14    "city": "Mountain View",
15    "zipcode": "94043-1351",
16    "latitude": "37.42240",
17    "longitude": "-122.08421",
18    "is_eu": false,
19    "country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
20    "geoname_id": "6301403",
21    "country_emoji": "🇺🇸"
22  },
23  "country_metadata": {
24    "calling_code": "+1",
25    "tld": ".us",
26    "languages": [
27      "en-US",
28      "es-US",
29      "haw",
30      "fr"
31    ]
32  },
33  "currency": {
34    "code": "USD",
35    "name": "US Dollar",
36    "symbol": "$"
37  }
38}

2. Filtering Specific Fields from the Response

Use of 'exclude' and 'fields' to get the location fields and exclude continent information.

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_IPGEOLOCATION_API_KEY",
            fields: "location",
            excludes: "location.continent_code,location.continent_name",
        });

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2  "ip": "8.8.8.8",
3  "location": {
4    "country_code2": "US",
5    "country_code3": "USA",
6    "country_name": "United States",
7    "country_name_official": "United States of America",
8    "country_capital": "Washington, D.C.",
9    "state_prov": "California",
10    "state_code": "US-CA",
11    "district": "Santa Clara",
12    "city": "Mountain View",
13    "locality": "Mountain View",
14    "accuracy_radius": "5",
15    "confidence": "High",
16    "zipcode": "94043-1351",
17    "latitude": "37.42240",
18    "longitude": "-122.08421",
19    "is_eu": false,
20    "country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
21    "geoname_id": "6301403",
22    "country_emoji": "🇺🇸"
23  }
24}

Standard Plan Examples


1. Geolocation with Default Fields

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_IPGEOLOCATION_API_KEY",
        });

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2  "ip": "8.8.8.8",
3  "location": {
4    "continent_code": "NA",
5    "continent_name": "North America",
6    "country_code2": "US",
7    "country_code3": "USA",
8    "country_name": "United States",
9    "country_name_official": "United States of America",
10    "country_capital": "Washington, D.C.",
11    "state_prov": "California",
12    "state_code": "US-CA",
13    "district": "Santa Clara",
14    "city": "Mountain View",
15    "zipcode": "94043-1351",
16    "latitude": "37.42240",
17    "longitude": "-122.08421",
18    "is_eu": false,
19    "country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
20    "geoname_id": "6301403",
21    "country_emoji": "🇺🇸"
22  },
23  "country_metadata": {
24    "calling_code": "+1",
25    "tld": ".us",
26    "languages": [
27      "en-US",
28      "es-US",
29      "haw",
30      "fr"
31    ]
32  },
33  "network": {
34    "asn": {
35      "as_number": "AS15169",
36      "organization": "Google LLC",
37      "country": "US"
38    },
39    "company": {
40      "name": "Google LLC"
41    }
42  },
43  "currency": {
44    "code": "USD",
45    "name": "US Dollar",
46    "symbol": "$"
47  }
48}

2. Retrieving Geolocation Data in Multiple Languages

Here is an example to get the geolocation data for the client IP address in Russian (ru) language:

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_IPGEOLOCATION_API_KEY",
            lang: "ru"
        });

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>
Tip

3. Include Hostname, Timezone, and User-Agent

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_IPGEOLOCATION_API_KEY",
            fields: "location.country_name,location.country_capital",
            includeHostname: true,
            includeTimezone: true,
            includeUserAgent: true,
        });

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2  "ip": "4.5.6.7",
3  "hostname": "4.5.6.7",
4  "location": {
5    "country_name": "United States",
6    "country_capital": "Washington, D.C."
7  },
8  "time_zone": {
9    "name": "America/Chicago",
10    "offset": -6,
11    "offset_with_dst": -5,
12    "current_time": "2025-07-11 04:50:39.537-0500",
13    "current_time_unix": 1752227439.537,
14    "is_dst": true,
15    "dst_savings": 1,
16    "dst_exists": true,
17    "dst_start": {
18      "utc_time": "2025-03-09 TIME 08",
19      "duration": "+1H",
20      "gap": true,
21      "date_time_after": "2025-03-09 TIME 03",
22      "date_time_before": "2025-03-09 TIME 02",
23      "overlap": false
24    },
25    "dst_end": {
26      "utc_time": "2025-11-02 TIME 07",
27      "duration": "-1H",
28      "gap": false,
29      "date_time_after": "2025-11-02 TIME 01",
30      "date_time_before": "2025-11-02 TIME 02",
31      "overlap": true
32    }
33  },
34  "user_agent": {
35    "user_agent_string": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
36    "name": "Chrome",
37    "type": "Browser",
38    "version": "143",
39    "version_major": "143",
40    "device": {
41      "name": "Linux Desktop",
42      "type": "Desktop",
43      "brand": "Unknown",
44      "cpu": "Intel x86_64"
45    },
46    "engine": {
47      "name": "Blink",
48      "type": "Browser",
49      "version": "143",
50      "version_major": "143"
51    },
52    "operating_system": {
53      "name": "Linux",
54      "type": "Desktop",
55      "version": "??",
56      "version_major": "??",
57      "build": "??"
58    }
59  }
60}

Advanced Plan Example


1. Include DMA, Abuse, and Security

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_IPGEOLOCATION_API_KEY",
            fields: "location.country_flag,location.country_emoji",
            includeDMA: true,
            includeAbuse: true,
            includeSecurity: true,
        });

        // fetch the geolocation information from the API and use it as you want
        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2  "ip": "8.8.8.8",
3  "location": {
4    "continent_code": "NA",
5    "continent_name": "North America",
6    "country_code2": "US",
7    "country_code3": "USA",
8    "country_name": "United States",
9    "country_name_official": "United States of America",
10    "country_capital": "Washington, D.C.",
11    "state_prov": "California",
12    "state_code": "US-CA",
13    "district": "Santa Clara",
14    "city": "Mountain View",
15    "zipcode": "94043-1351",
16    "latitude": "37.42240",
17    "longitude": "-122.08421",
18    "is_eu": false,
19    "geoname_id": "6301403",
20    "accuracy_radius": "",
21    "locality": "Mountain View",
22    "dma_code": "807"
23  },
24  "country_metadata": {
25    "calling_code": "+1",
26    "tld": ".us",
27    "languages": [
28      "en-US",
29      "es-US",
30      "haw",
31      "fr"
32    ]
33  },
34  "network": {
35    "asn": {
36      "as_number": "AS15169",
37      "organization": "Google LLC",
38      "country": "US",
39      "asn_name": "GOOGLE",
40      "type": "BUSINESS",
41      "domain": "about.google",
42      "date_allocated": "",
43      "allocation_status": "assigned",
44      "num_of_ipv4_routes": "984",
45      "num_of_ipv6_routes": "104",
46      "rir": "ARIN"
47    },
48    "connection_type": "",
49    "company": {
50      "name": "Google LLC",
51      "type": "Business",
52      "domain": "googlellc.com"
53    }
54  },
55  "currency": {
56    "code": "USD",
57    "name": "US Dollar",
58    "symbol": "$"
59  },
60  "security": {
61    "threat_score": 0,
62    "is_tor": false,
63    "is_proxy": false,
64    "proxy_type": "",
65    "proxy_provider": "",
66    "is_anonymous": false,
67    "is_known_attacker": false,
68    "is_spam": false,
69    "is_bot": false,
70    "is_cloud_provider": false,
71    "cloud_provider": ""
72  },
73  "abuse": {
74    "route": "8.8.8.0/24",
75    "country": "",
76    "handle": "ABUSE5250-ARIN",
77    "name": "Abuse",
78    "organization": "Abuse",
79    "role": "abuse",
80    "kind": "group",
81    "address": "1600 Amphitheatre Parkway\nMountain View\nCA\n94043\nUnited States",
82    "emails": [
83      "network-abuse@google.com"
84    ],
85    "phone_numbers": [
86      "+1-650-253-0000"
87    ]
88  }
89}
Note

All features available in the Free plan are also included in the Standard and Advanced plans. Similarly, all features of the Standard plan are available in the Advanced plan.


Security Plan Examples

You can use following parameters to customize the API response according to your requirements.


1. Combine IP Security with Geolocation

<script>
    (async () => {
        const ipSecAPI = new IPSecurityAPI({
            apiKey: "YOUR_SECURITY_API_KEY",
            includeLocation: true,
        });

        // fetch the security information from the API and use it as you want
        const resp = await ipSecAPI.getSecurity();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2  "ip": "2.56.188.34",
3  "hostname": "2.56.188.34",
4  "security": {
5    "threat_score": 80,
6    "is_tor": false,
7    "is_proxy": true,
8    "proxy_type": "VPN",
9    "proxy_provider": "Nord VPN",
10    "is_anonymous": true,
11    "is_known_attacker": true,
12    "is_spam": false,
13    "is_bot": false,
14    "is_cloud_provider": true,
15    "cloud_provider": "Packethub S.A."
16  },
17  "location": {
18    "continent_code": "NA",
19    "continent_name": "North America",
20    "country_code2": "US",
21    "country_code3": "USA",
22    "country_name": "United States",
23    "country_name_official": "United States of America",
24    "country_capital": "Washington, D.C.",
25    "state_prov": "Texas",
26    "state_code": "US-TX",
27    "district": "Dallas",
28    "city": "Dallas",
29    "zipcode": "75201",
30    "latitude": "32.77822",
31    "longitude": "-96.79512",
32    "is_eu": false,
33    "country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
34    "geoname_id": "4684902",
35    "country_emoji": "🇺🇸"
36  }
37}

2. Combine IP Security with all fields

<script>
    (async () => {
        const ipSecAPI = new IPSecurityAPI({
            apiKey: "YOUR_SECURITY_API_KEY",
            includeLocation: true,
            includeNetwork: true,
            includeTimezone: true,
            includeUserAgent: true,
            includeCurrency: true,
            includeCountryMetadata: true,
            includeHostname: true,
        });

        // fetch the security information from the API and use it as you want
        const resp = await ipSecAPI.getSecurity();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2   "ip": "2.56.188.34",
3   "hostname": "2.56.188.34",
4   "security": {
5      "threat_score": 80,
6      "is_tor": false,
7      "is_proxy": true,
8      "proxy_type": "VPN",
9      "proxy_provider": "Nord VPN",
10      "is_anonymous": true,
11      "is_known_attacker": true,
12      "is_spam": false,
13      "is_bot": false,
14      "is_cloud_provider": true,
15      "cloud_provider": "Packethub S.A."
16   },
17   "location": {
18      "continent_code": "NA",
19      "continent_name": "North America",
20      "country_code2": "US",
21      "country_code3": "USA",
22      "country_name": "United States",
23      "country_name_official": "United States of America",
24      "country_capital": "Washington, D.C.",
25      "state_prov": "Texas",
26      "state_code": "US-TX",
27      "district": "Dallas",
28      "city": "Dallas",
29      "zipcode": "75201",
30      "latitude": "32.77822",
31      "longitude": "-96.79512",
32      "is_eu": false,
33      "country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
34      "geoname_id": "4684902",
35      "country_emoji": "🇺🇸"
36   },
37   "network": {
38      "asn": {
39         "as_number": "AS62240",
40         "organization": "Clouvider Limited",
41         "country": "GB"
42      },
43      "company": {
44         "name": "Packethub S.A."
45      }
46   },
47   "time_zone": {
48      "name": "America/Chicago",
49      "offset": -6,
50      "offset_with_dst": -5,
51      "current_time": "2025-07-16 11:00:50.605-0500",
52      "current_time_unix": 1752681650.605,
53      "is_dst": true,
54      "dst_savings": 1,
55      "dst_exists": true,
56      "dst_start": {
57         "utc_time": "2025-03-09 TIME 08",
58         "duration": "+1H",
59         "gap": true,
60         "date_time_after": "2025-03-09 TIME 03",
61         "date_time_before": "2025-03-09 TIME 02",
62         "overlap": false
63      },
64      "dst_end": {
65         "utc_time": "2025-11-02 TIME 07",
66         "duration": "-1H",
67         "gap": false,
68         "date_time_after": "2025-11-02 TIME 01",
69         "date_time_before": "2025-11-02 TIME 02",
70         "overlap": true
71      }
72   },
73   "user_agent": {
74      "user_agent_string": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
75      "name": "Chrome",
76      "type": "Browser",
77      "version": "143",
78      "version_major": "143",
79      "device": {
80         "name": "Linux Desktop",
81         "type": "Desktop",
82         "brand": "Unknown",
83         "cpu": "Intel x86_64"
84      },
85      "engine": {
86         "name": "Blink",
87         "type": "Browser",
88         "version": "143",
89         "version_major": "143"
90      },
91      "operating_system": {
92         "name": "Linux",
93         "type": "Desktop",
94         "version": "??",
95         "version_major": "??",
96         "build": "??"
97      }
98   },
99   "country_metadata": {
100      "calling_code": "+1",
101      "tld": ".us",
102      "languages": [
103         "en-US",
104         "es-US",
105         "haw",
106         "fr"
107      ]
108   },
109   "currency": {
110      "code": "USD",
111      "name": "US Dollar",
112      "symbol": "$"
113   }
114}
Note

You can get all the available fields in standard plan in combination with security data, when subscribed to security plan.


3. Request with Field Filtering for security fields

<script>
    (async () => {
        const ipSecAPI = new IPSecurityAPI({
            apiKey: "YOUR_SECURITY_API_KEY",
            includeLocation: true,
            includeNetwork: true,
            fields: "security.threat_score,location.city,network.asn.as_number"
        });

        // fetch the security information from the API and use it as you want
        const resp = await ipSecAPI.getSecurity();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample Response:

Response
1{
2  "ip": "2.56.188.34",
3  "security": {
4    "threat_score": 75
5  },
6  "location": {
7    "city": "Brisbane"
8  },
9  "network": {
10    "asn": {
11      "as_number": "AS62240"
12    }
13  }
14}

Error Handling

Inspect the status field in the response to detect any errors. A missing status field typically indicates a successful request, while its presence signals an issue. For example, if you are using developer plan and are trying to query the security information for an ipAddress, you will encounter an error as shown below:

<script>
    (async () => {
        const ipGeoAPI = new IPGeolocationAPI({
            apiKey: "YOUR_API_KEY",
            includeSecurity: true,
        });

        const resp = await ipGeoAPI.getGeolocation();

        if (!resp.error_message) {
            console.log(resp);
        } else {
            console.log("Something went wrong while fetching data", resp);
        }
    })();
</script>

Sample error response:

Response
1{
2  "error_message": "IP-hostname lookup, IP-security lookup and user-agent parsing are not supported on your free subscription. These features are available to all paid subscriptions only",
3  "error_status": 401
4}
Note

More information about error codes and messages can be found in the error codes section of our documentation. For detailed API documentation and additional features, Please refer to the official IPGeolocation API documentation.

For details specific to the IP Security API, including detailed security checks and threat intelligence, Please refer to the IP Security API documentation.

Subscribe Our Newsletter

Get the latest in geolocation tech, straight to your inbox.