You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

geoip2-api

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geoip2-api

This module allows obtaining the client's geolocation using their IP address, leveraging data retrieved from a fast API.

1.1.2
latest
Source
npmnpm
Version published
Weekly downloads
157
-21.5%
Maintainers
1
Weekly downloads
 
Created
Source

🗺️ GeoIP Lite 2: API Wrapper

The number of downloads Last commit Issues Commit activity Code size

📝 Information

This documentation covers a lightweight Node.js module designed for interacting with a geolocation data API. The module enables efficient retrieval of location details for specific IP addresses, utilizing native modules for optimal performance.

We utilize the MaxMind database via the geoip-lite2 module for our API.

💻 Locally

There is an alternative to this module that allows for local geolocation retrieval based on a specific IP address. However, this will increase the memory usage because the alternative module stores the MaxMind database in RAM.

geoip-lite2 on npm

📥 Installation

npm install geoip2-api

😎 Example

const geoIp = require('geoip2-api');

(async () => {
    const data = await geoIp.get('185.21.84.216');
    console.log(data);
});

✨ Output

GET https://api.sefinek.net/api/v2/geoip/185.21.84.216

{
  "success": true,
  "status": 200,
  "ip": "185.21.84.216",
  "data": {
    "range": [3105182720, 3105183743],
    "country": "PL",
    "region": "30",
    "eu": "1",
    "timezone": "Europe/Warsaw",
    "city": "Piła",
    "ll": [53.1492, 16.7461],
    "metro": 0,
    "area": 20
  },
  "type": "unicast"
}

🌠 API Tip

If you want to get the client's geolocation, instead of providing an IP, use /api/v2/geoip/myip.

💙 Support

For any questions or issues related to the script, please visit the GitHub repository for the latest updates and support.

If you like this module, please star ⭐ the repository.

🔑 MIT License

This GeoIP API client script is provided under the MIT License. See the LICENSE file for more details.

Copyright 2023-2024 © by Sefinek. All Rights Reserved.

Keywords

geo api

FAQs

Package last updated on 24 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.