API Documentation

Authentication

All API requests (except /api/health) require authentication using an API token.

You can authenticate using one of these methods:

X-API-Key Header (Recommended)

X-API-Key: your_api_token

Authorization Bearer

Authorization: Bearer your_api_token

Query Parameter

?api_key=your_api_token

Endpoints

GET /api/json/{ip}

Look up geolocation data for an IP address.

Parameters

Parameter Type Description
ip string IPv4 or IPv6 address. Optional - defaults to requester's IP.

Example Request

curl -H "X-API-Key: your_token" \
     "https://api.geoipradar.com/json/8.8.8.8"

Example Response

{
  "status": "success",
  "ip": "8.8.8.8",
  "country": "United States",
  "country_code": "US",
  "region": "California",
  "region_code": "CA",
  "city": "Mountain View",
  "postal_code": "94043",
  "latitude": 37.422,
  "longitude": -122.085,
  "timezone": "America/Los_Angeles",
  "isp": "Google LLC",
  "org": "Google LLC",
  "asn": "AS15169",
  "continent": "North America",
  "continent_code": "NA",
  "currency": "USD",
  "is_eu": false
}
GET /api/?ip={ip}

Alternative endpoint using query parameter instead of path.

GET /api/me

Get information about your account and current usage.

Example Response

{
  "status": "success",
  "user": {
    "id": 1,
    "name": "John Doe",
    "email": "[email protected]"
  },
  "plan": {
    "name": "Free",
    "requests_per_month": 30000
  },
  "usage": {
    "current_month": 1234,
    "limit": 30000,
    "remaining": 8766
  }
}
GET /api/health

Health check endpoint. No authentication required.

Example Response

{
  "status": "ok",
  "service": "GeoIP API",
  "timestamp": "2024-01-15T10:30:00+00:00"
}

Error Codes

Code Description
400 Bad Request - Invalid IP address format
401 Unauthorized - Missing or invalid API token
429 Too Many Requests - Monthly limit exceeded
503 Service Unavailable - Temporary backend issue

Laravel Package

Official Laravel GeoIP Package

We've created an official Laravel package for easier integration. It includes automated fallback to 5+ other IP geolocation services for maximum reliability.

  • Simple Facade and helper functions
  • Automatic fallback to 5+ backup providers
  • Built-in caching support
composer require geoipradar/laravel-geoip
View on GitHub

Rate Limits

Rate limits are based on your subscription plan and reset at the start of each calendar month.

Plan Requests/Month
Free 30,000
Starter 100,000
Pro 500,000
Enterprise 5,000,000