Self-Hosted IP Geolocation API

Deploy your own private GeoIP service with complete control over your data and infrastructure

GeoIP API Logo

Features

100% Self-Contained

No external API dependencies - everything runs on your infrastructure

Private & Secure

Keep your IP lookups private with your own isolated instance

High Performance

Optimized for speed with local database queries and minimal overhead

Open Source

Free to use, modify, and extend to meet your specific requirements

Try It Out

Results


                    

API Documentation

GET
/{ip_address}

Direct IP lookup via URL path

https://geoip-api.malith.dev/8.8.8.8
GET
/?ip={ip_address}

IP lookup via query parameter

https://geoip-api.malith.dev/?ip=8.8.8.8
GET
/api/v1/geoip/lookup/{ip}

Standard API endpoint

https://geoip-api.malith.dev/api/v1/geoip/lookup/8.8.8.8

Response Format

{
  "ip": "8.8.8.8",
  "code": "US",
  "country": "United States",
  "city": "Mountain View",
  "lat": 37.4056,
  "lon": -122.0775,
  "tz": "America/Los_Angeles",
  "isp": "Google LLC",
  "asn": 15169
}

Python Package Usage

Install Package
pip install geoip-py
Python Example
from geoip_api import GeoIPLookup

# Initialize the lookup service (downloads DB files if needed)
lookup = GeoIPLookup(download_if_missing=True)

# Look up an IP address
result = lookup.lookup('8.8.8.8')
print(result)

Why Self-Host Your GeoIP Service?

Data Privacy

Keep sensitive IP lookup data within your network perimeter. No data sharing with third-party API providers.

Cost Effective

Eliminate subscription fees and per-query costs associated with commercial GeoIP APIs.

Network Reliability

Remove external API dependencies and potential points of failure from your infrastructure.

Full Control

Customize and extend functionality to meet your specific business requirements.

Deployment Options

Docker

docker pull malithrukshan/geoip-api
docker run -p 8000:8000 malithrukshan/geoip-api
Docker Hub

Heroku

One-click deployment to Heroku

Deploy on Heroku

Self-Hosted

Clone, customize, and deploy anywhere

View Source

About the Project

GeoIP API is an open-source project designed for self-hosting your own IP geolocation service. Unlike commercial GeoIP APIs that require external calls and subscriptions, our solution gives you complete control over your infrastructure and data.

Built with FastAPI and utilizing MaxMind's GeoLite2 databases, this service operates completely locally on your infrastructure, with no external API dependencies. All IP lookups are performed against databases stored on your own servers, ensuring privacy, reliability, and elimination of per-query costs.

The project is available both as a Python package (for integration into your applications) and as a deployable API service with Docker support for easy self-hosting.

GeoIP API Logo